aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorAdam Vandenberg2010-04-03 17:52:58 -0700
committerAdam Vandenberg2010-04-03 17:54:49 -0700
commite1c9e2492039b81d264f45555d65d0626282bfaf (patch)
treee2ffb33fe7d9ad1021ef19a5d64c109dcc06470c /Library
parente7d7cecceee839893d2afcececd4086b80aa818b (diff)
downloadbrew-e1c9e2492039b81d264f45555d65d0626282bfaf.tar.bz2
Add s.get_make_var
This allows more complicated transformations to happen, such as stripping out part of the variable.
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/utils.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb
index 088aea195..a0ec97af6 100644
--- a/Library/Homebrew/utils.rb
+++ b/Library/Homebrew/utils.rb
@@ -167,6 +167,12 @@ module HomebrewInreplaceExtension
gsub! Regexp.new("^#{flag}[ \\t]*=(.*)$\n?"), ""
end
end
+ # Finds the specified variable
+ def get_make_var flag
+ m = match Regexp.new("^#{flag}[ \\t]*=[ \\t]*(.*)$")
+ return m[1] if m
+ return nil
+ end
end
def inreplace path, before=nil, after=nil