graphite-notify 0.0.3 → 0.0.5

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.
@@ -0,0 +1,8 @@
1
+ Style/LineLength:
2
+ Max: 110
3
+ Exclude:
4
+ - spec/capistrano_spec.rb
5
+
6
+ # Enforce Ruby 1.8.7 compatible syntax
7
+ HashSyntax:
8
+ EnforcedStyle: hash_rockets
@@ -1 +1 @@
1
- 1.9.3-p327
1
+ 1.9.3-p551
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.0.5
4
+
5
+ * allow https graphite urls (thanks @gwilym)
6
+
7
+ ## 0.0.4
8
+
9
+ * Add MIT license
10
+
3
11
  ## 0.0.3
4
12
 
5
13
  * ruby 2.0 compatibility (kovyrin)
data/Gemfile CHANGED
@@ -1,3 +1,3 @@
1
- source :rubygems
1
+ source 'https://rubygems.org'
2
2
 
3
3
  gemspec
data/README.md CHANGED
@@ -26,3 +26,6 @@ As it is a capistrano task you can call it directly:
26
26
  cap graphite:notify_deploy
27
27
  ```
28
28
 
29
+ ## License
30
+
31
+ graphite-notify is released under the [MIT License](http://www.opensource.org/licenses/MIT).
data/Rakefile CHANGED
@@ -10,5 +10,4 @@ begin
10
10
  require 'rspec/core/rake_task'
11
11
  RSpec::Core::RakeTask.new(:spec)
12
12
  task :default => :spec
13
- rescue LoadError
14
13
  end
@@ -1,31 +1,33 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  lib = File.expand_path('../lib/', __FILE__)
3
- $:.unshift lib unless $:.include?(lib)
3
+ $LOAD_PATH.unshift lib unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  require 'graphite-notify/version'
6
6
 
7
7
  Gem::Specification.new do |s|
8
- s.name = "graphite-notify"
8
+ s.name = 'graphite-notify'
9
9
  s.version = GraphiteNotify::VERSION
10
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}
11
+ s.authors = ['Vincent Hellot']
12
+ s.email = ['hellvinz@gmail.com']
13
+ s.homepage = 'https://github.com/hellvinz/graphite-notify'
14
+ s.summary = 'notify graphite on deploy or rollback'
15
+ s.description = 'notify graphite on deploy or rollback'
16
+ s.license = 'MIT'
16
17
 
17
- s.required_ruby_version = ">= 1.8.7"
18
- s.required_rubygems_version = ">= 1.3.6"
18
+ s.required_ruby_version = '>= 1.8.7'
19
+ s.required_rubygems_version = '>= 1.3.6'
19
20
 
20
- git_files = `git ls-files`.split("\n") rescue ''
21
+ git_files = `git ls-files`.split("\n")
21
22
  s.files = git_files
22
- s.require_paths = ["lib"]
23
+ s.require_paths = ['lib']
23
24
 
24
- s.add_dependency "capistrano"
25
- s.add_development_dependency "rake"
26
- s.add_development_dependency "rspec", "~> 2.14"
27
- s.add_development_dependency "webmock", "~> 1.13"
28
- s.add_development_dependency "capistrano-spec", "~>0.6"
29
- s.add_development_dependency "yard"
30
- s.add_development_dependency "redcarpet", "~>2.3.0"
25
+ s.add_dependency 'capistrano', '<3'
26
+ s.add_dependency 'json', '<3'
27
+ s.add_development_dependency 'rake'
28
+ s.add_development_dependency 'rspec', '~> 2.14'
29
+ s.add_development_dependency 'webmock', '~> 1.20.4'
30
+ s.add_development_dependency 'capistrano-spec', '~>0.6.3'
31
+ s.add_development_dependency 'yard'
32
+ s.add_development_dependency 'redcarpet', '~>2.3.0'
31
33
  end
@@ -1,43 +1,64 @@
1
1
  require 'net/http'
2
2
  require 'capistrano'
3
3
  require 'uri'
4
+ require 'json'
4
5
 
5
6
  module Capistrano
6
7
  module Graphite
7
- # Called when a Capistrano::Configuration.instance exists. Will define two tasks:
8
- # * graphite:notify_deploy to notify graphite that a deploy occured with the app, the user, the stage in tags and message
9
- # * graphite:notify_restart to notify graphite that a rollback occured with the app, the user, the stage in tags and message
8
+ # Called when a Capistrano::Configuration.instance exists. Will define two tasks:
9
+ # * graphite:notify_deploy notify graphite of an app deploy with the user in tags and a message
10
+ # * graphite:notify_restart notify graphite of an app rollback with the user in tags and a message
10
11
  # @param [Capistrano::Configuration] configuration the current capistrano configuration instance
11
12
  def self.load_into(configuration)
12
13
  configuration.load do
13
14
 
14
- after "deploy:restart", "graphite:notify_deploy"
15
- after "rollback:restart", "graphite:notify_rollback"
15
+ after 'deploy:restart', 'graphite:notify_deploy'
16
+ after 'rollback:restart', 'graphite:notify_rollback'
16
17
 
17
18
  local_user = ENV['USER'] || ENV['USERNAME']
18
19
 
19
20
  namespace :graphite do
20
21
  desc 'notify graphite that a deployment occured'
21
22
  task :notify_deploy, :on_error => :continue do
22
- uri = URI::parse(graphite_url)
23
- Net::HTTP.start(uri.host, uri.port) do |http|
24
- if respond_to?(:stage)
25
- http.post(uri.path, "{\"what\": \"deploy #{application} in #{stage}\", \"tags\": \"#{application},#{stage},#{real_revision},deploy\", \"data\": \"#{local_user}\"}")
26
- else
27
- http.post(uri.path, "{\"what\": \"deploy #{application}\", \"tags\": \"#{application},#{real_revision},deploy\", \"data\": \"#{local_user}\"}")
23
+ uri = URI(graphite_url)
24
+ http = Net::HTTP.new(uri.host, uri.port)
25
+ http.use_ssl = true if uri.scheme == 'https'
26
+ begin
27
+ http.start do |h|
28
+ if respond_to?(:stage)
29
+ h.post(uri.path, { 'what' => "deploy #{application} in #{stage}",
30
+ 'tags' => "#{application},#{stage},#{real_revision},deploy",
31
+ 'data' => "#{local_user}" }.to_json)
32
+ else
33
+ h.post(uri.path, { 'what' => "deploy #{application}",
34
+ 'tags' => "#{application},#{real_revision},deploy",
35
+ 'data' => "#{local_user}" }.to_json)
36
+ end
28
37
  end
38
+ rescue => e
39
+ puts "graphite:notify_deploy failed: #{e.message}"
29
40
  end
30
41
  end
31
42
 
32
43
  desc 'notify graphite that a rollback occured'
33
44
  task :notify_rollback, :on_error => :continue do
34
- uri = URI::parse(graphite_url)
35
- Net::HTTP.start(uri.host, uri.port) do |http|
36
- if respond_to?(:stage)
37
- http.post(uri.path, "{\"what\": \"rollback #{application} in #{stage}\", \"tags\": \"#{application},#{stage},#{real_revision},rollback\", \"data\": \"#{local_user}\"}")
38
- else
39
- http.post(uri.path, "{\"what\": \"rollback #{application}\", \"tags\": \"#{application},#{real_revision},rollback\", \"data\": \"#{local_user}\"}")
45
+ uri = URI(graphite_url)
46
+ http = Net::HTTP.new(uri.host, uri.port)
47
+ http.use_ssl = true if uri.scheme == 'https'
48
+ begin
49
+ http.start do |h|
50
+ if respond_to?(:stage)
51
+ h.post(uri.path, { 'what' => "rollback #{application} in #{stage}",
52
+ 'tags' => "#{application},#{stage},#{real_revision},rollback",
53
+ 'data' => "#{local_user}" }.to_json)
54
+ else
55
+ h.post(uri.path, { 'what' => "rollback #{application}",
56
+ 'tags' => "#{application},#{real_revision},rollback",
57
+ 'data' => "#{local_user}" }.to_json)
58
+ end
40
59
  end
60
+ rescue => e
61
+ puts "graphite:notify_rollback failed: #{e.message}"
41
62
  end
42
63
  end
43
64
  end
@@ -1,3 +1,3 @@
1
1
  module GraphiteNotify
2
- VERSION = "0.0.3"
2
+ VERSION = '0.0.5'
3
3
  end
@@ -2,7 +2,7 @@ require 'spec_helper'
2
2
 
3
3
  require './lib/graphite-notify/capistrano'
4
4
 
5
- describe Capistrano::Graphite, "loaded into a configuration" do
5
+ describe Capistrano::Graphite, 'loaded into a configuration' do
6
6
  before do
7
7
  ENV['USER'] = 'testuser'
8
8
  @configuration = Capistrano::Configuration.new
@@ -19,17 +19,17 @@ describe Capistrano::Graphite, "loaded into a configuration" do
19
19
 
20
20
  context 'without capistrano-multistage support' do
21
21
  it 'should notify graphite of a deploy' do
22
- stub_request(:post, "http://localhost/").
23
- with(:body => "{\"what\": \"deploy testapp\", \"tags\": \"testapp,randomsha,deploy\", \"data\": \"testuser\"}").
24
- to_return(:status => 200, :body => "", :headers => {})
22
+ stub_request(:post, 'http://localhost/').
23
+ with(:body => {"what"=>"deploy testapp","tags"=>"testapp,randomsha,deploy","data"=>"testuser"}.to_json).
24
+ to_return(:status => 200, :body => '', :headers => {})
25
25
  @configuration.find_and_execute_task('graphite:notify_deploy')
26
26
 
27
27
  end
28
28
 
29
29
  it 'should notify graphite of a rollback' do
30
- stub_request(:post, "http://localhost/").
31
- with(:body => "{\"what\": \"rollback testapp\", \"tags\": \"testapp,randomsha,rollback\", \"data\": \"testuser\"}").
32
- to_return(:status => 200, :body => "", :headers => {})
30
+ stub_request(:post, 'http://localhost/').
31
+ with(:body => {"what"=>"rollback testapp","tags"=>"testapp,randomsha,rollback","data"=>"testuser"}.to_json).
32
+ to_return(:status => 200, :body => '', :headers => {})
33
33
  @configuration.find_and_execute_task('graphite:notify_rollback')
34
34
  end
35
35
  end
@@ -39,17 +39,17 @@ describe Capistrano::Graphite, "loaded into a configuration" do
39
39
  @configuration.set :stage, 'test'
40
40
  end
41
41
  it 'should notify graphite of a deploy' do
42
- stub_request(:post, "http://localhost/").
43
- with(:body => "{\"what\": \"deploy testapp in test\", \"tags\": \"testapp,test,randomsha,deploy\", \"data\": \"testuser\"}").
44
- to_return(:status => 200, :body => "", :headers => {})
42
+ stub_request(:post, 'http://localhost/').
43
+ with(:body => {"what"=>"deploy testapp in test","tags"=>"testapp,test,randomsha,deploy","data"=>"testuser"}.to_json).
44
+ to_return(:status => 200, :body => '', :headers => {})
45
45
  @configuration.find_and_execute_task('graphite:notify_deploy')
46
46
 
47
47
  end
48
48
 
49
49
  it 'should notify graphite of a rollback' do
50
- stub_request(:post, "http://localhost/").
51
- with(:body => "{\"what\": \"rollback testapp in test\", \"tags\": \"testapp,test,randomsha,rollback\", \"data\": \"testuser\"}").
52
- to_return(:status => 200, :body => "", :headers => {})
50
+ stub_request(:post, 'http://localhost/').
51
+ with(:body => {"what"=>"rollback testapp in test","tags"=>"testapp,test,randomsha,rollback","data"=>"testuser"}.to_json).
52
+ to_return(:status => 200, :body => '', :headers => {})
53
53
  @configuration.find_and_execute_task('graphite:notify_rollback')
54
54
  end
55
55
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: graphite-notify
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,24 +9,40 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-09-27 00:00:00.000000000 Z
12
+ date: 2014-11-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: capistrano
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
- - - ! '>='
19
+ - - <
20
20
  - !ruby/object:Gem::Version
21
- version: '0'
21
+ version: '3'
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  none: false
26
26
  requirements:
27
- - - ! '>='
27
+ - - <
28
28
  - !ruby/object:Gem::Version
29
- version: '0'
29
+ version: '3'
30
+ - !ruby/object:Gem::Dependency
31
+ name: json
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - <
36
+ - !ruby/object:Gem::Version
37
+ version: '3'
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - <
44
+ - !ruby/object:Gem::Version
45
+ version: '3'
30
46
  - !ruby/object:Gem::Dependency
31
47
  name: rake
32
48
  requirement: !ruby/object:Gem::Requirement
@@ -66,7 +82,7 @@ dependencies:
66
82
  requirements:
67
83
  - - ~>
68
84
  - !ruby/object:Gem::Version
69
- version: '1.13'
85
+ version: 1.20.4
70
86
  type: :development
71
87
  prerelease: false
72
88
  version_requirements: !ruby/object:Gem::Requirement
@@ -74,7 +90,7 @@ dependencies:
74
90
  requirements:
75
91
  - - ~>
76
92
  - !ruby/object:Gem::Version
77
- version: '1.13'
93
+ version: 1.20.4
78
94
  - !ruby/object:Gem::Dependency
79
95
  name: capistrano-spec
80
96
  requirement: !ruby/object:Gem::Requirement
@@ -82,7 +98,7 @@ dependencies:
82
98
  requirements:
83
99
  - - ~>
84
100
  - !ruby/object:Gem::Version
85
- version: '0.6'
101
+ version: 0.6.3
86
102
  type: :development
87
103
  prerelease: false
88
104
  version_requirements: !ruby/object:Gem::Requirement
@@ -90,7 +106,7 @@ dependencies:
90
106
  requirements:
91
107
  - - ~>
92
108
  - !ruby/object:Gem::Version
93
- version: '0.6'
109
+ version: 0.6.3
94
110
  - !ruby/object:Gem::Dependency
95
111
  name: yard
96
112
  requirement: !ruby/object:Gem::Requirement
@@ -131,6 +147,7 @@ extensions: []
131
147
  extra_rdoc_files: []
132
148
  files:
133
149
  - .gitignore
150
+ - .rubocop.yml
134
151
  - .ruby-version
135
152
  - .travis.yml
136
153
  - Changelog.md
@@ -145,7 +162,8 @@ files:
145
162
  - spec/spec.opts
146
163
  - spec/spec_helper.rb
147
164
  homepage: https://github.com/hellvinz/graphite-notify
148
- licenses: []
165
+ licenses:
166
+ - MIT
149
167
  post_install_message:
150
168
  rdoc_options: []
151
169
  require_paths:
@@ -164,7 +182,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
164
182
  version: 1.3.6
165
183
  requirements: []
166
184
  rubyforge_project:
167
- rubygems_version: 1.8.23
185
+ rubygems_version: 1.8.23.2
168
186
  signing_key:
169
187
  specification_version: 3
170
188
  summary: notify graphite on deploy or rollback