share Install.print_dry_run_dependencies
This commit is contained in:
parent
374dd3dea2
commit
5491f7b1bd
@ -326,7 +326,7 @@ module Homebrew
|
|||||||
|
|
||||||
formula_installers.each do |fi|
|
formula_installers.each do |fi|
|
||||||
f = fi.formula
|
f = fi.formula
|
||||||
print_dry_run_dependencies(f, fi.compute_dependencies)
|
print_dry_run_dependencies(f, fi.compute_dependencies, &:name)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return
|
return
|
||||||
@ -347,16 +347,14 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
private_class_method :install_formula
|
private_class_method :install_formula
|
||||||
|
|
||||||
def print_dry_run_dependencies(formula, dependencies)
|
def print_dry_run_dependencies(formula, dependencies, &block)
|
||||||
return if dependencies.empty?
|
return if dependencies.empty?
|
||||||
|
|
||||||
plural = "dependency".pluralize(dependencies.count)
|
plural = "dependency".pluralize(dependencies.count)
|
||||||
ohai "Would install #{dependencies.count} #{plural} for #{formula.name}:"
|
ohai "Would install #{dependencies.count} #{plural} for #{formula.name}:"
|
||||||
formula_names = dependencies.map(&:first).map(&:to_formula).map(&:name)
|
formula_names = dependencies.map(&:first).map(&:to_formula).map(&block)
|
||||||
puts formula_names.join(" ")
|
puts formula_names.join(" ")
|
||||||
end
|
end
|
||||||
|
|
||||||
private_class_method :print_dry_run_dependencies
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -94,22 +94,6 @@ module Homebrew
|
|||||||
.map { |k| Keg.new(k.resolved_path) }
|
.map { |k| Keg.new(k.resolved_path) }
|
||||||
end
|
end
|
||||||
|
|
||||||
def print_dry_run_dependencies(formula, fi_deps)
|
|
||||||
return if fi_deps.empty?
|
|
||||||
|
|
||||||
plural = "dependency".pluralize(fi_deps.count)
|
|
||||||
ohai "Would upgrade #{fi_deps.count} #{plural} for #{formula.full_specified_name}:"
|
|
||||||
formulae_upgrades = fi_deps.map(&:first).map(&:to_formula).map do |f|
|
|
||||||
name = f.full_specified_name
|
|
||||||
if f.optlinked?
|
|
||||||
"#{name} #{Keg.new(f.opt_prefix).version} -> #{f.pkg_version}"
|
|
||||||
else
|
|
||||||
"#{name} #{f.pkg_version}"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
puts formulae_upgrades.join(", ")
|
|
||||||
end
|
|
||||||
|
|
||||||
def print_upgrade_message(formula, fi_options)
|
def print_upgrade_message(formula, fi_options)
|
||||||
version_upgrade = if formula.optlinked?
|
version_upgrade = if formula.optlinked?
|
||||||
"#{Keg.new(formula.opt_prefix).version} -> #{formula.pkg_version}"
|
"#{Keg.new(formula.opt_prefix).version} -> #{formula.pkg_version}"
|
||||||
@ -178,7 +162,14 @@ module Homebrew
|
|||||||
formula = formula_installer.formula
|
formula = formula_installer.formula
|
||||||
|
|
||||||
if dry_run
|
if dry_run
|
||||||
print_dry_run_dependencies(formula, formula_installer.compute_dependencies)
|
Install.print_dry_run_dependencies(formula, formula_installer.compute_dependencies) do |f|
|
||||||
|
name = f.full_specified_name
|
||||||
|
if f.optlinked?
|
||||||
|
"#{name} #{Keg.new(f.opt_prefix).version} -> #{f.pkg_version}"
|
||||||
|
else
|
||||||
|
"#{name} #{f.pkg_version}"
|
||||||
|
end
|
||||||
|
end
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user