Class: RunitServiceBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/cap-runit.rb

Instance Method Summary collapse

Constructor Details

#initialize(&block) ⇒ RunitServiceBuilder

Returns a new instance of RunitServiceBuilder.



7
8
9
10
11
12
13
14
15
# File 'lib/cap-runit.rb', line 7

def initialize(&block)
  instance_eval(&block)
  unless @roles
    raise ArgumentError, "No role configured for runit service"
  end
  unless @run
    raise ArgumentError, "No run script configured for runit service"
  end
end

Instance Method Details

#finish(str = nil) ⇒ Object



32
33
34
35
# File 'lib/cap-runit.rb', line 32

def finish(str=nil)
  @finish = str unless str.nil?
  @finish
end

#log(str = nil) ⇒ Object



27
28
29
30
# File 'lib/cap-runit.rb', line 27

def log(str=nil)
  @log = str unless str.nil?
  @log
end

#roles(*roles) ⇒ Object



17
18
19
20
# File 'lib/cap-runit.rb', line 17

def roles(*roles)
  @roles = roles unless roles == []
  @roles
end

#run(str = nil) ⇒ Object



22
23
24
25
# File 'lib/cap-runit.rb', line 22

def run(str=nil)
  @run = str unless str.nil?
  @run
end