Method: Jetfuel::Actions#replace_in_file
- Defined in:
- lib/jetfuel/actions.rb
#replace_in_file(relative_path, find, replace) ⇒ Object
3 4 5 6 7 8 9 10 |
# File 'lib/jetfuel/actions.rb', line 3 def replace_in_file(relative_path, find, replace) path = File.join(destination_root, relative_path) contents = IO.read(path) unless contents.gsub!(find, replace) raise "#{find.inspect} not found in #{relative_path}" end File.open(path, "w") { |file| file.write(contents) } end |