outdated: Fix most code review comments
This commit is contained in:
parent
fa0f6f4d5b
commit
8d4a443e4d
@ -46,7 +46,7 @@ module Homebrew
|
|||||||
|
|
||||||
case json_version
|
case json_version
|
||||||
when :v1
|
when :v1
|
||||||
opoo "JSON v1 has been deprecated; please use --json=v2"
|
odeprecated "brew outdated --json=v1", "brew outdated --json=v2"
|
||||||
|
|
||||||
outdated = if args.formula? || !args.cask?
|
outdated = if args.formula? || !args.cask?
|
||||||
outdated_formulae
|
outdated_formulae
|
||||||
@ -87,9 +87,8 @@ module Homebrew
|
|||||||
Homebrew.failed = args.named.present? && outdated.present?
|
Homebrew.failed = args.named.present? && outdated.present?
|
||||||
end
|
end
|
||||||
|
|
||||||
def print_outdated(formula_or_cask)
|
def print_outdated(formulae_or_casks)
|
||||||
return formula_or_cask.each { |f_or_c| print_outdated(f_or_c) } if formula_or_cask.is_a? Array
|
formulae_or_casks.each do |formula_or_cask|
|
||||||
|
|
||||||
if formula_or_cask.is_a?(Formula)
|
if formula_or_cask.is_a?(Formula)
|
||||||
f = formula_or_cask
|
f = formula_or_cask
|
||||||
|
|
||||||
@ -125,10 +124,10 @@ module Homebrew
|
|||||||
puts c.outdated_info(args.greedy?, verbose?, false)
|
puts c.outdated_info(args.greedy?, verbose?, false)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def json_info(formula_or_cask)
|
def json_info(formulae_or_casks)
|
||||||
return formula_or_cask.map { |f_or_c| json_info(f_or_c) } if formula_or_cask.is_a? Array
|
formulae_or_casks.map do |formula_or_cask|
|
||||||
|
|
||||||
if formula_or_cask.is_a?(Formula)
|
if formula_or_cask.is_a?(Formula)
|
||||||
f = formula_or_cask
|
f = formula_or_cask
|
||||||
|
|
||||||
@ -150,6 +149,7 @@ module Homebrew
|
|||||||
c.outdated_info(args.greedy?, verbose?, true)
|
c.outdated_info(args.greedy?, verbose?, true)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def verbose?
|
def verbose?
|
||||||
($stdout.tty? || args.verbose?) && !args.quiet?
|
($stdout.tty? || args.verbose?) && !args.quiet?
|
||||||
@ -173,9 +173,11 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
|
|
||||||
def outdated_casks
|
def outdated_casks
|
||||||
select_outdated(
|
if args.named.present?
|
||||||
args.named.present? ? args.named.uniq.map { |ref| Cask::CaskLoader.load ref } : Cask::Caskroom.casks,
|
select_outdated(args.named.uniq.map(&Cask::CaskLoader.method(:load)))
|
||||||
)
|
else
|
||||||
|
select_outdated(Cask::Caskroom.casks)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def outdated_formulae_casks
|
def outdated_formulae_casks
|
||||||
@ -190,8 +192,12 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
|
|
||||||
def select_outdated(formulae_or_casks)
|
def select_outdated(formulae_or_casks)
|
||||||
formulae_or_casks.select do |fc|
|
formulae_or_casks.select do |formula_or_cask|
|
||||||
fc.is_a?(Formula) ? fc.outdated?(fetch_head: args.fetch_HEAD?) : fc.outdated?(args.greedy?)
|
if formula_or_cask.is_a?(Formula)
|
||||||
|
formula_or_cask.outdated?(fetch_head: args.fetch_HEAD?)
|
||||||
|
else
|
||||||
|
formula_or_cask.outdated?(args.greedy?)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user