graphite-notify 0.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.
data/.gitignore ADDED
@@ -0,0 +1,2 @@
1
+ .git
2
+ *.swp
data/README.md ADDED
@@ -0,0 +1,30 @@
1
+ # Graphite Notify
2
+
3
+ Send deployment events to graphite
4
+
5
+ More information about events https://code.launchpad.net/~lucio.torre/graphite/add-events/+merge/69142
6
+
7
+ ## Installation
8
+
9
+ Add this to your deploy.rb file:
10
+
11
+ ```
12
+ set :graphite_url, "your/graphite/event/url"
13
+ require "graphite-notify/capistrano"
14
+ ```
15
+
16
+ ## Requirements
17
+
18
+ graphite: http://readthedocs.org/docs/graphite
19
+
20
+ curl: http://curl.haxx.se/
21
+
22
+
23
+ ## Tricks
24
+
25
+ As it is a capistrano task you can call it directly:
26
+
27
+ ```
28
+ cap graphite:notify_deploy
29
+ ```
30
+
@@ -0,0 +1,23 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib/', __FILE__)
3
+ $:.unshift lib unless $:.include?(lib)
4
+
5
+ require 'graphite-notify/version'
6
+
7
+ Gem::Specification.new do |s|
8
+ s.name = "graphite-notify"
9
+ s.version = GraphiteNotify::VERSION
10
+ s.platform = Gem::Platform::RUBY
11
+ s.authors = ["Vincent Hellot"]
12
+ s.email = ["hellvinz@gmail.com"]
13
+ s.homepage = "https://github.com/hellvinz/graphite-notify"
14
+ s.summary = %q{notify graphite on deploy or rollback}
15
+ s.description = %q{notify graphite on deploy or rollback}
16
+
17
+ s.required_ruby_version = ">= 1.8.7"
18
+ s.required_rubygems_version = ">= 1.3.6"
19
+
20
+ git_files = `git ls-files`.split("\n") rescue ''
21
+ s.files = git_files
22
+ s.require_paths = ["lib"]
23
+ end
@@ -0,0 +1,9 @@
1
+ # Just add "require 'graphite-notify/capistrano'" in your Capistrano deploy.rb, and
2
+ # Bundler will be activated after each new deployment.
3
+ require 'graphite-notify/deployment'
4
+
5
+ Capistrano::Configuration.instance(:must_exist).load do
6
+ after "deploy:restart", "graphite:notify_deploy"
7
+ after "rollback:restart", "graphite:notify_rollback"
8
+ GraphiteNotify::Deployment.define_task(self, :task, :except => { :no_release => true })
9
+ end
@@ -0,0 +1,39 @@
1
+ module GraphiteNotify
2
+ class Deployment
3
+ def self.define_task(context, task_method = :task, opts = {})
4
+ if defined?(Capistrano) && context.is_a?(Capistrano::Configuration)
5
+ context_name = "capistrano"
6
+ role_default = "{:except => {:no_release => true}}"
7
+ error_type = ::Capistrano::CommandError
8
+ end
9
+
10
+ graphite_url = context.fetch(:graphite_url, false)
11
+ raise "Missing graphite_url" unless graphite_url
12
+
13
+ local_user = ENV['USER'] || ENV['USERNAME']
14
+
15
+ context.send :namespace, :graphite do
16
+ send :desc, <<-DESC
17
+ notify graphite that a deployment occured
18
+ DESC
19
+ send task_method, :notify_deploy, :on_error => :continue do
20
+ if exists?(:stage)
21
+ `curl -s -X POST #{graphite_url} -d '{"what": "deploy #{application} in #{stage}", "tags": "#{application},#{stage},#{real_revision},deploy", "data": "#{local_user}"}'`
22
+ else
23
+ `curl -s -X POST #{graphite_url} -d '{"what": "deploy #{application}", "tags": "#{application},#{real_revision},deploy", "data": "#{local_user}"}'`
24
+ end
25
+ end
26
+ send :desc, <<-DESC
27
+ notify graphite that a rollback occured
28
+ DESC
29
+ send task_method, :notify_rollback, :on_error => :continue do
30
+ if exists?(:stage)
31
+ `curl -s -X POST #{graphite_url} -d '{"what": "rollback #{application} in #{environment}", "tags": "#{application},#{stage},#{real_revision},rollback", "data": "#{local_user}"}'`
32
+ else
33
+ `curl -s -X POST #{graphite_url} -d '{"what": "rollback #{application}", "tags": "#{application},#{real_revision},rollback", "data": "#{local_user}"}'`
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,3 @@
1
+ module GraphiteNotify
2
+ VERSION = "0.0.1"
3
+ end
File without changes
metadata ADDED
@@ -0,0 +1,73 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: graphite-notify
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 0
8
+ - 1
9
+ version: 0.0.1
10
+ platform: ruby
11
+ authors:
12
+ - Vincent Hellot
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2012-06-11 00:00:00 +02:00
18
+ default_executable:
19
+ dependencies: []
20
+
21
+ description: notify graphite on deploy or rollback
22
+ email:
23
+ - hellvinz@gmail.com
24
+ executables: []
25
+
26
+ extensions: []
27
+
28
+ extra_rdoc_files: []
29
+
30
+ files:
31
+ - .gitignore
32
+ - README.md
33
+ - graphite-notify.gemspec
34
+ - lib/graphite-notify.rb
35
+ - lib/graphite-notify/capistrano.rb
36
+ - lib/graphite-notify/deployment.rb
37
+ - lib/graphite-notify/version.rb
38
+ has_rdoc: true
39
+ homepage: https://github.com/hellvinz/graphite-notify
40
+ licenses: []
41
+
42
+ post_install_message:
43
+ rdoc_options: []
44
+
45
+ require_paths:
46
+ - lib
47
+ required_ruby_version: !ruby/object:Gem::Requirement
48
+ requirements:
49
+ - - ">="
50
+ - !ruby/object:Gem::Version
51
+ segments:
52
+ - 1
53
+ - 8
54
+ - 7
55
+ version: 1.8.7
56
+ required_rubygems_version: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ segments:
61
+ - 1
62
+ - 3
63
+ - 6
64
+ version: 1.3.6
65
+ requirements: []
66
+
67
+ rubyforge_project:
68
+ rubygems_version: 1.3.6
69
+ signing_key:
70
+ specification_version: 3
71
+ summary: notify graphite on deploy or rollback
72
+ test_files: []
73
+