diff options
| author | Max Howell | 2009-05-22 00:15:28 +0100 |
|---|---|---|
| committer | Max Howell | 2009-05-22 00:15:48 +0100 |
| commit | 8faa3a89206fed8a7eef26b74de9ca21476020d4 (patch) | |
| tree | 87e707a432663fcc3608a058ddee1272ddf21e13 | |
| parent | 5c62420d2708fd114a26ed0526c5388e77d2af71 (diff) | |
| download | brew-8faa3a89206fed8a7eef26b74de9ca21476020d4.tar.bz2 | |
Escape inreplace
| -rw-r--r-- | Cellar/homebrew/brewkit.rb | 10 |
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 |
