diff options
| -rw-r--r-- | Library/Homebrew/extend/string.rb | 6 | ||||
| -rw-r--r-- | Library/Homebrew/utils.rb | 6 | 
2 files changed, 9 insertions, 3 deletions
diff --git a/Library/Homebrew/extend/string.rb b/Library/Homebrew/extend/string.rb index 3238f97df..a0cd4d635 100644 --- a/Library/Homebrew/extend/string.rb +++ b/Library/Homebrew/extend/string.rb @@ -17,7 +17,8 @@ module StringInreplaceExtension    # value with "new_value", or removes the definition entirely.    def change_make_var! flag, new_value      new_value = "#{flag}=#{new_value}" -    gsub! Regexp.new("^#{flag}[ \\t]*=[ \\t]*(.*)$"), new_value +    sub = gsub! Regexp.new("^#{flag}[ \\t]*=[ \\t]*(.*)$"), new_value +    opoo "inreplace: changing '#{flag}' to '#{new_value}' failed" if sub.nil?    end    # Removes variable assignments completely. @@ -26,7 +27,8 @@ module StringInreplaceExtension      flags = [flags] unless flags.kind_of? Array      flags.each do |flag|        # Also remove trailing \n, if present. -      gsub! Regexp.new("^#{flag}[ \\t]*=(.*)$\n?"), "" +      sub = gsub! Regexp.new("^#{flag}[ \\t]*=(.*)$\n?"), "" +      opoo "inreplace: removing '#{flag}' failed" if sub.nil?      end    end diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb index bb2e7dd83..6c29ba105 100644 --- a/Library/Homebrew/utils.rb +++ b/Library/Homebrew/utils.rb @@ -216,7 +216,11 @@ def inreplace path, before=nil, after=nil        s.extend(StringInreplaceExtension)        yield s      else -      s.gsub!(before, after) +      sub = s.gsub!(before, after) +      if sub.nil? +        opoo "inreplace in '#{path}' failed" +        puts "Expected replacement of '#{before}' with '#{after}'" +      end      end      f.reopen(path, 'w').write(s)  | 
