aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Howell2009-05-22 00:15:28 +0100
committerMax Howell2009-05-22 00:15:48 +0100
commit8faa3a89206fed8a7eef26b74de9ca21476020d4 (patch)
tree87e707a432663fcc3608a058ddee1272ddf21e13
parent5c62420d2708fd114a26ed0526c5388e77d2af71 (diff)
downloadbrew-8faa3a89206fed8a7eef26b74de9ca21476020d4.tar.bz2
Escape inreplace
-rw-r--r--Cellar/homebrew/brewkit.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/Cellar/homebrew/brewkit.rb b/Cellar/homebrew/brewkit.rb
index 187ba6549..0c831f9bb 100644
--- a/Cellar/homebrew/brewkit.rb
+++ b/Cellar/homebrew/brewkit.rb
@@ -151,7 +151,17 @@ end
def inreplace(path, before, after)
+ before=before.to_s
+ after=after.to_s
+
+ before.gsub! '"', '\"'
+ after.gsub! '"', '\"'
+ before.gsub! '|', '\|"'
+ after.gsub! '|', '\|"'
# we're not using Ruby because the perl script is more concise
+ #TODO the above escapes are worse, use a proper ruby script :P
+ #TODO optimise it by taking before and after as arrays
+ #Bah, just make the script writers do it themselves with a standard collect block
`perl -pi -e "s|#{before}|#{after}|g" "#{path}"`
end