From e1c9e2492039b81d264f45555d65d0626282bfaf Mon Sep 17 00:00:00 2001 From: Adam Vandenberg Date: Sat, 3 Apr 2010 17:52:58 -0700 Subject: [PATCH] Add s.get_make_var This allows more complicated transformations to happen, such as stripping out part of the variable. --- Library/Homebrew/utils.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb index 088aea1955..a0ec97af68 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