Class: Resource::Service
Instance Method Summary collapse
-
#initialize(name, &block) ⇒ Service
constructor
A new instance of Service.
- #run ⇒ 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(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
#run ⇒ Object
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 |