module Hbc

Public Class Methods

each_installed() { |{ :name => name, :latest => version.to_s, :installed => installed_versions(name) }, i| ... } click to toggle source
# File lib/extend/hbc.rb, line 23
def self.each_installed
  Hbc.installed.each_with_index do |name, i|
    cask = Hbc.load name.to_s
    yield({
      :name => name.to_s,
      :latest => cask.version.to_s,
      :installed => installed_versions(name)
    }, i)
  end
end
installed_versions(name) click to toggle source

Retrieves currently installed versions on the machine.

# File lib/extend/hbc.rb, line 35
def self.installed_versions(name)
  Dir["#{CASKROOM}/#{name}/*"].map { |e| File.basename e }
end
outdated() click to toggle source
# File lib/extend/hbc.rb, line 9
def self.outdated
  outdated = []
  each_installed do |app, i|
    print "(#{i+1}/#{Hbc.installed.length}) #{app[:name]}: "
    if app[:installed].include? app[:latest]
      puts "up to date"
    else
      puts "#{app[:installed].join(', ')} -> #{app[:latest]}"
      outdated.push app
    end
  end
  outdated
end