Skip to content
Snippets Groups Projects
Unverified Commit 97cf1750 authored by Mike McQuaid's avatar Mike McQuaid Committed by GitHub
Browse files

Merge pull request #8101 from vidusheeamoli/fix-StringInreplaceExtension-usage

dev-cmd/bump-formula-pr.rb: fix StringInreplaceExtension usage
parents 8b115847 cff79348
No related branches found
No related tags found
No related merge requests found
......@@ -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|
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment