Class: EY::DeployHook
- Defined in:
- lib/engineyard-serverside/deploy_hook.rb
Defined Under Namespace
Classes: CallbackContext
Constant Summary
Constants included from Dataflow
Dataflow::UnificationError, Dataflow::VERSION
Instance Attribute Summary
Attributes inherited from Task
Instance Method Summary collapse
- #callback_context ⇒ Object
-
#initialize(options) ⇒ DeployHook
constructor
A new instance of DeployHook.
- #run(hook) ⇒ Object
- #syntax_error(file) ⇒ Object
Methods inherited from Task
#require_custom_tasks, #roles, #sudo
Methods included from Dataflow
#barrier, #by_need, #flow, included, #local, #need_later, #unify
Constructor Details
#initialize(options) ⇒ DeployHook
Returns a new instance of DeployHook.
3 4 5 |
# File 'lib/engineyard-serverside/deploy_hook.rb', line 3 def initialize() super(EY::Deploy::Configuration.new()) end |
Instance Method Details
#callback_context ⇒ Object
7 8 9 |
# File 'lib/engineyard-serverside/deploy_hook.rb', line 7 def callback_context @context ||= CallbackContext.new(config) end |
#run(hook) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/engineyard-serverside/deploy_hook.rb', line 11 def run(hook) hook_path = "#{c.release_path}/deploy/#{hook}.rb" if File.exist?(hook_path) Dir.chdir(c.release_path) do puts "~> running deploy hook: deploy/#{hook}.rb" if desc = syntax_error(hook_path) hook_name = File.basename(hook_path) abort "*** [Error] Invalid Ruby syntax in hook: #{hook_name} ***\n*** #{desc.chomp} ***" else callback_context.instance_eval(IO.read(hook_path)) end end end end |