Class: Skewer::Hooks

Inherits:
Object
  • Object
show all
Defined in:
lib/hooks.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(host_name) ⇒ Hooks

Returns a new instance of Hooks.



7
8
9
10
# File 'lib/hooks.rb', line 7

def initialize(host_name)
  @command = SkewerConfig.instance.get('hook')
  @host_name = host_name
end

Instance Attribute Details

#command=(value) ⇒ Object (writeonly)

Sets the attribute command

Parameters:

  • value

    the value to set the attribute command to.



5
6
7
# File 'lib/hooks.rb', line 5

def command=(value)
  @command = value
end

Instance Method Details

#runObject



12
13
14
15
16
17
18
19
20
# File 'lib/hooks.rb', line 12

def run
  return_code = false
  unless @command.nil?
    Skewer.logger.debug "Running hooks ..."
    `#{@command}  #{@host_name}`
    return_code = $? == 0 ? true : false
  end
  return_code
end