From c8e79c3309d79b95ccdf166574485e638522c8db Mon Sep 17 00:00:00 2001 From: Jack Nagel Date: Thu, 11 Jul 2013 21:55:02 -0500 Subject: Move inreplace off of Object Closes Homebrew/homebrew#21163. --- Library/Homebrew/utils.rb | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) (limited to 'Library/Homebrew/utils.rb') diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb index 800ec0544..2786d6b7a 100644 --- a/Library/Homebrew/utils.rb +++ b/Library/Homebrew/utils.rb @@ -2,6 +2,7 @@ require 'pathname' require 'exceptions' require 'macos' require 'utils/json' +require 'utils/inreplace' require 'open-uri' class Tty @@ -213,27 +214,6 @@ def archs_for_command cmd Pathname.new(cmd).archs end -def inreplace paths, before=nil, after=nil - Array(paths).each do |path| - f = File.open(path, 'r') - s = f.read - - if before.nil? && after.nil? - s.extend(StringInreplaceExtension) - yield s - else - sub = s.gsub!(before, after) - if sub.nil? - opoo "inreplace in '#{path}' failed" - puts "Expected replacement of '#{before}' with '#{after}'" - end - end - - f.reopen(path, 'w').write(s) - f.close - end -end - def ignore_interrupts(opt = nil) std_trap = trap("INT") do puts "One sec, just cleaning up" unless opt == :quietly -- cgit v1.2.3