capistrano-graphite 0.0.2 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 18deacceaca3890caa99490258ed690811809046
4
- data.tar.gz: e2fc734a73eb86aa383fb8aea34d67115d172077
3
+ metadata.gz: 70d0ed119d1db1f582739a0c79a67738d70868da
4
+ data.tar.gz: 6ee519436aab9d5aacfb09fa9e33c01cbd290ed9
5
5
  SHA512:
6
- metadata.gz: c403ed3564b6cfee20be9ea3da31f1b2dd754c86af188f99cddf2664c30f33dc0c7ad350538cc785157dcdfc52675169a35859295420dbd576a171513d742bd2
7
- data.tar.gz: b631cd59c8fc6cf95e1c2eb23f42212da10033256e4ae1176ed0ed05c5ad0a2ee1600a00fedce1951fcee69557dbe33a44eb451fb1fbf4a004534731148d6141
6
+ metadata.gz: 58570d882766488334b815965e85713b25efd6398901fe7288302d1c623db36f03f371f572c37f44042f1169699396631fb9fe34c4dc8fb2872fb9836c62bee1
7
+ data.tar.gz: 4f6ebe2ec90c0b33b43d033c21f1b3a1b4a219aef84760956f366895f9d903a8384f60e9512242f8506c6c647ecc04fe74b001aad7e44a01a235af1a79d8b989
data/.travis.yml CHANGED
@@ -1,3 +1,5 @@
1
1
  language: ruby
2
2
  rvm:
3
3
  - 2.1.0
4
+ - 2.0.0
5
+ - 1.9.3
data/README.md CHANGED
@@ -1,20 +1,26 @@
1
1
  # Capistrano::Graphite
2
2
  [![Gem Version](http://img.shields.io/gem/v/capistrano-graphite.svg)][gem]
3
+ [![Dependency Status](http://img.shields.io/gemnasium/scottsuch/capistrano-graphite.svg)][gemnasium]
3
4
  [![Build Status](http://img.shields.io/travis/scottsuch/capistrano-graphite.svg)][travis]
4
5
  [![Code Climate](http://img.shields.io/codeclimate/github/scottsuch/capistrano-graphite.svg)][codeclimate]
5
6
 
6
7
  [gem]: https://rubygems.org/gems/capistrano-graphite
8
+ [gemnasium]: https://gemnasium.com/scottsuch/capistrano-graphite
7
9
  [travis]: http://travis-ci.org/scottsuch/capistrano-graphite
8
- [codeclimate]: https://codeclimate.com/githubscottsuch/capistrano-graphite
9
- This gem extends capistrano's deploy functionality by pushing events to graphite.
10
+ [codeclimate]: https://codeclimate.com/github/scottsuch/capistrano-graphite
11
+ This gem works with Capistrano v3.1.0 and above and was based off the work on [this gem](For a gem that works with older versions of Capistrano look [here](https://github.com/hellvinz/graphite-notify) which works with Capistrano v2.x.
12
+
13
+ Adding this gem to [Capistrano](https://github.com/capistrano/capistrano) deploy extends functionality by pushing events to graphite.
10
14
  Currently events are only pushed after ```deploy:updated``` and ```deploy:reverted```.
11
- Some information on events can be found in [this nice writeup](http://obfuscurity.com/2014/01/Graphite-Tip-A-Better-Way-to-Store-Events).
12
- This gem works with capistrano v3.1.0 and above.
13
- For a gem that works with older versions of capistrano go [here](https://github.com/hellvinz/graphite-notify).
15
+
16
+ Some information on events can be found in [this article](http://obfuscurity.com/2014/01/Graphite-Tip-A-Better-Way-to-Store-Events).
14
17
 
15
18
  ## Installation
19
+ Install it manually:
16
20
 
17
- Add this line to your application's Gemfile:
21
+ $ gem install capistrano-graphite
22
+
23
+ Otherwise, add this line to your application's Gemfile:
18
24
 
19
25
  gem 'capistrano-graphite'
20
26
 
@@ -22,23 +28,29 @@ And then execute:
22
28
 
23
29
  $ bundle
24
30
 
25
- Or install it yourself as:
31
+ ## Usage
32
+ ### Setup your application
33
+ Add the following line to your ```Capfile```.
34
+
35
+ require "capistrano/graphite"
26
36
 
27
- $ gem install capistrano-graphite
37
+ ### Configurable options
38
+ Path to your graphite instance
28
39
 
29
- ## Usage
40
+ set :graphite_url, "http://example.com:8000/events/" # The port distinction is optional
30
41
 
31
- Require in ```Capfile``` to use the default tasks:
42
+ Disable sending events for a particular stage by setting the following to 0
32
43
 
33
- require "capistrano/graphite"
44
+ set :graphite_enable_events, 0 # This is set to 1 by default
34
45
 
35
- Configurable options
46
+ ### Test that it's working
47
+ You can run the following on it's own assuming you have configured the graphite url
36
48
 
37
- set :graphite_url, "http://example.com:8000/events/"
49
+ $ bundle exec cap <stage> deploy:graphite_deploy
38
50
 
39
51
  ## Contributing
40
52
 
41
- 1. Fork it ( https://github.com/[my-github-username]/capistrano-graphite/fork )
53
+ 1. Fork it
42
54
  2. Create your feature branch (`git checkout -b my-new-feature`)
43
55
  3. Commit your changes (`git commit -am 'Add some feature'`)
44
56
  4. Push to the branch (`git push origin my-new-feature`)
@@ -8,13 +8,16 @@ Gem::Specification.new do |spec|
8
8
  spec.version = Capistrano::Graphite::VERSION
9
9
  spec.authors = ["scottsuch"]
10
10
  spec.email = ["sgorsuch@gmail.com"]
11
- spec.summary = %q{Send deploy events to graphite via capistrano}
11
+ spec.summary = %q{A gem for pushing graphite events via capistrano v3
12
+ deployment}
12
13
  spec.description = %q{This gem plugs into the deploy task in capistrano to
13
14
  help provide visibility to when deployments were
14
15
  deployed.}
15
16
  spec.homepage = "https://github.com/scottsuch/capistrano-graphite"
16
17
  spec.license = "MIT"
17
18
 
19
+ spec.required_ruby_version = '> 1.9'
20
+
18
21
  spec.files = `git ls-files -z`.split("\x0")
19
22
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
20
23
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
@@ -4,24 +4,34 @@ require 'uri'
4
4
 
5
5
  set :local_user, ENV['USER']
6
6
 
7
- namespace :deploy do
8
- desc 'notify graphite that a deployment occured'
9
- task :graphite_deploy do
7
+ class GraphiteInterface
8
+ def self.post_event(action)
10
9
  uri = URI::parse("#{fetch(:graphite_url)}")
11
10
  Net::HTTP.start(uri.host, uri.port) do |http|
12
- http.post(uri.path, "{\"what\": \"deploy #{fetch(:application)} in #{fetch(:stage)}\", \"tags\": \"#{fetch(:application)},#{fetch(:stage)},#{release_timestamp},deploy\", \"data\": \"#{fetch(:local_user)}\"}")
11
+ http.post(uri.path, "{\"what\": \"#{action} #{fetch(:application)} in #{fetch(:stage)}\", \"tags\": \"#{fetch(:application)},#{fetch(:stage)},#{release_timestamp},#{action}\", \"data\": \"#{fetch(:local_user)}\"}")
13
12
  end
14
13
  end
14
+ end
15
+
16
+ namespace :deploy do
17
+ desc 'notify graphite that a deployment occured'
18
+ task :graphite_deploy do
19
+ action = "deploy"
20
+ GraphiteInterface.post_event(action)
21
+ end
15
22
 
16
23
  desc 'notify graphite that a rollback occured'
17
24
  task :graphite_rollback do
18
- uri = URI::parse("#{fetch(:graphite_url)}")
19
- Net::HTTP.start(uri.host, uri.port) do |http|
20
- http.post(uri.path, "{\"what\": \"rollback #{fetch(:application)} in #{fetch(:stage)}\", \"tags\": \"#{fetch(:application)},#{fetch(:stage)},#{release_timestamp},rollback\", \"data\": \"#{fetch(:local_user)}\"}")
21
- end
25
+ action = "rollback"
26
+ GraphiteInterface.post_event(action)
22
27
  end
23
28
 
24
- # Set the order for these tasks
25
- after 'deploy:updated', 'deploy:graphite_deploy'
26
- after 'deploy:reverted', 'deploy:graphite_rollback'
29
+ # Check the graphite_enable_events option
30
+ if "#{fetch(:graphite_enable_events)}".to_i == 0
31
+ puts "No events will be sent to graphite."
32
+ else
33
+ # Set the order for these tasks
34
+ after 'deploy:updated', 'deploy:graphite_deploy'
35
+ after 'deploy:reverted', 'deploy:graphite_rollback'
36
+ end
27
37
  end
@@ -1,5 +1,5 @@
1
1
  module Capistrano
2
2
  module Graphite
3
- VERSION = "0.0.2"
3
+ VERSION = "0.1.0"
4
4
  end
5
5
  end
data/spec/README.md CHANGED
@@ -1,2 +1 @@
1
1
  TODO: Add test
2
-
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.0.2
4
+ version: 0.1.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-04-17 00:00:00.000000000 Z
11
+ date: 2014-04-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -82,9 +82,9 @@ require_paths:
82
82
  - lib
83
83
  required_ruby_version: !ruby/object:Gem::Requirement
84
84
  requirements:
85
- - - ">="
85
+ - - ">"
86
86
  - !ruby/object:Gem::Version
87
- version: '0'
87
+ version: '1.9'
88
88
  required_rubygems_version: !ruby/object:Gem::Requirement
89
89
  requirements:
90
90
  - - ">="
@@ -95,7 +95,7 @@ rubyforge_project:
95
95
  rubygems_version: 2.2.2
96
96
  signing_key:
97
97
  specification_version: 4
98
- summary: Send deploy events to graphite via capistrano
98
+ summary: A gem for pushing graphite events via capistrano v3 deployment
99
99
  test_files:
100
100
  - spec/README.md
101
101
  has_rdoc: