dev-cmd/bump-formula-pr.rb: fix StringInreplaceExtension usage

This commit is contained in:
vidusheeamoli 2020-07-27 17:50:38 +05:30 committed by Mike McQuaid
parent 5ca6a59f27
commit cff79348c9
No known key found for this signature in database
GPG Key ID: 48A898132FD8EE70

View File

@ -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|