diff --git a/Library/Homebrew/dev-cmd/bump-formula-pr.rb b/Library/Homebrew/dev-cmd/bump-formula-pr.rb index f00a3c0ec1fea13c339e1c21e966e3c3e75deca2..f70c846d1a2c3d312cc9499967f32b1b2b189997 100644 --- a/Library/Homebrew/dev-cmd/bump-formula-pr.rb +++ b/Library/Homebrew/dev-cmd/bump-formula-pr.rb @@ -445,8 +445,8 @@ module Homebrew def inreplace_pairs(path, replacement_pairs) if args.dry_run? - contents = path.open("r") { |f| Formulary.ensure_utf8_encoding(f).read } - contents.extend(StringInreplaceExtension) + str = path.open("r") { |f| Formulary.ensure_utf8_encoding(f).read } + contents = StringInreplaceExtension.new(str) replacement_pairs.each do |old, new| ohai "replace #{old.inspect} with #{new.inspect}" unless args.quiet? raise "No old value for new value #{new}! Did you pass the wrong arguments?" unless old @@ -455,8 +455,8 @@ module Homebrew end raise Utils::InreplaceError, path => contents.errors unless contents.errors.empty? - path.atomic_write(contents) if args.write? - contents + path.atomic_write(contents.inreplace_string) if args.write? + contents.inreplace_string else Utils::Inreplace.inreplace(path) do |s| replacement_pairs.each do |old, new|