diff options
| author | Adam Vandenberg | 2010-07-12 10:34:12 -0700 |
|---|---|---|
| committer | Adam Vandenberg | 2010-07-12 10:38:06 -0700 |
| commit | de1ed86fed98b235df3c5edfd1575d98bb5aad49 (patch) | |
| tree | 55c2f5eb0dbac97ee4bf5d29fe779b76d2ed9130 /Library | |
| parent | 6315f6f0b82921dc3e2df3c4e07aa2de0d142534 (diff) | |
| download | homebrew-de1ed86fed98b235df3c5edfd1575d98bb5aad49.tar.bz2 | |
Use regex in brew-audit and add path concat test.
Diffstat (limited to 'Library')
| -rwxr-xr-x | Library/Contributions/examples/brew-audit.rb | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/Library/Contributions/examples/brew-audit.rb b/Library/Contributions/examples/brew-audit.rb index 2c5d3a80d..50728693d 100755 --- a/Library/Contributions/examples/brew-audit.rb +++ b/Library/Contributions/examples/brew-audit.rb @@ -14,18 +14,25 @@ def ff end ff.each do |f| + text = "" + File.open(f.path, "r") { |afile| text = afile.read } + problems = [] - unless `grep "# depends_on 'cmake'" "#{f.path}"`.strip.empty? - problems << " * Commented cmake support still in #{f.name}" + if /# depends_on 'cmake'/ =~ text + problems << " * Commented cmake support found." + end + + if /\?use_mirror=/ =~ text + problems << " * Remove 'use_mirror' from url." end - unless `grep "\?use_mirror=" "#{f.path}"`.strip.empty? - problems << " * Remove 'use_mirror' from url for #{f.name}" + if /(#\{\w+\s*\+\s*['"][^}]+\})/ =~ text + problems << " * Try not to concatenate paths in string interpolation:\n #{$1}" end unless problems.empty? puts "#{f.name}:" - puts problems * '\n' + puts problems * "\n" puts end end |
