From 543a113712635b64bcfe0804acea0d8079b8bd44 Mon Sep 17 00:00:00 2001 From: Max Howell Date: Thu, 15 Oct 2009 12:36:09 +0100 Subject: Some subdirs and renames to aid homebrew n00bs The classes better reflect their contents. I'm sure this change may be contentious, but I am a sucker for trying to create source bases that are easy to get to grips with and easy to navigate. brewkit.rb is now a deprecated file. --- Library/Homebrew/utils.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'Library/Homebrew/utils.rb') diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb index 976adaa3a..6ce87f190 100644 --- a/Library/Homebrew/utils.rb +++ b/Library/Homebrew/utils.rb @@ -122,3 +122,17 @@ def arch_for_command cmd return archs end + + +# replaces before with after for the file path +def inreplace path, before, after + before=Regexp.escape before.to_s + before.gsub! "/", "\\/" # I guess not escaped as delimiter varies + after=after.to_s + after.gsub! "\\", "\\\\" + after.gsub! "/", "\\/" + after.gsub! "$", "\\$" + + # FIXME use proper Ruby for teh exceptions! + safe_system "/usr/bin/perl", "-pi", "-e", "s/#{before}/#{after}/g", path +end -- cgit v1.2.3