Class: EY::DeployHook::CallbackContext
- Inherits:
-
Object
- Object
- EY::DeployHook::CallbackContext
show all
- Defined in:
- lib/ey-deploy/deploy_hook.rb
Instance Method Summary
collapse
Constructor Details
Returns a new instance of CallbackContext.
32
33
34
35
|
# File 'lib/ey-deploy/deploy_hook.rb', line 32
def initialize(config)
@configuration = config
@node = node
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(meth, *args, &blk) ⇒ Object
37
38
39
40
41
42
43
|
# File 'lib/ey-deploy/deploy_hook.rb', line 37
def method_missing(meth, *args, &blk)
if @configuration.respond_to?(meth)
@configuration.send(meth, *args, &blk)
else
super
end
end
|
Instance Method Details
#on_app_master(&blk) ⇒ Object
convenience functions for running on certain instance types
58
|
# File 'lib/ey-deploy/deploy_hook.rb', line 58
def on_app_master(&blk) on_roles(%w[solo app_master], &blk) end
|
#on_app_servers(&blk) ⇒ Object
59
|
# File 'lib/ey-deploy/deploy_hook.rb', line 59
def on_app_servers(&blk) on_roles(%w[solo app_master app], &blk) end
|
#on_app_servers_and_utilities(&blk) ⇒ Object
63
|
# File 'lib/ey-deploy/deploy_hook.rb', line 63
def on_app_servers_and_utilities(&blk) on_roles(%w[solo app_master app util], &blk) end
|
#on_db_master(&blk) ⇒ Object
60
|
# File 'lib/ey-deploy/deploy_hook.rb', line 60
def on_db_master(&blk) on_roles(%w[solo db_master], &blk) end
|
#on_db_servers(&blk) ⇒ Object
62
|
# File 'lib/ey-deploy/deploy_hook.rb', line 62
def on_db_servers(&blk) on_roles(%w[solo db_master db_slave], &blk) end
|
#on_db_slaves(&blk) ⇒ Object
61
|
# File 'lib/ey-deploy/deploy_hook.rb', line 61
def on_db_slaves(&blk) on_roles(%w[db_slave], &blk) end
|
#on_utilities(*names, &blk) ⇒ Object
65
66
67
68
69
70
|
# File 'lib/ey-deploy/deploy_hook.rb', line 65
def on_utilities(*names, &blk)
names.flatten!
on_roles(%w[util]) do
blk.call if names.empty? || names.include?(current_name)
end
end
|
#respond_to?(meth, include_private = false) ⇒ Boolean
45
46
47
|
# File 'lib/ey-deploy/deploy_hook.rb', line 45
def respond_to?(meth, include_private=false)
@configuration.respond_to?(meth, include_private) || super
end
|
49
50
51
|
# File 'lib/ey-deploy/deploy_hook.rb', line 49
def run(cmd)
system(Escape.shell_command(["sh", "-l", "-c", cmd]))
end
|
#sudo(cmd) ⇒ Object
53
54
55
|
# File 'lib/ey-deploy/deploy_hook.rb', line 53
def sudo(cmd)
system(Escape.shell_command(["sudo", "sh", "-l", "-c", cmd]))
end
|