Class: BrewCaskTools::Tasks::Upgrade
- Defined in:
- lib/bct/tasks/upgrade.rb
Overview
Upgrade task
Instance Method Summary collapse
-
#compile ⇒ Array
Get list of casks to upgrade.
-
#initialize(casks) ⇒ Upgrade
constructor
A new instance of Upgrade.
-
#upgrade ⇒ Object
Upgrade casks.
Methods inherited from Caskroom
Constructor Details
#initialize(casks) ⇒ Upgrade
Returns a new instance of Upgrade.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/bct/tasks/upgrade.rb', line 11 def initialize(casks) super() @upgrade = [] if casks.empty? .total = caskroom.casks.length .log "\nLooking for outdated casks..." @upgrade = compile else @upgrade = casks.map { |c| caskroom.get(c) } return say 'Invalid cask(s) specified', :red if @upgrade.compact.empty? end upgrade end |
Instance Method Details
#compile ⇒ Array
Get list of casks to upgrade
31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/bct/tasks/upgrade.rb', line 31 def compile upgrade = [] caskroom.enumerate do |cask| increment(cask) next unless cask.outdated? upgrade << cask .log "#{cask.info.name}: " \ "#{cask.current} ==> #{cask.candidate}" end upgrade end |