Skip to content

Commit

Permalink
use file rb
Browse files Browse the repository at this point in the history
  • Loading branch information
fulldecent committed Sep 15, 2016
1 parent bee4568 commit 9a031a7
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,17 @@ end
def replace_variables_in_files(substitutions)
Dir.glob("**/*") do |file_name|
next if File.directory?(file_name)
text = IO.binread(file_name)
substitutions.each do |old, new|
text.gsub!(old, new)

text = ''
File.open(file_name, 'rb') do |file|
text = file.read
substitutions.each do |old, new|
text.gsub!(old, new)
end
end
File.open(file_name, 'wb') do |file|
file.write(text)
end
IO.binwrite(file_name, text)
end
end

Expand Down

0 comments on commit 9a031a7

Please sign in to comment.