Class: Resource::Package
Instance Method Summary collapse
-
#initialize(package_name, &block) ⇒ Package
constructor
A new instance of Package.
- #run ⇒ Object
- #value_for_platform(*args) ⇒ Object
Methods inherited from Base
inherited, #not_if, #set_base_defaults, #should_skip?, #unix_mode
Methods included from ClassAttr
Methods included from BlockAttr
Constructor Details
#initialize(package_name, &block) ⇒ Package
Returns a new instance of Package.
7 8 9 10 11 |
# File 'lib/resource/package.rb', line 7 def initialize package_name, &block set_base_defaults @package_name = package_name self.instance_eval(&block) end |
Instance Method Details
#run ⇒ Object
13 14 15 16 17 18 |
# File 'lib/resource/package.rb', line 13 def run Execution.block 'Installing Package', @package_name, @owner do |b| b.always_run @always_run b.run "apt-get install -y #{@package_name}" end end |
#value_for_platform(*args) ⇒ Object
20 21 22 |
# File 'lib/resource/package.rb', line 20 def value_for_platform *args @package_name end |