2010-06-23 11:20:47 -07:00
|
|
|
require 'formula'
|
|
|
|
require 'utils'
|
|
|
|
|
|
|
|
def ff
|
|
|
|
if ARGV.named.empty?
|
|
|
|
stuff = []
|
|
|
|
Formulary.read_all do |name,k|
|
|
|
|
stuff << Formula.factory(name)
|
|
|
|
end
|
|
|
|
return stuff
|
|
|
|
else
|
|
|
|
return ARGV.formulae
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
ff.each do |f|
|
2010-07-12 10:34:12 -07:00
|
|
|
text = ""
|
|
|
|
File.open(f.path, "r") { |afile| text = afile.read }
|
|
|
|
|
2010-06-23 11:20:47 -07:00
|
|
|
problems = []
|
2010-07-12 10:34:12 -07:00
|
|
|
if /# depends_on 'cmake'/ =~ text
|
|
|
|
problems << " * Commented cmake support found."
|
|
|
|
end
|
|
|
|
|
|
|
|
if /\?use_mirror=/ =~ text
|
|
|
|
problems << " * Remove 'use_mirror' from url."
|
2010-06-23 11:20:47 -07:00
|
|
|
end
|
|
|
|
|
2010-07-23 21:31:32 -07:00
|
|
|
# 2 (or more, if in an if block) spaces before depends_on, please
|
|
|
|
if /^\ ?depends_on/ =~ text
|
|
|
|
problems << " * Check indentation of 'depends_on'."
|
|
|
|
end
|
|
|
|
|
2010-07-12 10:34:12 -07:00
|
|
|
if /(#\{\w+\s*\+\s*['"][^}]+\})/ =~ text
|
|
|
|
problems << " * Try not to concatenate paths in string interpolation:\n #{$1}"
|
2010-06-23 11:20:47 -07:00
|
|
|
end
|
|
|
|
|
|
|
|
unless problems.empty?
|
|
|
|
puts "#{f.name}:"
|
2010-07-12 10:34:12 -07:00
|
|
|
puts problems * "\n"
|
2010-06-23 11:20:47 -07:00
|
|
|
puts
|
|
|
|
end
|
|
|
|
end
|