Class: Itamae::Plugin::Resource::Cask

Inherits:
Resource::Base
  • Object
show all
Defined in:
lib/itamae/plugin/resource/cask.rb

Instance Method Summary collapse

Instance Method Details

#action_alfred(options) ⇒ Object



25
26
27
# File 'lib/itamae/plugin/resource/cask.rb', line 25

def action_alfred(options)
  run_command(["brew", "cask", "alfred", *Array(attributes.options), attributes.target])
end

#action_install(options) ⇒ Object



19
20
21
22
23
# File 'lib/itamae/plugin/resource/cask.rb', line 19

def action_install(options)
  unless current.exist
    run_command(["brew", "cask", "install", *Array(attributes.options), attributes.target])
  end
end

#set_current_attributesObject



11
12
13
14
15
16
17
# File 'lib/itamae/plugin/resource/cask.rb', line 11

def set_current_attributes
  super
  ensure_brew_cask_availability

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