Class: Resource::Service

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

Instance Method Summary collapse

Methods inherited from Base

inherited, #not_if, #set_base_defaults, #should_skip?, #unix_mode

Methods included from ClassAttr

included

Methods included from BlockAttr

included

Constructor Details

#initialize(name, &block) ⇒ Service

Returns a new instance of Service.



7
8
9
10
11
12
# File 'lib/resource/service.rb', line 7

def initialize name, &block
  set_base_defaults
  @name       = name
  @always_run = true
  self.instance_eval(&block)
end

Instance Method Details

#runObject



14
15
16
17
18
19
# File 'lib/resource/service.rb', line 14

def run
  Execution.block "Changing #{@name} service", @action, 'root' do |b|
    b.always_run @always_run
    b.run "/etc/init.d/#{@name} #{@action}"
  end
end