mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
formula_auditor: add audit for formulae with synced versions
This commit is contained in:
parent
000f5ba701
commit
ce2d946a7c
@ -118,6 +118,31 @@ module Homebrew
|
||||
@aliases ||= Formula.aliases + Formula.tap_aliases
|
||||
end
|
||||
|
||||
SYNCED_VERSIONS_FORMULAE_FILE = "synced_versions_formulae.json"
|
||||
|
||||
def audit_synced_versions_formulae
|
||||
synced_versions_formulae_file = formula.tap.path/SYNCED_VERSIONS_FORMULAE_FILE
|
||||
return unless synced_versions_formulae_file.file?
|
||||
|
||||
name = formula.name
|
||||
version = formula.version
|
||||
|
||||
synced_versions_formulae = JSON.parse(synced_versions_formulae_file.read)
|
||||
synced_versions_formulae.each do |synced_version_formulae|
|
||||
next unless synced_version_formulae.include? name
|
||||
|
||||
synced_version_formulae.each do |synced_formula|
|
||||
next if synced_formula == name
|
||||
|
||||
if (synced_version = Formulary.factory(synced_formula).version) != version
|
||||
problem "Version of `#{synced_formula}` (#{synced_version}) should match version of `#{name}` (#{version})"
|
||||
end
|
||||
end
|
||||
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
def audit_formula_name
|
||||
name = formula.name
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user