capistrano-graphite 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +6 -0
- data/.rubocop_todo.yml +14 -0
- data/.travis.yml +7 -2
- data/CHANGELOG.md +15 -0
- data/Gemfile +2 -0
- data/README.md +9 -14
- data/Rakefile +7 -2
- data/capistrano-graphite.gemspec +23 -21
- data/lib/capistrano/graphite/version.rb +4 -1
- data/lib/capistrano/graphite.rb +15 -9
- data/spec/grapite_spec.rb +26 -0
- data/spec/spec_helper.rb +3 -0
- metadata +41 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 60c9b97e320cf08d4938903692509edd5461c6ff
|
4
|
+
data.tar.gz: 5e029a18828420df084a31025e61b7b873cc5791
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1a05c0951e1e3fe085c9c4799a2df0664164a77004d7fa6e4382a105337d90decc57ed25449ec746a8d9e17b90d437f6b37b49ba6a47aa7b3ce555db6c969a1b
|
7
|
+
data.tar.gz: bb2277b64bd8650b695686bd1ef3b81a8b93c5e60c7e44e43eead5564b241ff7e47c09410ecc69b1941970432afea2a926a06b9602bca868b4ddbbe58a927b37
|
data/.rubocop.yml
ADDED
data/.rubocop_todo.yml
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
# This configuration was generated by `rubocop --auto-gen-config`
|
2
|
+
# on 2014-11-18 14:45:57 -0500 using RuboCop version 0.27.1.
|
3
|
+
# The point is for the user to remove these configuration records
|
4
|
+
# one by one as the offenses are removed from the code base.
|
5
|
+
# Note that changes in the inspected code, or installation of new
|
6
|
+
# versions of RuboCop, may require this file to be generated again.
|
7
|
+
|
8
|
+
# Offense count: 1
|
9
|
+
Metrics/AbcSize:
|
10
|
+
Max: 20
|
11
|
+
|
12
|
+
# Offense count: 2
|
13
|
+
Style/RegexpLiteral:
|
14
|
+
MaxSlashes: 0
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
## 1.0.1
|
2
|
+
|
3
|
+
BUG FIXES:
|
4
|
+
|
5
|
+
- Fix bug where multiple events were sent to graphite. [GH-18]
|
6
|
+
|
7
|
+
IMPROVEMENTS:
|
8
|
+
|
9
|
+
- Update test command example in README.md. [GH-19]
|
10
|
+
- Lint entire project with RuboCop. [GH-17]
|
11
|
+
- Add `rake` task to lint with RuboCop when Travis is run. [GH-17]
|
12
|
+
|
13
|
+
## Previous Versions
|
14
|
+
|
15
|
+
Sorry, no true documentation was kept prior to 1.0.1.
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,16 +1,11 @@
|
|
1
1
|
# Capistrano::Graphite
|
2
|
-
[]
|
3
|
-
[]
|
4
|
-
[]
|
5
|
-
[![
|
6
|
-
[![
|
7
|
-
|
8
|
-
[gem]
|
9
|
-
[travis]: http://travis-ci.org/scottsuch/capistrano-graphite
|
10
|
-
[gemnasium]: https://gemnasium.com/scottsuch/capistrano-graphite
|
11
|
-
[coveralls]: https://coveralls.io/r/scottsuch/capistrano-graphite
|
12
|
-
[codeclimate]: https://codeclimate.com/github/scottsuch/capistrano-graphite
|
13
|
-
This gem works with Capistrano v3.1.0 and above and was based off the work on [this gem](https://github.com/hellvinz/graphite-notify) which works with Capistrano v2.x.
|
2
|
+
[](https://rubygems.org/gems/capistrano-graphite)
|
3
|
+
[](http://travis-ci.org/scottsuch/capistrano-graphite)
|
4
|
+
[](https://gemnasium.com/scottsuch/capistrano-graphite)
|
5
|
+
[](https://codeclimate.com/github/scottsuch/capistrano-graphite)
|
6
|
+
[](https://coveralls.io/r/scottsuch/capistrano-graphite?branch=master)
|
7
|
+
|
8
|
+
This gem works with Capistrano v3.0.0 and above and was based off the work on [this gem](https://github.com/hellvinz/graphite-notify) which works with Capistrano v2.x.
|
14
9
|
|
15
10
|
Adding this gem to [Capistrano](https://github.com/capistrano/capistrano) extends functionality by pushing events to graphite upon deployment and rollback.
|
16
11
|
Currently events are only pushed after `deploy:updated` and `deploy:reverted`.
|
@@ -39,7 +34,7 @@ Add the following line to your `Capfile`.
|
|
39
34
|
### Configurable options
|
40
35
|
Path to your graphite instance. Port and user:password are optional.
|
41
36
|
|
42
|
-
set
|
37
|
+
set :graphite_url, "http://user:password@example.com:8000/events/"
|
43
38
|
|
44
39
|
Disable sending events for a particular stage by setting the following to 0.
|
45
40
|
Note that the config `graphite_enable_events` has been deprecated in favor of
|
@@ -51,7 +46,7 @@ the config `suppress_graphite_events` below
|
|
51
46
|
### Test that it's working
|
52
47
|
You can run the following on it's own assuming you have configured the graphite url
|
53
48
|
|
54
|
-
$ bundle exec cap <stage> deploy:
|
49
|
+
$ bundle exec cap <stage> deploy:post_graphite['deploy']
|
55
50
|
|
56
51
|
## Contributing
|
57
52
|
|
data/Rakefile
CHANGED
data/capistrano-graphite.gemspec
CHANGED
@@ -4,34 +4,36 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
require 'capistrano/graphite/version'
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
|
-
s.name =
|
7
|
+
s.name = 'capistrano-graphite'
|
8
8
|
s.version = Capistrano::Graphite::VERSION
|
9
|
-
s.authors = [
|
10
|
-
s.email = [
|
11
|
-
s.summary =
|
12
|
-
|
13
|
-
s.description =
|
14
|
-
|
15
|
-
|
16
|
-
s.homepage =
|
17
|
-
s.license =
|
9
|
+
s.authors = ['scottsuch']
|
10
|
+
s.email = ['sgorsuch@gmail.com']
|
11
|
+
s.summary = 'A gem for pushing graphite events via capistrano v3 ' \
|
12
|
+
'deployment'
|
13
|
+
s.description = 'This gem plugs into the deploy task in capistrano to ' \
|
14
|
+
'help provide visibility into when deployments and ' \
|
15
|
+
'rollbacks occured.'
|
16
|
+
s.homepage = 'https://github.com/scottsuch/capistrano-graphite'
|
17
|
+
s.license = 'MIT'
|
18
18
|
|
19
19
|
s.required_ruby_version = '> 1.9'
|
20
20
|
|
21
|
-
s.post_install_message =
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
21
|
+
s.post_install_message = 'The config `graphite_enable_events` has changed ' \
|
22
|
+
'to `suppress_graphite_events` and will accept ' \
|
23
|
+
'a true or false. See the README.md at ' \
|
24
|
+
'https://github.com/scottsuch/capistrano-graphite ' \
|
25
|
+
'for details.'\
|
26
26
|
|
27
27
|
s.files = `git ls-files -z`.split("\x0")
|
28
28
|
s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
29
29
|
s.test_files = s.files.grep(%r{^(test|spec|features)/})
|
30
|
-
s.require_paths = [
|
30
|
+
s.require_paths = ['lib']
|
31
31
|
|
32
|
-
s.add_dependency
|
33
|
-
s.add_development_dependency
|
34
|
-
s.add_development_dependency
|
35
|
-
s.add_development_dependency
|
36
|
-
s.add_development_dependency
|
32
|
+
s.add_dependency 'capistrano', '~> 3.0'
|
33
|
+
s.add_development_dependency 'bundler', '~> 1.3'
|
34
|
+
s.add_development_dependency 'coveralls'
|
35
|
+
s.add_development_dependency 'rake'
|
36
|
+
s.add_development_dependency 'rspec'
|
37
|
+
s.add_development_dependency 'rubocop'
|
38
|
+
s.add_development_dependency 'webmock'
|
37
39
|
end
|
data/lib/capistrano/graphite.rb
CHANGED
@@ -1,15 +1,21 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
1
3
|
require 'capistrano'
|
2
4
|
require 'net/http'
|
3
5
|
require 'uri'
|
4
6
|
require 'sshkit'
|
5
7
|
require 'sshkit/dsl'
|
6
8
|
|
9
|
+
# Build the request to post
|
7
10
|
class GraphiteInterface
|
8
11
|
def post_event(action)
|
9
|
-
uri = URI
|
12
|
+
uri = URI.parse("#{fetch(:graphite_url)}")
|
10
13
|
req = Net::HTTP::Post.new(uri.path)
|
11
14
|
req.basic_auth(uri.user, uri.password) if uri.user
|
12
|
-
req.body = "{\"what\": \"#{action} #{fetch(:application)} in
|
15
|
+
req.body = "{\"what\": \"#{action} #{fetch(:application)} in " \
|
16
|
+
"#{fetch(:stage)}\", \"tags\": \"#{fetch(:application)}," \
|
17
|
+
"#{fetch(:stage)},#{release_timestamp},#{action}\", \"data\": " \
|
18
|
+
"\"#{fetch(:local_user)}\"}"
|
13
19
|
|
14
20
|
Net::HTTP.start(uri.host, uri.port) do |http|
|
15
21
|
http.request(req)
|
@@ -19,16 +25,16 @@ end
|
|
19
25
|
|
20
26
|
namespace :deploy do
|
21
27
|
desc 'Post an event to graphite'
|
22
|
-
task :post_graphite, :action do |
|
28
|
+
task :post_graphite, :action do |args|
|
23
29
|
action = args[:action]
|
24
|
-
|
25
|
-
if fetch(:suppress_graphite_events).downcase ==
|
30
|
+
run_locally do
|
31
|
+
if fetch(:suppress_graphite_events).downcase == 'true'
|
26
32
|
GraphiteInterface.new.post_event("#{action}")
|
27
33
|
info("#{action.capitalize} event posted to graphite.")
|
28
|
-
elsif fetch(:suppress_graphite_events).downcase ==
|
29
|
-
info(
|
34
|
+
elsif fetch(:suppress_graphite_events).downcase == 'false'
|
35
|
+
info('No event posted: `suppress_graphite_events` set to true.')
|
30
36
|
else
|
31
|
-
warn(
|
37
|
+
warn('No event posted: `suppress_graphite_events` set incorrectly.')
|
32
38
|
end
|
33
39
|
end
|
34
40
|
end
|
@@ -44,7 +50,7 @@ end
|
|
44
50
|
|
45
51
|
namespace :load do
|
46
52
|
task :defaults do
|
47
|
-
set :suppress_graphite_events,
|
53
|
+
set :suppress_graphite_events, 'false'
|
48
54
|
set :local_user, ENV['USER']
|
49
55
|
end
|
50
56
|
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
# graphite_spec.rb
|
4
|
+
require 'spec_helper'
|
5
|
+
require 'capistrano/graphite.rb'
|
6
|
+
|
7
|
+
RSpec.describe GraphiteInterface do
|
8
|
+
describe '#post_event' do
|
9
|
+
context 'deploy' do
|
10
|
+
it 'posts a deploy event to graphite' do
|
11
|
+
stub_request(:post, 'http://localhost/')
|
12
|
+
.with(body: "{\'what\': \'deploy testapp\', \'tags\': " \
|
13
|
+
"\'testapp,randomsha,deploy\', \'data\': \'testuser\'}")
|
14
|
+
.to_return(status: '200', body: '', headers: {})
|
15
|
+
end
|
16
|
+
end
|
17
|
+
context 'rollback' do
|
18
|
+
it 'posts a rollback event to graphite' do
|
19
|
+
stub_request(:post, 'http://localhost/')
|
20
|
+
.with(body: "{\'what\': \'rollback testapp\', \'tags\': " \
|
21
|
+
"\'testapp,randomsha,deploy\', \'data\': \'testuser\'}")
|
22
|
+
.to_return(status: '200', body: '', headers: {})
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano-graphite
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- scottsuch
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-11-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: capistrano
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '1.3'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: coveralls
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: rake
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -67,7 +81,21 @@ dependencies:
|
|
67
81
|
- !ruby/object:Gem::Version
|
68
82
|
version: '0'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
84
|
+
name: rubocop
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: webmock
|
71
99
|
requirement: !ruby/object:Gem::Requirement
|
72
100
|
requirements:
|
73
101
|
- - ">="
|
@@ -80,10 +108,8 @@ dependencies:
|
|
80
108
|
- - ">="
|
81
109
|
- !ruby/object:Gem::Version
|
82
110
|
version: '0'
|
83
|
-
description:
|
84
|
-
|
85
|
-
help provide visibility into when deployments and
|
86
|
-
rollbacks occured.
|
111
|
+
description: This gem plugs into the deploy task in capistrano to help provide visibility
|
112
|
+
into when deployments and rollbacks occured.
|
87
113
|
email:
|
88
114
|
- sgorsuch@gmail.com
|
89
115
|
executables: []
|
@@ -92,7 +118,10 @@ extra_rdoc_files: []
|
|
92
118
|
files:
|
93
119
|
- ".coveralls.yml"
|
94
120
|
- ".gitignore"
|
121
|
+
- ".rubocop.yml"
|
122
|
+
- ".rubocop_todo.yml"
|
95
123
|
- ".travis.yml"
|
124
|
+
- CHANGELOG.md
|
96
125
|
- Gemfile
|
97
126
|
- LICENSE.txt
|
98
127
|
- README.md
|
@@ -100,14 +129,15 @@ files:
|
|
100
129
|
- capistrano-graphite.gemspec
|
101
130
|
- lib/capistrano/graphite.rb
|
102
131
|
- lib/capistrano/graphite/version.rb
|
132
|
+
- spec/grapite_spec.rb
|
103
133
|
- spec/spec_helper.rb
|
104
134
|
homepage: https://github.com/scottsuch/capistrano-graphite
|
105
135
|
licenses:
|
106
136
|
- MIT
|
107
137
|
metadata: {}
|
108
138
|
post_install_message: The config `graphite_enable_events` has changed to `suppress_graphite_events`
|
109
|
-
and will accept a true or false. See the README.md
|
110
|
-
for details.
|
139
|
+
and will accept a true or false. See the README.md at https://github.com/scottsuch/capistrano-graphite
|
140
|
+
for details.
|
111
141
|
rdoc_options: []
|
112
142
|
require_paths:
|
113
143
|
- lib
|
@@ -123,10 +153,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
123
153
|
version: '0'
|
124
154
|
requirements: []
|
125
155
|
rubyforge_project:
|
126
|
-
rubygems_version: 2.
|
156
|
+
rubygems_version: 2.4.4
|
127
157
|
signing_key:
|
128
158
|
specification_version: 4
|
129
159
|
summary: A gem for pushing graphite events via capistrano v3 deployment
|
130
160
|
test_files:
|
161
|
+
- spec/grapite_spec.rb
|
131
162
|
- spec/spec_helper.rb
|
132
|
-
has_rdoc:
|