Module: Chronos::Integrations::Capistrano
- Defined in:
- lib/chronos/integrations/capistrano.rb
Overview
Optional Capistrano task installer using only the public task DSL.
Constant Summary collapse
- INSTALLED_KEY =
:@__chronos_capistrano_installed
Class Method Summary collapse
Class Method Details
.install(dsl) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/chronos/integrations/capistrano.rb', line 19 def install(dsl) return false if dsl.instance_variable_get(INSTALLED_KEY) return false unless compatible?(dsl) dsl.send(:namespace, :chronos) do dsl.send(:desc, "Notify Chronos about the published deployment") if dsl.respond_to?(:desc, true) dsl.send(:task, :notify_deploy) { notify(dsl) } end dsl.send(:after, "deploy:published", "chronos:notify_deploy") dsl.instance_variable_set(INSTALLED_KEY, true) true rescue StandardError false end |
.notify(dsl) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/chronos/integrations/capistrano.rb', line 34 def notify(dsl) Chronos.notify_deploy( :environment => value(dsl, :stage).to_s, :revision => value(dsl, :current_revision) || value(dsl, :branch), :version => value(dsl, :chronos_version) || value(dsl, :release_name), :repository => value(dsl, :repo_url), :actor => value(dsl, :chronos_actor), :deploy_id => value(dsl, :chronos_deploy_id), :service => value(dsl, :chronos_service), :region => value(dsl, :chronos_region), :instance => value(dsl, :chronos_instance) ) rescue StandardError false end |