diff options
Diffstat (limited to 'Library/Homebrew/extend/string.rb')
| -rw-r--r-- | Library/Homebrew/extend/string.rb | 14 | 
1 files changed, 11 insertions, 3 deletions
diff --git a/Library/Homebrew/extend/string.rb b/Library/Homebrew/extend/string.rb index d18539b5c..d85e029f3 100644 --- a/Library/Homebrew/extend/string.rb +++ b/Library/Homebrew/extend/string.rb @@ -56,13 +56,21 @@ end  # used by the inreplace function (in utils.rb)  module StringInreplaceExtension +  def sub! before, after +    result = super +    unless result +      opoo "inreplace: replacement of '#{before}' with '#{after}' failed" +    end +    result +  end +    # Warn if nothing was replaced    def gsub! before, after, audit_result=true -    sub = super(before, after) -    if audit_result and sub.nil? +    result = super(before, after) +    if audit_result && result.nil?        opoo "inreplace: replacement of '#{before}' with '#{after}' failed"      end -    return sub +    result    end    # Looks for Makefile style variable defintions and replaces the  | 
