aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Cellar/homebrew/brewkit.rb12
1 files changed, 4 insertions, 8 deletions
diff --git a/Cellar/homebrew/brewkit.rb b/Cellar/homebrew/brewkit.rb
index 0c831f9bb..87ae0de87 100644
--- a/Cellar/homebrew/brewkit.rb
+++ b/Cellar/homebrew/brewkit.rb
@@ -149,20 +149,16 @@ private
end
end
-
def inreplace(path, before, after)
- before=before.to_s
- after=after.to_s
+ before=before.to_s.gsub('"', '\"').gsub('/', '\/')
+ after=after.to_s.gsub('"', '\"').gsub('/', '\/')
- 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}"`
+ #TODO use ed -- less to escape
+ `perl -pi -e "s/#{before}/#{after}/g" "#{path}"`
end
def system cmd