audit: check for unversioned formulae.

If we're adding a versioned formulae we want to ensure that there's also
an unversioned one too.
This commit is contained in:
Mike McQuaid 2017-03-26 20:36:37 +01:00
parent a34f7277de
commit 181275c016

View File

@ -331,6 +331,13 @@ class FormulaAuditor
problem "File should end with a newline" unless text.trailing_newline?
if formula.versioned_formula?
unversioned_formula = Pathname.new formula.path.to_s.gsub(/@.*\.rb$/, ".rb")
unless unversioned_formula.exist?
unversioned_name = unversioned_formula.basename(".rb")
problem "#{formula} is versioned but no #{unversioned_name} formula exists"
end
else
versioned_formulae = Dir[formula.path.to_s.gsub(/\.rb$/, "@*.rb")]
needs_versioned_alias = !versioned_formulae.empty? &&
formula.tap &&
@ -351,6 +358,7 @@ class FormulaAuditor
ln -s #{formula.path.to_s.gsub(formula.tap.path, "..")} #{alias_name}
EOS
end
end
return unless @strict