capistrano-grove 1.0.1 → 2.0.0pre
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +6 -0
- data/CHANGELOG +7 -0
- data/Gemfile +0 -1
- data/README.md +58 -32
- data/capistrano-grove.gemspec +4 -1
- data/lib/capistrano-grove/client.rb +16 -0
- data/lib/capistrano-grove/version.rb +1 -1
- data/lib/capistrano-grove.rb +47 -7
- data/spec/capistrano-grove/client_spec.rb +0 -0
- data/spec/capistrano-grove_spec.rb +81 -0
- data/spec/spec_helper.rb +1 -3
- metadata +87 -69
- data/lib/grove/capistrano.rb +0 -43
- data/spec/grove/capistrano_spec.rb +0 -73
data/.travis.yml
ADDED
data/CHANGELOG
CHANGED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,78 +1,104 @@
|
|
1
|
-
# Capistrano grove.
|
1
|
+
# Capistrano::Grove [![Build Status](https://travis-ci.org/spikegrobstein/capistrano-grove.png)](https://travis-ci.org/spikegrobstein/capistrano-grove)
|
2
2
|
|
3
|
-
|
3
|
+
Note: This documentation is for the as yet to be released version 2.0.0 of Capistrano::Grove.
|
4
|
+
I expect this to be ready for release in the next few days.
|
4
5
|
|
5
|
-
|
6
|
+
Send deployment notifications to your [grove.io](http://grove.io) channel via Capistrano.
|
7
|
+
Never again will members of your team not be made aware of events during your deployment.
|
8
|
+
Alert them to maintenance page changes, migrations and deployment events by using this gem.
|
9
|
+
|
10
|
+
## Installation
|
6
11
|
|
7
|
-
|
12
|
+
Add this line to your application's Gemfile:
|
8
13
|
|
9
14
|
gem 'capistrano-grove'
|
10
15
|
|
16
|
+
And then execute:
|
17
|
+
|
18
|
+
$ bundle
|
19
|
+
|
20
|
+
Or install it yourself as:
|
21
|
+
|
22
|
+
$ gem install capistrano-grove
|
23
|
+
|
24
|
+
In your `Capfile`, add:
|
11
25
|
|
12
|
-
|
13
|
-
`capistrano-grove`.
|
26
|
+
require 'capistrano-grove'
|
14
27
|
|
15
|
-
|
28
|
+
## Getting started
|
29
|
+
|
30
|
+
Capistrano::Grove is built on Capnotify which provides a series of built-in notifications.
|
31
|
+
This gem plugs into those notifications and sends them to your grove.io channel.
|
32
|
+
|
33
|
+
Once you've gone through the above installation procedure, all you need to do is set
|
34
|
+
your `grove_channel_token` as a Capistrano variable as follows:
|
16
35
|
|
17
|
-
|
36
|
+
set :grove_channel_token, 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
|
18
37
|
|
19
|
-
|
38
|
+
With that, you'll start receiving notifications to your channel for migrations,
|
39
|
+
deployment and maintenance page changes.
|
20
40
|
|
21
|
-
|
41
|
+
In addition to the above, you can configure how your messages appear:
|
22
42
|
|
23
|
-
|
24
|
-
|
43
|
+
set :grove_service_name, 'MyDeployer'
|
44
|
+
set :grove_icon_url, 'https://grove.io/static/img/webapp-logo.png'
|
45
|
+
set :grove_url, 'http://example.com'
|
25
46
|
|
26
|
-
|
47
|
+
Because Capistrano::Grove is built on Capnotify, you should refer to that documentation
|
48
|
+
for further customizing the messages that are posted to your channel:
|
27
49
|
|
28
|
-
|
29
|
-
`grove_message` variable to the grove.io service and will be usable after you set
|
30
|
-
the above variable.
|
50
|
+
https://github.com/spikegrobstein/capnotify
|
31
51
|
|
32
|
-
|
52
|
+
You can also use the `grove.notify` function anywhere in your Capistrano recipes to post
|
53
|
+
messages to your channel ad-hoc. For example:
|
33
54
|
|
34
|
-
|
55
|
+
grove.notify 'Greetings from Capistrano!'
|
35
56
|
|
36
57
|
## Variables
|
37
58
|
|
38
|
-
|
59
|
+
The following are Capistrano variables and are used via the `set` function.
|
39
60
|
|
40
|
-
|
41
|
-
|
61
|
+
### grove_channel_token
|
62
|
+
|
63
|
+
The channel token from the grove.io website. This is the only variable that is required
|
64
|
+
to get Capistrano::Grove working.
|
42
65
|
|
43
66
|
### grove_service
|
44
67
|
|
45
|
-
The name of the service that the notification comes from.
|
46
|
-
|
68
|
+
The name of the service, aka the handle of the user, that the notification comes from.
|
69
|
+
This defaults to 'Deploybot'
|
70
|
+
|
71
|
+
*This should not contain spaces as that causes the grove.io webservice some grief.*
|
47
72
|
|
48
73
|
### grove_icon_url
|
49
74
|
|
50
|
-
This
|
75
|
+
This should be a URL to an image that the service will use as its avatar in the channel.
|
51
76
|
|
52
77
|
### grove_url
|
53
78
|
|
54
79
|
When clicking your notification in the grove.io notification window, this is the URL
|
55
80
|
that you're taken to.
|
56
81
|
|
57
|
-
|
82
|
+
## Functions
|
83
|
+
|
84
|
+
### grove.notify
|
58
85
|
|
59
|
-
|
60
|
-
|
61
|
-
evaluated.
|
86
|
+
Capistrano::Grove comes with a single function: `grove.notify` for posting messages
|
87
|
+
to your channel. It takes a single parameter-the message to post.
|
62
88
|
|
63
|
-
|
89
|
+
Example:
|
64
90
|
|
65
|
-
"
|
91
|
+
grove.notify "That was easy!"
|
66
92
|
|
67
93
|
## Author
|
68
94
|
|
69
|
-
|
95
|
+
Capistrano::Grove is written by Spike Grobstein
|
70
96
|
spikegrobstein@mac.com
|
71
97
|
http://spike.grobste.in
|
72
98
|
https://github.com/spikegrobstein
|
73
99
|
|
74
100
|
## License
|
75
101
|
|
76
|
-
©2012 Spike Grobstein
|
102
|
+
©2012-2013 Spike Grobstein
|
77
103
|
MIT License (see `LICENSE` file included in this package).
|
78
104
|
|
data/capistrano-grove.gemspec
CHANGED
@@ -18,6 +18,9 @@ Gem::Specification.new do |s|
|
|
18
18
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
19
|
s.require_paths = ["lib"]
|
20
20
|
|
21
|
-
s.add_dependency('
|
21
|
+
s.add_dependency('capnotify', "~> 0.1pre")
|
22
22
|
s.add_dependency('grove-rb', '>= 0.2.0')
|
23
|
+
|
24
|
+
s.add_development_dependency('rspec')
|
25
|
+
s.add_development_dependency('pry')
|
23
26
|
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Capistrano
|
2
|
+
module Grove
|
3
|
+
class Client
|
4
|
+
attr_accessor :grove_client
|
5
|
+
|
6
|
+
def initialize(channel_key, options)
|
7
|
+
@grove_client = ::Grove.new(channel_key, options)
|
8
|
+
end
|
9
|
+
|
10
|
+
# post +message+ as a notification. Returns true om-success and false on-failure.
|
11
|
+
def notify(message)
|
12
|
+
!( @grove_client.post(message).status >= 400 )
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
data/lib/capistrano-grove.rb
CHANGED
@@ -1,21 +1,61 @@
|
|
1
|
+
require "capnotify"
|
1
2
|
require "capistrano-grove/version"
|
3
|
+
require "capistrano-grove/client"
|
2
4
|
require "grove-rb"
|
3
5
|
|
4
6
|
module Capistrano
|
5
7
|
module Grove
|
6
8
|
|
7
|
-
|
8
|
-
|
9
|
+
def self.load_into(config)
|
10
|
+
config.load do
|
11
|
+
Capistrano.plugin :grove, Capistrano::Grove
|
12
|
+
|
13
|
+
def _cset(name, *args, &block)
|
14
|
+
unless exists?(name)
|
15
|
+
set(name, *args, &block)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
# the channel's API key
|
20
|
+
_cset(:grove_channel_token) { abort "Please set grove_channel_token!" }
|
21
|
+
|
22
|
+
# the name of the service doing the posting
|
23
|
+
_cset :grove_service, 'DeployBot'
|
24
|
+
|
25
|
+
# url to the icon to use.
|
26
|
+
_cset :grove_icon_url, nil
|
27
|
+
|
28
|
+
# the url you want to use for your bot
|
29
|
+
_cset :grove_url, nil
|
30
|
+
|
31
|
+
# capnotify hooks
|
32
|
+
on(:deploy_start) { grove.notify fetch(:capnotify_deploy_start_msg) }
|
33
|
+
on(:deploy_complete) { grove.notify fetch(:capnotify_deploy_complete_msg) }
|
34
|
+
on(:migrate_start) { grove.notify fetch(:capnotify_migrate_start_msg) }
|
35
|
+
on(:migrate_complete) { grove.notify fetch(:capnotify_migrate_complete_msg) }
|
36
|
+
on(:maintenance_page_up) { grove.notify fetch(:capnotify_maintenance_page_up_msg) }
|
37
|
+
on(:maintenance_page_down) { grove.notify fetch(:capnotify_maintenance_page_down_msg) }
|
9
38
|
|
10
|
-
def initialize(channel_key, options)
|
11
|
-
@grove_client = ::Grove.new(channel_key, options)
|
12
39
|
end
|
40
|
+
end
|
41
|
+
|
42
|
+
# send a notification to the grove service
|
43
|
+
def notify(message)
|
44
|
+
g = Client.new(grove_channel_token,
|
45
|
+
:service => grove_service,
|
46
|
+
:icon_url => grove_icon_url,
|
47
|
+
:url => grove_url
|
48
|
+
)
|
13
49
|
|
14
|
-
|
15
|
-
|
16
|
-
|
50
|
+
unless g.notify(message)
|
51
|
+
# error
|
52
|
+
logger.important "Failed to send notification to grove.io"
|
17
53
|
end
|
18
54
|
end
|
19
55
|
|
20
56
|
end
|
21
57
|
end
|
58
|
+
|
59
|
+
if Capistrano::Configuration.instance
|
60
|
+
Capistrano::Grove.load_into(Capistrano::Configuration.instance)
|
61
|
+
end
|
File without changes
|
@@ -0,0 +1,81 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Capistrano::Grove do
|
4
|
+
|
5
|
+
let(:config) { Capistrano::Configuration.new }
|
6
|
+
let(:client) { double('grove').as_null_object }
|
7
|
+
|
8
|
+
before do
|
9
|
+
Capistrano::Grove.load_into(config)
|
10
|
+
end
|
11
|
+
|
12
|
+
|
13
|
+
context "when notifying" do
|
14
|
+
context "when failing to set grove_channel_token" do
|
15
|
+
|
16
|
+
it "should raise an error" do
|
17
|
+
expect { config.grove.notify }.to raise_error
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
|
22
|
+
context "when grove_channel_token is set" do
|
23
|
+
before do
|
24
|
+
config.load do
|
25
|
+
set :grove_channel_token, 'asdfasdfasdf'
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
after do
|
30
|
+
config.grove.notify 'msg'
|
31
|
+
end
|
32
|
+
|
33
|
+
it "should use :grove_channel_token" do
|
34
|
+
new_channel_token = '12345678901234567890123456789012'
|
35
|
+
config.set(:grove_channel_token, new_channel_token)
|
36
|
+
|
37
|
+
client.stub(:notify => true)
|
38
|
+
|
39
|
+
Capistrano::Grove::Client.should_receive(:new).with do |channel_token, options|
|
40
|
+
channel_token.should == new_channel_token
|
41
|
+
end.and_return(client)
|
42
|
+
end
|
43
|
+
|
44
|
+
it "should use :grove_service" do
|
45
|
+
new_grove_service = 'testing-service'
|
46
|
+
config.set(:grove_service, new_grove_service)
|
47
|
+
|
48
|
+
client.stub(:notify => true)
|
49
|
+
|
50
|
+
Capistrano::Grove::Client.should_receive(:new).with do |channel_token, options|
|
51
|
+
options[:service].should == new_grove_service
|
52
|
+
end.and_return(client)
|
53
|
+
end
|
54
|
+
|
55
|
+
it "should use :grove_icon_url" do
|
56
|
+
new_grove_icon_url = 'http://example.com/testing/icon.png'
|
57
|
+
config.set(:grove_icon_url, new_grove_icon_url)
|
58
|
+
|
59
|
+
client.stub(:notify => true)
|
60
|
+
|
61
|
+
Capistrano::Grove::Client.should_receive(:new).with do |channel_token, options|
|
62
|
+
options[:icon_url].should == new_grove_icon_url
|
63
|
+
end.and_return(client)
|
64
|
+
end
|
65
|
+
|
66
|
+
it "should use :grove_url" do
|
67
|
+
new_grove_url = 'http://testing.com/capistrano-grove'
|
68
|
+
config.set(:grove_url, new_grove_url)
|
69
|
+
|
70
|
+
client.stub(:notify => true)
|
71
|
+
|
72
|
+
Capistrano::Grove::Client.should_receive(:new).with do |channel_token, options|
|
73
|
+
options[:url].should == new_grove_url
|
74
|
+
end.and_return(client)
|
75
|
+
end
|
76
|
+
|
77
|
+
end
|
78
|
+
|
79
|
+
end
|
80
|
+
|
81
|
+
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,66 +1,90 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano-grove
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 1
|
8
|
-
- 0
|
9
|
-
- 1
|
10
|
-
version: 1.0.1
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 2.0.0pre
|
5
|
+
prerelease: 5
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Spike Grobstein
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
prerelease: false
|
23
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
12
|
+
date: 2013-04-03 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: capnotify
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
24
17
|
none: false
|
25
|
-
requirements:
|
26
|
-
- -
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
|
29
|
-
segments:
|
30
|
-
- 2
|
31
|
-
- 12
|
32
|
-
- 0
|
33
|
-
version: 2.12.0
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 0.1pre
|
34
22
|
type: :runtime
|
35
|
-
version_requirements: *id001
|
36
|
-
- !ruby/object:Gem::Dependency
|
37
|
-
name: grove-rb
|
38
23
|
prerelease: false
|
39
|
-
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 0.1pre
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: grove-rb
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
40
33
|
none: false
|
41
|
-
requirements:
|
42
|
-
- -
|
43
|
-
- !ruby/object:Gem::Version
|
44
|
-
hash: 23
|
45
|
-
segments:
|
46
|
-
- 0
|
47
|
-
- 2
|
48
|
-
- 0
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
49
37
|
version: 0.2.0
|
50
38
|
type: :runtime
|
51
|
-
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 0.2.0
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: rspec
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: pry
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
type: :development
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
52
78
|
description: Customizable Capistrano tasks for communicating with the grove.io webservice.
|
53
|
-
email:
|
79
|
+
email:
|
54
80
|
- spikegrobstein@mac.com
|
55
81
|
executables: []
|
56
|
-
|
57
82
|
extensions: []
|
58
|
-
|
59
83
|
extra_rdoc_files: []
|
60
|
-
|
61
|
-
files:
|
84
|
+
files:
|
62
85
|
- .gitignore
|
63
86
|
- .rspec
|
87
|
+
- .travis.yml
|
64
88
|
- CHANGELOG
|
65
89
|
- Gemfile
|
66
90
|
- LICENSE
|
@@ -68,43 +92,37 @@ files:
|
|
68
92
|
- Rakefile
|
69
93
|
- capistrano-grove.gemspec
|
70
94
|
- lib/capistrano-grove.rb
|
95
|
+
- lib/capistrano-grove/client.rb
|
71
96
|
- lib/capistrano-grove/version.rb
|
72
|
-
-
|
73
|
-
- spec/
|
97
|
+
- spec/capistrano-grove/client_spec.rb
|
98
|
+
- spec/capistrano-grove_spec.rb
|
74
99
|
- spec/spec_helper.rb
|
75
100
|
homepage: https://github.com/spikegrobstein/capistrano-grove
|
76
101
|
licenses: []
|
77
|
-
|
78
102
|
post_install_message:
|
79
103
|
rdoc_options: []
|
80
|
-
|
81
|
-
require_paths:
|
104
|
+
require_paths:
|
82
105
|
- lib
|
83
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
106
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
84
107
|
none: false
|
85
|
-
requirements:
|
86
|
-
- -
|
87
|
-
- !ruby/object:Gem::Version
|
88
|
-
|
89
|
-
|
90
|
-
- 0
|
91
|
-
version: "0"
|
92
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
108
|
+
requirements:
|
109
|
+
- - ! '>='
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: '0'
|
112
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
93
113
|
none: false
|
94
|
-
requirements:
|
95
|
-
- -
|
96
|
-
- !ruby/object:Gem::Version
|
97
|
-
|
98
|
-
segments:
|
99
|
-
- 0
|
100
|
-
version: "0"
|
114
|
+
requirements:
|
115
|
+
- - ! '>'
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 1.3.1
|
101
118
|
requirements: []
|
102
|
-
|
103
119
|
rubyforge_project: capistrano-grove
|
104
|
-
rubygems_version: 1.8.
|
120
|
+
rubygems_version: 1.8.24
|
105
121
|
signing_key:
|
106
122
|
specification_version: 3
|
107
123
|
summary: Post to grove.io after a deploy.
|
108
|
-
test_files:
|
109
|
-
- spec/grove/
|
124
|
+
test_files:
|
125
|
+
- spec/capistrano-grove/client_spec.rb
|
126
|
+
- spec/capistrano-grove_spec.rb
|
110
127
|
- spec/spec_helper.rb
|
128
|
+
has_rdoc:
|
data/lib/grove/capistrano.rb
DELETED
@@ -1,43 +0,0 @@
|
|
1
|
-
require 'capistrano'
|
2
|
-
require 'capistrano-grove'
|
3
|
-
|
4
|
-
module Capistrano
|
5
|
-
module Grove
|
6
|
-
|
7
|
-
def self.load_into(config)
|
8
|
-
config.load do
|
9
|
-
set :grove_channel_key, '' # the channel's API key
|
10
|
-
set :grove_service, 'DeployBot' # the name of the service posting
|
11
|
-
set :grove_icon_url, nil # url to the icon to use.
|
12
|
-
set :grove_url, nil # the url you want to use for your bot
|
13
|
-
|
14
|
-
# the message that gets posted.
|
15
|
-
# set this before calling grove:notify to customize
|
16
|
-
set(:grove_message) {
|
17
|
-
"Successful deployment of #{ fetch(:application, 'application') }."
|
18
|
-
}
|
19
|
-
|
20
|
-
namespace :grove do
|
21
|
-
|
22
|
-
desc "Notify the grove.io service."
|
23
|
-
task :notify do
|
24
|
-
g = Client.new(grove_channel_key,
|
25
|
-
:service => grove_service,
|
26
|
-
:icon_url => grove_icon_url,
|
27
|
-
:url => grove_url
|
28
|
-
)
|
29
|
-
|
30
|
-
unless g.notify(grove_message)
|
31
|
-
# error
|
32
|
-
logger.important "Failed to send notification to grove.io"
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
if Capistrano::Configuration.instance
|
42
|
-
Capistrano::Grove.load_into(Capistrano::Configuration.instance)
|
43
|
-
end
|
@@ -1,73 +0,0 @@
|
|
1
|
-
require 'capistrano'
|
2
|
-
require 'grove-rb'
|
3
|
-
|
4
|
-
require File.dirname(__FILE__) + '/../../lib/grove/capistrano'
|
5
|
-
|
6
|
-
describe Capistrano::Grove do
|
7
|
-
|
8
|
-
let(:config) { Capistrano::Configuration.new }
|
9
|
-
let(:grove) { double('grove').as_null_object }
|
10
|
-
|
11
|
-
context "when notifying" do
|
12
|
-
|
13
|
-
before do
|
14
|
-
Capistrano::Grove.load_into(config)
|
15
|
-
end
|
16
|
-
|
17
|
-
after do
|
18
|
-
config.find_and_execute_task('grove:notify')
|
19
|
-
end
|
20
|
-
|
21
|
-
it "should notify with the :grove_message" do
|
22
|
-
Capistrano::Grove::Client.should_receive(:new).and_return(grove)
|
23
|
-
|
24
|
-
grove.should_receive(:notify).with(config.fetch(:grove_message)).and_return(true)
|
25
|
-
end
|
26
|
-
|
27
|
-
it "should use :grove_channel_key" do
|
28
|
-
new_channel_key = '12345678901234567890123456789012'
|
29
|
-
config.set(:grove_channel_key, new_channel_key)
|
30
|
-
|
31
|
-
grove.stub(:notify => true)
|
32
|
-
|
33
|
-
Capistrano::Grove::Client.should_receive(:new).with do |channel_key, options|
|
34
|
-
channel_key.should == new_channel_key
|
35
|
-
end.and_return(grove)
|
36
|
-
end
|
37
|
-
|
38
|
-
it "should use :grove_service" do
|
39
|
-
new_grove_service = 'testing-service'
|
40
|
-
config.set(:grove_service, new_grove_service)
|
41
|
-
|
42
|
-
grove.stub(:notify => true)
|
43
|
-
|
44
|
-
Capistrano::Grove::Client.should_receive(:new).with do |channel_key, options|
|
45
|
-
options[:service].should == new_grove_service
|
46
|
-
end.and_return(grove)
|
47
|
-
end
|
48
|
-
|
49
|
-
it "should use :grove_icon_url" do
|
50
|
-
new_grove_icon_url = 'http://example.com/testing/icon.png'
|
51
|
-
config.set(:grove_icon_url, new_grove_icon_url)
|
52
|
-
|
53
|
-
grove.stub(:notify => true)
|
54
|
-
|
55
|
-
Capistrano::Grove::Client.should_receive(:new).with do |channel_key, options|
|
56
|
-
options[:icon_url].should == new_grove_icon_url
|
57
|
-
end.and_return(grove)
|
58
|
-
end
|
59
|
-
|
60
|
-
it "should use :grove_url" do
|
61
|
-
new_grove_url = 'http://testing.com/capistrano-grove'
|
62
|
-
config.set(:grove_url, new_grove_url)
|
63
|
-
|
64
|
-
grove.stub(:notify => true)
|
65
|
-
|
66
|
-
Capistrano::Grove::Client.should_receive(:new).with do |channel_key, options|
|
67
|
-
options[:url].should == new_grove_url
|
68
|
-
end.and_return(grove)
|
69
|
-
end
|
70
|
-
|
71
|
-
end
|
72
|
-
|
73
|
-
end
|