Module: AmoebaDeployTools::Concerns::Hooks

Included in:
AmoebaDeployTools::Command
Defined in:
lib/amoeba_deploy_tools/commands/concerns/hooks.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



4
5
6
# File 'lib/amoeba_deploy_tools/commands/concerns/hooks.rb', line 4

def self.included(base)
  base.extend(ClassMethods)
end

Instance Method Details

#invoke_command(command, *args) ⇒ Object

Instance methods



31
32
33
34
35
36
37
38
39
40
41
# File 'lib/amoeba_deploy_tools/commands/concerns/hooks.rb', line 31

def invoke_command(command, *args)
  # Ignore hooks on help commands
  if command.name == 'help'
    return super
  end

  self.class.before_hooks.each {|h| instance_eval &h }
  retVal = super
  self.class.after_hooks.each {|h| instance_eval &h }
  return retVal
end