7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
# File 'lib/chinook/capistrano/campfire.rb', line 7
def self.load_into(configuration)
configuration.load do
namespace :chinook do
desc 'Lets a Campfire room know about a deploy that has begun.'
task :campfire_start, except: { no_release: true } do
unless exists?(:campfire_room_name) && exists?(:campfire_token) && exists?(:campfire_account_name)
logger.info 'Cannot notify Campfire without :campfire_room_name, :campfire_token, and :campfire_account_name. Skipping task.'
next
end
project_name = fetch(:project_name, application)
git_username = `git config user.name`.chomp
message = "#{git_username} started a deploy of #{project_name} to #{stage} at #{Time.now.strftime('%r %Z')}."
room_name = fetch(:campfire_room_name)
token = fetch(:campfire_token)
account_name = fetch(:campfire_account_name)
campfire = Tinder::Campfire.new(account_name, token: token)
room = campfire.find_room_by_name(room_name)
room.speak(message)
end
desc 'Lets a Campfire room know about a deploy that is rolling back.'
task :campfire_rollback, except: { no_release: true } do
unless exists?(:campfire_room_name) && exists?(:campfire_token) && exists?(:campfire_account_name)
logger.info 'Cannot notify Campfire without :campfire_room_name, :campfire_token, and :campfire_account_name. Skipping task.'
next
end
project_name = fetch(:project_name, application)
git_username = `git config user.name`.chomp
message = "#{git_username}'s deploy of #{project_name} to #{stage} has been rolled back at #{Time.now.strftime('%r %Z')}."
room_name = fetch(:campfire_room_name)
token = fetch(:campfire_token)
account_name = fetch(:campfire_account_name)
campfire = Tinder::Campfire.new(account_name, token: token)
room = campfire.find_room_by_name(room_name)
room.speak(message)
end
desc 'Lets a Campfire room know about a deploy that has finished.'
task :campfire_end, except: { no_release: true } do
unless exists?(:campfire_room_name) && exists?(:campfire_token) && exists?(:campfire_account_name)
logger.info 'Cannot notify Campfire without :campfire_room_name, :campfire_token, and :campfire_account_name. Skipping task.'
next
end
project_name = fetch(:project_name, application)
git_username = `git config user.name`.chomp
message = "#{git_username}'s deploy of #{project_name} to #{stage} finished at #{Time.now.strftime('%r %Z')}."
room_name = fetch(:campfire_room_name)
token = fetch(:campfire_token)
account_name = fetch(:campfire_account_name)
campfire = Tinder::Campfire.new(account_name, token: token)
room = campfire.find_room_by_name(room_name)
room.speak(message)
end
end
end
end
|