Home

Awesome

Capistrano Calendar

Introduction

capistrano-calendar is extension for capistrano that allows your create different deployment notification in calendar service. Currently supported services:

Installation

gem install capistrano-calendar

Add to your Capfile

require 'capistrano/calendar/recipes'

How it works

This gem provides:

Capistrano recipe should be used in some :after hooks (e.g. after deploy). Recipe reads calendar configurations and run capistrano-calendar binary on some host specified in capistrano_runner option. So you need to install capistrano-calendar gem also on that calendar host. Also please ensure that you properly configured calendar_runner otherwise you may have duplicated events in calender.

Calendar configuration

Bold means required options. Value in brackets means default value.

Calendar runner configuration

Calendar event creation will be executed by default on the one of application servers (specified in :app roles) You can change this behavior via calendar_runner option. Examples:

set(:calendar_runner, { :roles => :calendar_notifier, :once => true })
# or
set(:calendar_runner, { :hosts => 'notification.example.com' })

Be sure to pass :once => true option if you use :roles !

Configuration example

set :calendar_service, :google
set :calendar_username, 'vasya.pupkin@my.company.com'
set :calendar_password, '123456'

set(:calendar_name)      { stage }
set(:calendar_summary)   { "" }
set :calendar_timezone, 'UTC'
set(:calendar_color),    { stage == 'production' ? '#ff000' : '#00ff00' }

set(:calendar_event_summary) { "Bla" }
set(:calendar_event_time) { Time.now }

after 'deploy' do
  set :calendar_event_name, "[Deployed] #{application} #{branch}: #{real_revision}"
  top.calendar.create_event
end

after 'deploy:rollback' do
  set :calendar_event_name, "[Rollback] #{application} #{branch}: #{real_revision}"
  top.calendar.create_event
end

#
# Extra configurations if you are using capistrano-patch:
#
after 'patch:apply' do
  set :calendar_event_name, "[Pathed] #{application} #{branch}: #{patch_strategy.revision_to}"
  calendar_client.create_event
end

after 'patch:revert' do
  set :calendar_event_name, "[Patch rollback] #{application} #{branch}: #{patch_strategy.revision_from}"
  top.calendar.create_event
end