capistrano-graphite 0.3.1 → 1.0.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2217bead0988be425af65e7a8840eaf056c1fb67
4
- data.tar.gz: 90c899ecd01b2033fd072e3a589407560401841c
3
+ metadata.gz: 2c337353592f855999c6be4c8db8599556225dfb
4
+ data.tar.gz: 9a654504efff0eb61d7a25fbe95280f76d6d0710
5
5
  SHA512:
6
- metadata.gz: db30fbfa0227b4ca9a4dcc7f40a1a87abb5c56beac82f2fc4e209f8a9461c4e8536bd7a11a871b5e9672e9890494040ce9ff57ce48f7b7c05f5a75f0dc31d057
7
- data.tar.gz: 55e261bd872065efb84473fbabcaeb8efd7503050bdad9b9e0ff93de44376177c8e0a9ea0f1faabb859b6b68d946b5b9ad28f19e695dafcc0d8eb6747c191118
6
+ metadata.gz: ca92e6af6cd0905bc516d4fa47c2604486187e7759ae10b72a0b5d82410deec18d0a4dcaa0835d6bf415ed7692870e4802cc0daeae63652ad43683b6822c8648
7
+ data.tar.gz: 55162d1d21751b205ed8362f9265476b4d560f56e7d47203fd719ab9ddf767f8bceb78ce4139d6674dabc1ebfb4995c4650a47d075ade22ed59e2e723913008b
data/.coveralls.yml ADDED
@@ -0,0 +1 @@
1
+ service_name: travis-ci
data/README.md CHANGED
@@ -2,16 +2,18 @@
2
2
  [![Gem Version](http://img.shields.io/gem/v/capistrano-graphite.svg)][gem]
3
3
  [![Build Status](http://img.shields.io/travis/scottsuch/capistrano-graphite.svg)][travis]
4
4
  [![Dependency Status](http://img.shields.io/gemnasium/scottsuch/capistrano-graphite.svg)][gemnasium]
5
+ [![Coverage Status](http://img.shields.io/coveralls/scottsuch/capistrano-graphite.svg)][coveralls]
5
6
  [![Code Climate](http://img.shields.io/codeclimate/github/scottsuch/capistrano-graphite.svg)][codeclimate]
6
7
 
7
8
  [gem]: https://rubygems.org/gems/capistrano-graphite
8
9
  [travis]: http://travis-ci.org/scottsuch/capistrano-graphite
9
10
  [gemnasium]: https://gemnasium.com/scottsuch/capistrano-graphite
11
+ [coveralls]: https://coveralls.io/r/scottsuch/capistrano-graphite
10
12
  [codeclimate]: https://codeclimate.com/github/scottsuch/capistrano-graphite
11
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.
12
14
 
13
- Adding this gem to [Capistrano](https://github.com/capistrano/capistrano) deploy extends functionality by pushing events to graphite.
14
- Currently events are only pushed after ```deploy:updated``` and ```deploy:reverted```.
15
+ Adding this gem to [Capistrano](https://github.com/capistrano/capistrano) extends functionality by pushing events to graphite upon deployment and rollback.
16
+ Currently events are only pushed after `deploy:updated` and `deploy:reverted`.
15
17
 
16
18
  Some information on events can be found in [this article](http://obfuscurity.com/2014/01/Graphite-Tip-A-Better-Way-to-Store-Events).
17
19
 
@@ -30,7 +32,7 @@ And then execute:
30
32
 
31
33
  ## Usage
32
34
  ### Setup your application
33
- Add the following line to your ```Capfile```.
35
+ Add the following line to your `Capfile`.
34
36
 
35
37
  require "capistrano/graphite"
36
38
 
@@ -39,9 +41,12 @@ Path to your graphite instance. Port and user:password are optional.
39
41
 
40
42
  set: :graphite_url, "http://user:password@example.com:8000/events/"
41
43
 
42
- Disable sending events for a particular stage by setting the following to 0
44
+ Disable sending events for a particular stage by setting the following to 0.
45
+ Note that the config `graphite_enable_events` has been deprecated in favor of
46
+ the config `suppress_graphite_events` below
47
+
48
+ set :suppress_graphite_events, "true" # This is set to false by default
43
49
 
44
- set :graphite_enable_events, 0 # This is set to 1 by default
45
50
 
46
51
  ### Test that it's working
47
52
  You can run the following on it's own assuming you have configured the graphite url
@@ -3,28 +3,35 @@ lib = File.expand_path('../lib', __FILE__)
3
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
  require 'capistrano/graphite/version'
5
5
 
6
- Gem::Specification.new do |spec|
7
- spec.name = "capistrano-graphite"
8
- spec.version = Capistrano::Graphite::VERSION
9
- spec.authors = ["scottsuch"]
10
- spec.email = ["sgorsuch@gmail.com"]
11
- spec.summary = %q{A gem for pushing graphite events via capistrano v3
12
- deployment}
13
- spec.description = %q{This gem plugs into the deploy task in capistrano to
14
- help provide visibility into when deployments and
15
- rollbacks occured.}
16
- spec.homepage = "https://github.com/scottsuch/capistrano-graphite"
17
- spec.license = "MIT"
6
+ Gem::Specification.new do |s|
7
+ s.name = "capistrano-graphite"
8
+ s.version = Capistrano::Graphite::VERSION
9
+ s.authors = ["scottsuch"]
10
+ s.email = ["sgorsuch@gmail.com"]
11
+ s.summary = %q{A gem for pushing graphite events via capistrano v3
12
+ deployment}
13
+ s.description = %q{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
- spec.required_ruby_version = '> 1.9'
19
+ s.required_ruby_version = '> 1.9'
20
20
 
21
- spec.files = `git ls-files -z`.split("\x0")
22
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
23
- spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
24
- spec.require_paths = ["lib"]
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.}"\
25
26
 
26
- spec.add_dependency "capistrano", "~> 3.0"
27
- spec.add_development_dependency "bundler", "~> 1.3"
28
- spec.add_development_dependency "rake"
29
- spec.add_development_dependency "rspec"
27
+ s.files = `git ls-files -z`.split("\x0")
28
+ s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
29
+ s.test_files = s.files.grep(%r{^(test|spec|features)/})
30
+ s.require_paths = ["lib"]
31
+
32
+ s.add_dependency "capistrano", "~> 3.0"
33
+ s.add_development_dependency "bundler", "~> 1.3"
34
+ s.add_development_dependency "rake"
35
+ s.add_development_dependency "rspec"
36
+ s.add_development_dependency "coveralls"
30
37
  end
@@ -4,21 +4,7 @@ require 'uri'
4
4
  require 'sshkit'
5
5
  require 'sshkit/dsl'
6
6
 
7
- set :local_user, ENV['USER']
8
-
9
7
  class GraphiteInterface
10
- def self.events_enabled(action)
11
- if fetch(:graphite_enable_events).to_i == 1
12
- # We only post an event if graphite_enable_events was set to 1
13
- GraphiteInterface.new.post_event(action)
14
- return 1
15
- elsif fetch(:graphite_enable_events).to_i == 0
16
- return 0
17
- else
18
- return -1
19
- end
20
- end
21
-
22
8
  def post_event(action)
23
9
  uri = URI::parse("#{fetch(:graphite_url)}")
24
10
  req = Net::HTTP::Post.new(uri.path)
@@ -32,41 +18,33 @@ class GraphiteInterface
32
18
  end
33
19
 
34
20
  namespace :deploy do
35
- desc 'notify graphite that a deployment occured'
36
- task :graphite_deploy do
21
+ desc 'Post an event to graphite'
22
+ task :post_graphite, :action do |t, args|
23
+ action = args[:action]
37
24
  on roles(:all) do |host|
38
- action = "deploy"
39
- if GraphiteInterface.events_enabled(action) == 1
25
+ if fetch(:suppress_graphite_events).downcase == "true"
26
+ GraphiteInterface.new.post_event("#{action}")
40
27
  info("#{action.capitalize} event posted to graphite.")
41
- elsif GraphiteInterface.events_enabled(action) == 0
42
- info("No event posted: graphite_enable_events set to 0.")
28
+ elsif fetch(:suppress_graphite_events).downcase == "false"
29
+ info("No event posted: `suppress_graphite_events` set to true.")
43
30
  else
44
- warn("No event posted: graphite_enable_events set to invalid variable.")
45
- end
46
- end
47
- end
48
-
49
- desc 'notify graphite that a rollback occured'
50
- task :graphite_rollback do
51
- on roles(:all) do |host|
52
- action = "rollback"
53
- if GraphiteInterface.events_enabled(action) == 1
54
- info("#{action.capitalize} event posted to graphite.")
55
- elsif GraphiteInterface.events_enabled(action) == 0
56
- info("No event posted: graphite_enable_events set to 0.")
57
- else
58
- warn("No event posted: graphite_enable_events set to invalid variable.")
31
+ warn("No event posted: `suppress_graphite_events` set incorrectly.")
59
32
  end
60
33
  end
61
34
  end
62
35
 
63
36
  # Set the order for these tasks
64
- after 'deploy:updated', 'deploy:graphite_deploy'
65
- after 'deploy:reverted', 'deploy:graphite_rollback'
37
+ after 'deploy:updated', 'post_graphite_deploy' do
38
+ Rake::Task['deploy:post_graphite'].invoke 'deploy'
39
+ end
40
+ after 'deploy:reverted', 'post_graphite_rollback' do
41
+ Rake::Task['deploy:post_graphite'].invoke 'rollback'
42
+ end
66
43
  end
67
44
 
68
45
  namespace :load do
69
46
  task :defaults do
70
- set :graphite_enable_events, 1
47
+ set :suppress_graphite_events, "false"
48
+ set :local_user, ENV['USER']
71
49
  end
72
50
  end
@@ -1,5 +1,5 @@
1
1
  module Capistrano
2
2
  module Graphite
3
- VERSION = "0.3.1"
3
+ VERSION = "1.0.0"
4
4
  end
5
5
  end
@@ -0,0 +1,8 @@
1
+ require 'rspec'
2
+ require 'rake'
3
+ require 'capistrano/all'
4
+ require 'capistrano/framework'
5
+ require 'capistrano/setup'
6
+
7
+ require 'coveralls'
8
+ Coveralls.wear!
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: 0.3.1
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - scottsuch
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-07 00:00:00.000000000 Z
11
+ date: 2014-05-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capistrano
@@ -66,16 +66,31 @@ dependencies:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: coveralls
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
69
83
  description: |-
70
84
  This gem plugs into the deploy task in capistrano to
71
- help provide visibility into when deployments and
72
- rollbacks occured.
85
+ help provide visibility into when deployments and
86
+ rollbacks occured.
73
87
  email:
74
88
  - sgorsuch@gmail.com
75
89
  executables: []
76
90
  extensions: []
77
91
  extra_rdoc_files: []
78
92
  files:
93
+ - ".coveralls.yml"
79
94
  - ".gitignore"
80
95
  - ".travis.yml"
81
96
  - Gemfile
@@ -85,12 +100,14 @@ files:
85
100
  - capistrano-graphite.gemspec
86
101
  - lib/capistrano/graphite.rb
87
102
  - lib/capistrano/graphite/version.rb
88
- - spec/README.md
103
+ - spec/spec_helper.rb
89
104
  homepage: https://github.com/scottsuch/capistrano-graphite
90
105
  licenses:
91
106
  - MIT
92
107
  metadata: {}
93
- post_install_message:
108
+ 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 athttps://github.com/scottsuch/capistrano-graphite
110
+ for details.}
94
111
  rdoc_options: []
95
112
  require_paths:
96
113
  - lib
@@ -111,5 +128,5 @@ signing_key:
111
128
  specification_version: 4
112
129
  summary: A gem for pushing graphite events via capistrano v3 deployment
113
130
  test_files:
114
- - spec/README.md
131
+ - spec/spec_helper.rb
115
132
  has_rdoc:
data/spec/README.md DELETED
@@ -1 +0,0 @@
1
- TODO: Add test