Class: BrewCaskTools::Tasks::Outdated
- Defined in:
- lib/bct/tasks/outdated.rb
Overview
Outdated cask task
Instance Method Summary collapse
- #compile ⇒ Object
- #deprecated ⇒ Object
-
#initialize ⇒ Outdated
constructor
A new instance of Outdated.
- #outdated ⇒ Object
Methods inherited from Caskroom
#caskroom, #format, #handle, #increment, #progressbar
Constructor Details
#initialize ⇒ Outdated
Returns a new instance of Outdated.
7 8 9 10 11 12 13 14 15 |
# File 'lib/bct/tasks/outdated.rb', line 7 def initialize super .total = caskroom.casks.length .log "\nLooking for outdated casks..." @outdated, @deprecated = compile outdated deprecated end |
Instance Method Details
#compile ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/bct/tasks/outdated.rb', line 17 def compile outdated = [] deprecated = [] caskroom.enumerate do |cask| increment(cask) outdated << cask if cask.outdated? deprecated << cask if cask.deprecated? end [outdated, deprecated] end |
#deprecated ⇒ Object
41 42 43 44 45 46 47 48 49 |
# File 'lib/bct/tasks/outdated.rb', line 41 def deprecated return if @deprecated.empty? @deprecated.map! { |cask| [cask.name] } handle(@deprecated, 'deprecated') do |deprecated| format(['Package'], deprecated) end end |
#outdated ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/bct/tasks/outdated.rb', line 29 def outdated return say "\nThere are no outdated casks", :yellow if @outdated.empty? @outdated.map! do |cask| [cask.name, cask.current, cask.candidate] end handle(@outdated, 'outdated') do |outdated| format(['Package', 'Installed Version', 'New Version'], outdated) end end |