Intercept calls to sub! in inreplace blocks
This commit is contained in:
parent
50b900daf3
commit
cb69f339b8
@ -56,13 +56,21 @@ end
|
|||||||
|
|
||||||
# used by the inreplace function (in utils.rb)
|
# used by the inreplace function (in utils.rb)
|
||||||
module StringInreplaceExtension
|
module StringInreplaceExtension
|
||||||
# Warn if nothing was replaced
|
def sub! before, after
|
||||||
def gsub! before, after, audit_result=true
|
result = super
|
||||||
sub = super(before, after)
|
unless result
|
||||||
if audit_result and sub.nil?
|
|
||||||
opoo "inreplace: replacement of '#{before}' with '#{after}' failed"
|
opoo "inreplace: replacement of '#{before}' with '#{after}' failed"
|
||||||
end
|
end
|
||||||
return sub
|
result
|
||||||
|
end
|
||||||
|
|
||||||
|
# Warn if nothing was replaced
|
||||||
|
def gsub! before, after, audit_result=true
|
||||||
|
result = super(before, after)
|
||||||
|
if audit_result && result.nil?
|
||||||
|
opoo "inreplace: replacement of '#{before}' with '#{after}' failed"
|
||||||
|
end
|
||||||
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
# Looks for Makefile style variable defintions and replaces the
|
# Looks for Makefile style variable defintions and replaces the
|
||||||
|
Loading…
x
Reference in New Issue
Block a user