Class: CfDeployer::Hook
- Inherits:
-
Object
- Object
- CfDeployer::Hook
- Defined in:
- lib/cf_deployer/hook.rb
Instance Method Summary collapse
-
#initialize(name, body) ⇒ Hook
constructor
A new instance of Hook.
- #run(context) ⇒ Object
Constructor Details
#initialize(name, body) ⇒ Hook
Returns a new instance of Hook.
3 4 5 6 |
# File 'lib/cf_deployer/hook.rb', line 3 def initialize(name, body) @name = name @body = body end |
Instance Method Details
#run(context) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/cf_deployer/hook.rb', line 8 def run(context) case @body when Hash if @body[:file] file = File.(@body[:file], context[:config_dir]) execute(File.read(file), context, @body[:timeout]) else execute(@body[:code], context, @body[:timeout]) end when String execute(@body, context) end end |