capistrano-grove 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in capistrano-grove.gemspec
4
+ gemspec
5
+ gem 'rspec'
data/LICENSE ADDED
@@ -0,0 +1,7 @@
1
+ Copyright (c) 2012 Spike Grobstein
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,73 @@
1
+ # Capistrano grove.io notifications
2
+
3
+ Easily send notifications to your [grove.io](http://grove.io) channel after a deploy.
4
+
5
+ ## Getting started
6
+
7
+ In your application's `Gemfile` put the following:
8
+
9
+ gem 'capistrano-grove', 'git://github.com/spikegrobstein/capistrano-grove.git'
10
+
11
+ At the top of your `Capfile` you should also add the following:
12
+
13
+ require 'grove/capistrano'
14
+
15
+ Once you get your gems installed via `bundle install`, you can configure
16
+ `capistrano-grove`.
17
+
18
+ The only required parameter to use this plugin is the `grove_channel_key` variable.
19
+ You can get your channel key from the grove.io website. Initialize it as follows:
20
+
21
+ set :grove_channel_key, 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
22
+
23
+ `capistrano-grove` comes with one task: `grove:notify`. This task posts the
24
+ `grove_message` variable to the grove.io service and will be usable after you set
25
+ the above variable.
26
+
27
+ To automatially notify on grove.io after a deploy, set an `after` hook:
28
+
29
+ after 'deploy', 'grove:notify'
30
+
31
+ ## Variables
32
+
33
+ ### grove_channel_key
34
+
35
+ The channel key from the grove.io website. This is the only variable that is required
36
+ to get `capistrano-grove` working.
37
+
38
+ ### grove_service
39
+
40
+ The name of the service that the notification comes from. This should not contain
41
+ spaces as that causes the grove.io webservice some grief.
42
+
43
+ ### grove_icon_url
44
+
45
+ This is the URL to the icon that your notification uses.
46
+
47
+ ### grove_url
48
+
49
+ When clicking your notification in the grove.io notification window, this is the URL
50
+ that you're taken to.
51
+
52
+ ### grove_message
53
+
54
+ Each time that the `grove:notify` task is run, `grove_message` is the message that
55
+ is posted. Typically, you'd want to set this with a block so it can be lazily
56
+ evaluated.
57
+
58
+ It defaults to:
59
+
60
+ "Successful deployment of #{ fetch(:application, 'application') }."
61
+
62
+ ## Author
63
+
64
+ `capistrano-grove` is written by Spike Grobstein
65
+ spikegrobstein@mac.com
66
+ http://spike.grobste.in
67
+ https://github.com/spikegrobstein
68
+
69
+ ## License
70
+
71
+ ©2012 Spike Grobstein
72
+ MIT License (see `LICENSE` file included in this package).
73
+
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require 'bundler/gem_tasks'
@@ -0,0 +1,23 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "capistrano-grove/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "capistrano-grove"
7
+ s.version = Capistrano::Grove::VERSION
8
+ s.authors = ["Spike Grobstein"]
9
+ s.email = ["spikegrobstein@mac.com"]
10
+ s.homepage = "https://github.com/spikegrobstein/capistrano-grove"
11
+ s.summary = %q{Post to grove.io after a deploy.}
12
+ s.description = %q{Customizable Capistrano tasks for communicating with the grove.io webservice.}
13
+
14
+ s.rubyforge_project = "capistrano-grove"
15
+
16
+ s.files = `git ls-files`.split("\n")
17
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
+ s.require_paths = ["lib"]
20
+
21
+ s.add_dependency('capistrano', '>= 2.12.0')
22
+ s.add_dependency('grove-rb', '>= 0.2.0')
23
+ end
@@ -0,0 +1,5 @@
1
+ module Capistrano
2
+ module Grove
3
+ VERSION = "1.0.0"
4
+ end
5
+ end
@@ -0,0 +1,20 @@
1
+ require "capistrano-grove/version"
2
+ require "grove-rb"
3
+
4
+ module Capistrano
5
+ module Grove
6
+
7
+ class Client
8
+ attr_accessor :grove_client
9
+
10
+ def initialize(channel_key, options)
11
+ @grove_client = ::Grove.new(channel_key, options)
12
+ end
13
+
14
+ def notify(message)
15
+ !( @grove_client.post(message).status >= 400 )
16
+ end
17
+ end
18
+
19
+ end
20
+ end
@@ -0,0 +1,43 @@
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
@@ -0,0 +1,73 @@
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
@@ -0,0 +1,8 @@
1
+ require 'rubygems'
2
+ require 'bundler/setup'
3
+
4
+ require 'capistrano-grove'
5
+
6
+ Rspec.configure do |config|
7
+ # config
8
+ end
metadata ADDED
@@ -0,0 +1,109 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: capistrano-grove
3
+ version: !ruby/object:Gem::Version
4
+ hash: 23
5
+ prerelease:
6
+ segments:
7
+ - 1
8
+ - 0
9
+ - 0
10
+ version: 1.0.0
11
+ platform: ruby
12
+ authors:
13
+ - Spike Grobstein
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2012-05-27 00:00:00 Z
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: capistrano
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ hash: 63
29
+ segments:
30
+ - 2
31
+ - 12
32
+ - 0
33
+ version: 2.12.0
34
+ type: :runtime
35
+ version_requirements: *id001
36
+ - !ruby/object:Gem::Dependency
37
+ name: grove-rb
38
+ prerelease: false
39
+ requirement: &id002 !ruby/object:Gem::Requirement
40
+ none: false
41
+ requirements:
42
+ - - ">="
43
+ - !ruby/object:Gem::Version
44
+ hash: 23
45
+ segments:
46
+ - 0
47
+ - 2
48
+ - 0
49
+ version: 0.2.0
50
+ type: :runtime
51
+ version_requirements: *id002
52
+ description: Customizable Capistrano tasks for communicating with the grove.io webservice.
53
+ email:
54
+ - spikegrobstein@mac.com
55
+ executables: []
56
+
57
+ extensions: []
58
+
59
+ extra_rdoc_files: []
60
+
61
+ files:
62
+ - .gitignore
63
+ - .rspec
64
+ - Gemfile
65
+ - LICENSE
66
+ - README.md
67
+ - Rakefile
68
+ - capistrano-grove.gemspec
69
+ - lib/capistrano-grove.rb
70
+ - lib/capistrano-grove/version.rb
71
+ - lib/grove/capistrano.rb
72
+ - spec/grove/capistrano_spec.rb
73
+ - spec/spec_helper.rb
74
+ homepage: https://github.com/spikegrobstein/capistrano-grove
75
+ licenses: []
76
+
77
+ post_install_message:
78
+ rdoc_options: []
79
+
80
+ require_paths:
81
+ - lib
82
+ required_ruby_version: !ruby/object:Gem::Requirement
83
+ none: false
84
+ requirements:
85
+ - - ">="
86
+ - !ruby/object:Gem::Version
87
+ hash: 3
88
+ segments:
89
+ - 0
90
+ version: "0"
91
+ required_rubygems_version: !ruby/object:Gem::Requirement
92
+ none: false
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ hash: 3
97
+ segments:
98
+ - 0
99
+ version: "0"
100
+ requirements: []
101
+
102
+ rubyforge_project: capistrano-grove
103
+ rubygems_version: 1.8.12
104
+ signing_key:
105
+ specification_version: 3
106
+ summary: Post to grove.io after a deploy.
107
+ test_files:
108
+ - spec/grove/capistrano_spec.rb
109
+ - spec/spec_helper.rb