Class: Hookit::Resource::Package

Inherits:
Base
  • Object
show all
Defined in:
lib/hookit/resource/package.rb

Instance Attribute Summary

Attributes inherited from Base

#dict

Instance Method Summary collapse

Methods inherited from Base

#action, actions, #can_run?, default_action, #default_action, field, #not_if, #only_if

Constructor Details

#initialize(name) ⇒ Package

Returns a new instance of Package.



13
14
15
16
17
# File 'lib/hookit/resource/package.rb', line 13

def initialize(name)
  package_name(name) unless source
  scope :default unless scope
  super
end

Instance Method Details

#install!Object



28
29
30
# File 'lib/hookit/resource/package.rb', line 28

def install!
  run_command! "#{pkgin} -y in #{package}"
end

#run(action) ⇒ Object



19
20
21
22
23
24
25
26
# File 'lib/hookit/resource/package.rb', line 19

def run(action)
  case action
  when :install
    install!
  when :update
    update!
  end
end

#update!Object



32
33
34
# File 'lib/hookit/resource/package.rb', line 32

def update!
  run_command! `#{pkgin} -y up`
end