captainu-chinook 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/chinook.gemspec +1 -0
- data/lib/chinook/capistrano.rb +1 -1
- data/lib/chinook/capistrano/hipchat.rb +76 -0
- data/lib/chinook/version.rb +1 -1
- data/readme.markdown +18 -0
- metadata +17 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: af16d617dd313aa2fcaebf3d681a3eedd85d7c8b
|
4
|
+
data.tar.gz: a1fd9e740ba15b0c9cc77eb17a7b487b7fb7029f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 97f3f05c93d52189b0f1ee444fe029d34434bc34708bcd27f3bf90a30d462bf24e2876a75825d9a2048388840a7dedbb2c131d127d40e359037f9c5bf2b3a95f
|
7
|
+
data.tar.gz: f4ce5af91c403a284fcecae4c17da595857428340d213bde33521f611d395405e3c0a5518578abf0936c88be435263670112bb23b66f0d0ade6de8b0b83c6e93
|
data/chinook.gemspec
CHANGED
@@ -20,6 +20,7 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.add_runtime_dependency 'capistrano', '~> 2.15.5'
|
21
21
|
spec.add_runtime_dependency 'tinder', '~> 1.9.4'
|
22
22
|
spec.add_runtime_dependency 'slack-notifier', '~> 0.4.1'
|
23
|
+
spec.add_runtime_dependency 'hipchat', '~> 1.1.0'
|
23
24
|
|
24
25
|
spec.add_development_dependency 'bundler', '~> 1.5'
|
25
26
|
spec.add_development_dependency 'rake'
|
data/lib/chinook/capistrano.rb
CHANGED
@@ -0,0 +1,76 @@
|
|
1
|
+
# Defines a task that will let a HipChat channel know about a deploy.
|
2
|
+
require 'capistrano'
|
3
|
+
require 'hipchat'
|
4
|
+
|
5
|
+
module Chinook::Capistrano
|
6
|
+
module HipChat
|
7
|
+
def self.load_into(configuration)
|
8
|
+
configuration.load do
|
9
|
+
namespace :chinook do
|
10
|
+
desc 'Lets a HipChat room know about a deploy that has begun.'
|
11
|
+
task :hipchat_start, except: { no_release: true } do
|
12
|
+
unless exists?(:hipchat_room) && exists?(:hipchat_token)
|
13
|
+
logger.info 'Cannot notify HipChat without :hipchat_room and :hipchat_token. Skipping task.'
|
14
|
+
next
|
15
|
+
end
|
16
|
+
|
17
|
+
project_name = fetch(:project_name, application)
|
18
|
+
git_username = `git config user.name`.chomp
|
19
|
+
|
20
|
+
message = "#{git_username} started a deploy of #{project_name} to #{stage} at #{Time.now.strftime('%r %Z')}."
|
21
|
+
|
22
|
+
hipchat = ::HipChat::Client.new(fetch(:hipchat_token),
|
23
|
+
api_version: 'v2')
|
24
|
+
room = fetch(:hipchat_room)
|
25
|
+
username = fetch(:hipchat_username, 'Deployment')
|
26
|
+
hipchat[room].send(username, message, color: 'yellow')
|
27
|
+
end
|
28
|
+
|
29
|
+
desc 'Lets a HipChat channel know about a deploy that is rolling back.'
|
30
|
+
task :hipchat_rollback, except: { no_release: true } do
|
31
|
+
unless exists?(:hipchat_room) && exists?(:hipchat_token)
|
32
|
+
logger.info 'Cannot notify HipChat without :hipchat_room and :hipchat_token. Skipping task.'
|
33
|
+
next
|
34
|
+
end
|
35
|
+
|
36
|
+
project_name = fetch(:project_name, application)
|
37
|
+
git_username = `git config user.name`.chomp
|
38
|
+
|
39
|
+
message = "#{git_username}'s deploy of #{project_name} to #{stage} has been rolled back at #{Time.now.strftime('%r %Z')}."
|
40
|
+
message = ":shipit: #{message}" if fetch(:hipchat_shipit)
|
41
|
+
|
42
|
+
hipchat = ::HipChat::Client.new(fetch(:hipchat_token),
|
43
|
+
api_version: 'v2')
|
44
|
+
room = fetch(:hipchat_room)
|
45
|
+
username = fetch(:hipchat_username, 'Deployment')
|
46
|
+
hipchat[room].send(username, message, color: 'red')
|
47
|
+
end
|
48
|
+
|
49
|
+
desc 'Lets a HipChat channel know about a deploy that has finished.'
|
50
|
+
task :hipchat_end, except: { no_release: true } do
|
51
|
+
unless exists?(:hipchat_room) && exists?(:hipchat_token)
|
52
|
+
logger.info 'Cannot notify HipChat without :hipchat_room and :hipchat_token. Skipping task.'
|
53
|
+
next
|
54
|
+
end
|
55
|
+
|
56
|
+
project_name = fetch(:project_name, application)
|
57
|
+
git_username = `git config user.name`.chomp
|
58
|
+
|
59
|
+
message = "#{git_username}'s deploy of #{project_name} to #{stage} finished at #{Time.now.strftime('%r %Z')}."
|
60
|
+
message = ":shipit: #{message}" if fetch(:hipchat_shipit)
|
61
|
+
|
62
|
+
hipchat = ::HipChat::Client.new(fetch(:hipchat_token),
|
63
|
+
api_version: 'v2')
|
64
|
+
room = fetch(:hipchat_room)
|
65
|
+
username = fetch(:hipchat_username, 'Deployment')
|
66
|
+
hipchat[room].send(username, message, color: 'green')
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
if Capistrano::Configuration.instance
|
75
|
+
Chinook::Capistrano::HipChat.load_into(Capistrano::Configuration.instance)
|
76
|
+
end
|
data/lib/chinook/version.rb
CHANGED
data/readme.markdown
CHANGED
@@ -56,6 +56,24 @@ Notifies [Campfire](https://campfirenow.com) when a deploy starts and/or stops.
|
|
56
56
|
- `:campfire_account_name`: the subdomain of your Campfire account (**this-part**.campfirenow.com).
|
57
57
|
- `:project_name`: the name of your project as it will show up in the notifications. *Optional; if not supplied, the value of `:application` will be used.*
|
58
58
|
|
59
|
+
### HipChat notification
|
60
|
+
|
61
|
+
Notifies [HipChat](https://hipchat.com) when a deploy starts and/or stops. Uses the value of `git config user.name` for identifying the deploying user.
|
62
|
+
|
63
|
+
* Tasks:
|
64
|
+
- `chinook:hipchat_start`
|
65
|
+
- `chinook:hipchat_fail`
|
66
|
+
- `chinook:hipchat_end`
|
67
|
+
* Hooks:
|
68
|
+
- `before 'deploy', 'chinook:hipchat_start'`
|
69
|
+
- `after 'deploy:rollback', 'chinook:hipchat_rollback'`
|
70
|
+
- `after 'deploy', 'chinook:hipchat_end'`
|
71
|
+
* Settings:
|
72
|
+
- `:hipchat_room`: the room where notifications will be posted.
|
73
|
+
- `:hipchat_token`: the API token of the user that this task will post as.
|
74
|
+
- `:hipchat_username`: the username that will display as the poster of this notification; default is "Deployment."
|
75
|
+
- `:project_name`: the name of your project as it will show up in the notifications. *Optional; if not supplied, the value of `:application` will be used.*
|
76
|
+
|
59
77
|
### Passenger restart
|
60
78
|
|
61
79
|
Restarts [Passenger](https://phusionpassenger.com) after deploy by touching the file at `tmp/restart.txt` on the receiving server.
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: captainu-chinook
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Kreeger
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-05-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: capistrano
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: 0.4.1
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: hipchat
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 1.1.0
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 1.1.0
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: bundler
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -94,6 +108,7 @@ files:
|
|
94
108
|
- lib/chinook.rb
|
95
109
|
- lib/chinook/capistrano.rb
|
96
110
|
- lib/chinook/capistrano/campfire.rb
|
111
|
+
- lib/chinook/capistrano/hipchat.rb
|
97
112
|
- lib/chinook/capistrano/passenger.rb
|
98
113
|
- lib/chinook/capistrano/ping.rb
|
99
114
|
- lib/chinook/capistrano/slack.rb
|