class HomebrewCask

Constants

CASKROOM

Public Instance Methods

clean() click to toggle source
# File lib/exogenesis/passengers/homebrew_cask.rb, line 15
def clean
  execute 'Clean Up', 'brew cask cleanup'
end
down() click to toggle source
# File lib/exogenesis/passengers/homebrew_cask.rb, line 19
def down
  uninstall_installed_casks
  untap_cask
end
up() click to toggle source
# File lib/exogenesis/passengers/homebrew_cask.rb, line 10
def up
  tap_cask
  install_missing_casks
end

Private Instance Methods

cask_tapped?() click to toggle source
# File lib/exogenesis/passengers/homebrew_cask.rb, line 59
def cask_tapped?
  installed_taps.include?(CASKROOM)
end
install_missing_casks() click to toggle source
# File lib/exogenesis/passengers/homebrew_cask.rb, line 26
def install_missing_casks
  (casks || []).each do |cask|
    next if installed_casks.include?(cask)
    install_package cask
  end
end
install_package(name) click to toggle source
# File lib/exogenesis/passengers/homebrew_cask.rb, line 39
def install_package(name)
  execute "Installing #{name}", "brew cask install #{name}"
end
installed_casks() click to toggle source
# File lib/exogenesis/passengers/homebrew_cask.rb, line 63
def installed_casks
  @installed_casks ||= silent_execute('brew cask list').split(/\s/)
end
installed_taps() click to toggle source
# File lib/exogenesis/passengers/homebrew_cask.rb, line 67
def installed_taps
  @installed_taps ||= silent_execute('brew tap').split(/\n/)
end
tap_cask() click to toggle source
# File lib/exogenesis/passengers/homebrew_cask.rb, line 47
def tap_cask
  if cask_tapped?
    skip_task 'Tap Cask'
  else
    execute_interactive 'Tap Cask', "brew tap #{CASKROOM}"
  end
end
uninstall_installed_casks() click to toggle source
# File lib/exogenesis/passengers/homebrew_cask.rb, line 33
def uninstall_installed_casks
  installed_casks.each do |cask|
    uninstall_package cask
  end
end
uninstall_package(name) click to toggle source
# File lib/exogenesis/passengers/homebrew_cask.rb, line 43
def uninstall_package(name)
  execute "Uninstalling #{name}", "brew cask uninstall #{name}"
end
untap_cask() click to toggle source
# File lib/exogenesis/passengers/homebrew_cask.rb, line 55
def untap_cask
  execute 'Untap Cask', "brew untap #{CASKROOM}"
end