Class: EY::Serverside::DeployHook::CallbackContext
- Inherits:
-
Object
- Object
- EY::Serverside::DeployHook::CallbackContext
show all
- Defined in:
- lib/engineyard-serverside/deploy_hook.rb
Instance Method Summary
collapse
Constructor Details
Returns a new instance of CallbackContext.
33
34
35
36
|
# File 'lib/engineyard-serverside/deploy_hook.rb', line 33
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
38
39
40
41
42
43
44
|
# File 'lib/engineyard-serverside/deploy_hook.rb', line 38
def method_missing(meth, *args, &blk)
if @configuration.respond_to?(meth)
@configuration.send(meth, *args, &blk)
else
super
end
end
|
Instance Method Details
#debug(*args) ⇒ Object
62
63
64
|
# File 'lib/engineyard-serverside/deploy_hook.rb', line 62
def debug(*args)
$stdout.puts *args
end
|
#info(*args) ⇒ Object
58
59
60
|
# File 'lib/engineyard-serverside/deploy_hook.rb', line 58
def info(*args)
$stderr.puts *args
end
|
#on_app_master(&blk) ⇒ Object
convenience functions for running on certain instance types
67
|
# File 'lib/engineyard-serverside/deploy_hook.rb', line 67
def on_app_master(&blk) on_roles(%w[solo app_master], &blk) end
|
#on_app_servers(&blk) ⇒ Object
68
|
# File 'lib/engineyard-serverside/deploy_hook.rb', line 68
def on_app_servers(&blk) on_roles(%w[solo app_master app], &blk) end
|
#on_app_servers_and_utilities(&blk) ⇒ Object
69
|
# File 'lib/engineyard-serverside/deploy_hook.rb', line 69
def on_app_servers_and_utilities(&blk) on_roles(%w[solo app_master app util], &blk) end
|
#on_utilities(*names, &blk) ⇒ Object
71
72
73
74
75
76
|
# File 'lib/engineyard-serverside/deploy_hook.rb', line 71
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
46
47
48
|
# File 'lib/engineyard-serverside/deploy_hook.rb', line 46
def respond_to?(meth, include_private=false)
@configuration.respond_to?(meth, include_private) || super
end
|
50
51
52
|
# File 'lib/engineyard-serverside/deploy_hook.rb', line 50
def run(cmd)
system(Escape.shell_command(["sh", "-l", "-c", cmd]))
end
|
#sudo(cmd) ⇒ Object
54
55
56
|
# File 'lib/engineyard-serverside/deploy_hook.rb', line 54
def sudo(cmd)
system(Escape.shell_command(["sudo", "sh", "-l", "-c", cmd]))
end
|