diff options
| author | Adam Vandenberg | 2010-02-01 21:57:16 -0800 |
|---|---|---|
| committer | Adam Vandenberg | 2010-02-02 08:57:56 -0800 |
| commit | 5474cf1a95616243f5592c8c5951048ea5cbafe3 (patch) | |
| tree | 1d87ea2a4d7c84eba9b26ba6505fc924229b60d0 /Library | |
| parent | d8b093f279048d955eca9a2658678964b06dca99 (diff) | |
| download | brew-5474cf1a95616243f5592c8c5951048ea5cbafe3.tar.bz2 | |
Let change_make_var! append to existing value.
To existing flag value can be specified with "\\1".
To append values to a flag, call with:
s.change_make_var! "THE_FLAG", "\\1 more-flag-values"
The same trick can be used to prepend or surround values as well.
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/utils.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb index a1a40e95f..ae6ca50b9 100644 --- a/Library/Homebrew/utils.rb +++ b/Library/Homebrew/utils.rb @@ -181,9 +181,9 @@ module HomebrewInreplaceExtension # Looks for Makefile style variable defintions and replaces the # value with "new_value", or removes the definition entirely. # See inreplace in utils.rb - def change_make_var! flag, new_value - new_value = "#{flag}=#{new_value}" unless new_value.to_s.empty? - gsub! Regexp.new("^#{flag}\\s*=.*$"), new_value.to_s + def change_make_var! flag, new_value=nil + new_value = "#{flag}=#{new_value}" unless new_value == nil + gsub! Regexp.new("^#{flag}\\s*=\\s*(.*)$"), new_value end def remove_make_var! flags flags.each { |flag| change_make_var! flag, "" } |
