Merge pull request #16515 from issyl0/bump-point-out-if-formulae-are-synced
dev-cmd/bump: Point out if formulae should be kept in sync with others
This commit is contained in:
commit
3d03ed2710
@ -466,6 +466,14 @@ module Homebrew
|
|||||||
Latest livecheck version: #{new_versions}
|
Latest livecheck version: #{new_versions}
|
||||||
Latest Repology version: #{repology_latest}
|
Latest Repology version: #{repology_latest}
|
||||||
EOS
|
EOS
|
||||||
|
if formula_or_cask.is_a?(Formula)
|
||||||
|
require "formula_auditor"
|
||||||
|
auditor = FormulaAuditor.new(formula_or_cask)
|
||||||
|
puts <<~EOS if auditor.synced_with_other_formulae?
|
||||||
|
Version syncing: #{title_name} version should be kept in sync with
|
||||||
|
#{synced_with(auditor, formula_or_cask, new_version.general).join(", ")}.
|
||||||
|
EOS
|
||||||
|
end
|
||||||
puts <<~EOS unless args.no_pull_requests?
|
puts <<~EOS unless args.no_pull_requests?
|
||||||
Open pull requests: #{open_pull_requests || "none"}
|
Open pull requests: #{open_pull_requests || "none"}
|
||||||
Closed pull requests: #{closed_pull_requests || "none"}
|
Closed pull requests: #{closed_pull_requests || "none"}
|
||||||
@ -503,4 +511,28 @@ module Homebrew
|
|||||||
|
|
||||||
system HOMEBREW_BREW_FILE, *bump_cask_pr_args
|
system HOMEBREW_BREW_FILE, *bump_cask_pr_args
|
||||||
end
|
end
|
||||||
|
|
||||||
|
sig {
|
||||||
|
params(
|
||||||
|
auditor: FormulaAuditor,
|
||||||
|
formula: Formula,
|
||||||
|
new_version: T.nilable(T.any(Version, Cask::DSL::Version)),
|
||||||
|
).returns(T::Array[String])
|
||||||
|
}
|
||||||
|
def synced_with(auditor, formula, new_version)
|
||||||
|
synced_with = []
|
||||||
|
|
||||||
|
auditor.synced_versions_formulae_json.each do |synced_formulae|
|
||||||
|
next unless synced_formulae.include?(formula.name)
|
||||||
|
|
||||||
|
synced_formulae.each do |synced_formula|
|
||||||
|
synced_formula = Formulary.factory(synced_formula)
|
||||||
|
next if synced_formula == formula.name
|
||||||
|
|
||||||
|
synced_with << synced_formula.name if synced_formula.version != new_version
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
synced_with
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -141,20 +141,28 @@ module Homebrew
|
|||||||
@aliases ||= Formula.aliases + Formula.tap_aliases
|
@aliases ||= Formula.aliases + Formula.tap_aliases
|
||||||
end
|
end
|
||||||
|
|
||||||
SYNCED_VERSIONS_FORMULAE_FILE = "synced_versions_formulae.json"
|
def synced_versions_formulae_json
|
||||||
|
@synced_versions_formulae_json ||= JSON.parse(File.read("#{formula.tap.path}/synced_versions_formulae.json"))
|
||||||
|
end
|
||||||
|
|
||||||
|
def synced_with_other_formulae?
|
||||||
|
return false unless formula.tap
|
||||||
|
|
||||||
|
synced_versions_formulae_file = "#{formula.tap.path}/synced_versions_formulae.json"
|
||||||
|
return false unless File.exist?(synced_versions_formulae_file)
|
||||||
|
|
||||||
|
synced_versions_formulae_json.any? { |synced_version_formulae| synced_version_formulae.include?(formula.name) }
|
||||||
|
end
|
||||||
|
|
||||||
def audit_synced_versions_formulae
|
def audit_synced_versions_formulae
|
||||||
return unless formula.tap
|
return unless formula.tap
|
||||||
|
return unless synced_with_other_formulae?
|
||||||
synced_versions_formulae_file = formula.tap.path/SYNCED_VERSIONS_FORMULAE_FILE
|
|
||||||
return unless synced_versions_formulae_file.file?
|
|
||||||
|
|
||||||
name = formula.name
|
name = formula.name
|
||||||
version = formula.version
|
version = formula.version
|
||||||
|
|
||||||
synced_versions_formulae = JSON.parse(synced_versions_formulae_file.read)
|
synced_versions_formulae_json.each do |synced_version_formulae|
|
||||||
synced_versions_formulae.each do |synced_version_formulae|
|
next unless synced_version_formulae.include?(name)
|
||||||
next unless synced_version_formulae.include? name
|
|
||||||
|
|
||||||
synced_version_formulae.each do |synced_formula|
|
synced_version_formulae.each do |synced_formula|
|
||||||
next if synced_formula == name
|
next if synced_formula == name
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user