Class: Shuttle::Hook

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

Instance Method Summary collapse

Constructor Details

#initialize(deploy) ⇒ Hook

Returns a new instance of Hook.



3
4
5
# File 'lib/shuttle/hook.rb', line 3

def initialize(deploy)
  @deploy = deploy
end

Instance Method Details

#run(commands, allow_failures = false) ⇒ Object



7
8
9
10
11
12
13
14
15
# File 'lib/shuttle/hook.rb', line 7

def run(commands, allow_failures = false)
  [commands].flatten.compact.uniq.each do |cmd|
    if cmd =~ /^task=\s?([A-Za-z\d\_]+)\s?/
      Shuttle::Task.new(@deploy, $1.strip, allow_failures).run
    else
      execute(cmd, allow_failures)
    end
  end
end