class Itamae::Resource::Package

Public Instance Methods

action_install(action_options) click to toggle source
# File lib/itamae/resource/package.rb, line 28
def action_install(action_options)
  unless run_specinfra(:check_package_is_installed, attributes.name, attributes.version)
    run_specinfra(:install_package, attributes.name, attributes.version, attributes.options)
    updated!
  end
end
action_remove(action_options) click to toggle source
# File lib/itamae/resource/package.rb, line 35
def action_remove(action_options)
  if run_specinfra(:check_package_is_installed, attributes.name, nil)
    run_specinfra(:remove_package, attributes.name, attributes.options)
    updated!
  end
end
pre_action() click to toggle source
# File lib/itamae/resource/package.rb, line 11
def pre_action
  case @current_action
  when :install
    attributes.installed = true
  when :remove
    attributes.installed = false
  end
end
set_current_attributes() click to toggle source
# File lib/itamae/resource/package.rb, line 20
def set_current_attributes
  current.installed = run_specinfra(:check_package_is_installed, attributes.name)

  if current.installed
    current.version = run_specinfra(:get_package_version, attributes.name).stdout.strip
  end
end