class Itamae::Plugin::Resource::Cask

Public Instance Methods

action_alfred(options) click to toggle source
# File lib/itamae/plugin/resource/cask.rb, line 30
def action_alfred(options)
  run_command(["brew", "cask", "alfred", *Array(attributes.options), attributes.target])
end
action_install(options) click to toggle source
# File lib/itamae/plugin/resource/cask.rb, line 18
def action_install(options)
  unless current.exist
    run_command(["brew", "cask", "install", *Array(attributes.options), attributes.target])
  end
end
action_remove(options) click to toggle source
# File lib/itamae/plugin/resource/cask.rb, line 24
def action_remove(options)
  unless current.exist
    run_command(["brew", "cask", "uninstall", attributes.target])
  end
end
set_current_attributes() click to toggle source
Calls superclass method
# File lib/itamae/plugin/resource/cask.rb, line 11
def set_current_attributes
  super

  result = run_command("#{brew_cask_list} | grep '#{attributes.target}$'", error: false)
  current.exist = result.exit_status == 0
end

Private Instance Methods

brew_cask_list() click to toggle source

Optimized `brew cask list`

# File lib/itamae/plugin/resource/cask.rb, line 37
def brew_cask_list
  "ls -1 $(brew --prefix)/Caskroom"
end