Class: CapistranoDeploybot::Capistrano
- Inherits:
-
Object
- Object
- CapistranoDeploybot::Capistrano
- Defined in:
- lib/capistrano-deploybot/capistrano.rb
Constant Summary collapse
- DEFAULT_OPTIONS =
{ username: :autodeploy, jira_url: nil, environments: { staging: { slack_webhooks: [], jira_webhooks: [] } } }
- JIRA_TICKET_ID_REGEXP =
/([A-Z]{2,}-\d+)/
Instance Method Summary collapse
-
#initialize(env) ⇒ Capistrano
constructor
A new instance of Capistrano.
- #run ⇒ Object
Constructor Details
#initialize(env) ⇒ Capistrano
Returns a new instance of Capistrano.
21 22 23 24 |
# File 'lib/capistrano-deploybot/capistrano.rb', line 21 def initialize(env) @env = env @opts = DEFAULT_OPTIONS.merge(fetch(:deploybot, {})) end |
Instance Method Details
#run ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/capistrano-deploybot/capistrano.rb', line 26 def run current_revision = fetch(:current_revision) previous_revision = fetch(:previous_revision) rails_env = fetch(:rails_env).to_sym return if !@opts[:environments].keys.include?(rails_env) || current_revision == previous_revision @opts[:environments].fetch(rails_env).fetch(:slack_webhooks).tap do |slack_webhooks| notify_slack(slack_webhooks, current_revision, previous_revision) end @opts[:environments].fetch(rails_env).fetch(:jira_webhooks).tap do |jira_webhooks| notify_jira(jira_webhooks, current_revision, previous_revision) end end |