aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/utils.rb
diff options
context:
space:
mode:
authorJack Nagel2013-07-11 21:55:02 -0500
committerJack Nagel2013-07-12 16:23:06 -0500
commitc8e79c3309d79b95ccdf166574485e638522c8db (patch)
tree20a0059edf4522853badf13e5a0979102b8f53b9 /Library/Homebrew/utils.rb
parent6a205ab26313eb1845bdbc1c3e9af5e7041bc5d3 (diff)
downloadbrew-c8e79c3309d79b95ccdf166574485e638522c8db.tar.bz2
Move inreplace off of Object
Closes Homebrew/homebrew#21163.
Diffstat (limited to 'Library/Homebrew/utils.rb')
-rw-r--r--Library/Homebrew/utils.rb22
1 files changed, 1 insertions, 21 deletions
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