capistrano-graphite 1.0.3 → 1.0.4

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: b2c1f690fc5d7ed7909edf58dce04a3037200d0e
4
- data.tar.gz: 95ef00184776082bc7bc259eaaeeda993ab75a64
3
+ metadata.gz: 6eaec296dc80d5610159d2757c93f59a0c7cc0bf
4
+ data.tar.gz: 49b9598bf0b8d0feff72f56520dccd7785596d23
5
5
  SHA512:
6
- metadata.gz: 1b37ac4b8ecf1ee70ff9ee499c5ffe84b578ba0d9a39c46751b23dff4d48e4061727a2a65e4c6b4d9f364cc513a8601bdf213871be40cd36ff97b5e26dee62ca
7
- data.tar.gz: 629dd91c96526d18c8c64150ad5973d1f636a82845c87d687039a46fa14b7c2464e1abd7d414298026eece16fb0676f0fe53fed8e9aed11733c0220de9cde170
6
+ metadata.gz: 0c790ef4bdea8aacf3f8293c7350a4d774e5f2fca4eef0cf4195eed7893c5ee8ffa5d55f5a03d5b5123ead3db60632515439ce27d73f649e245b5386acbbc8b9
7
+ data.tar.gz: e3c519f1fde358e11ed0e804f71e7f66a9f2f144522ca933605436ec217addc9b6de4db9666f0cfa246630b3e20c6ec52ddefd071011ab0e66359bc88a78b63f
data/CHANGELOG.md CHANGED
@@ -1,30 +1,33 @@
1
- ## 1.0.3 (2015-01-08)
1
+ ## 1.0.4 (2015-02-26)
2
+ IMPROVEMENTS
3
+ - Allows for the overriding of graphite settings. [GH-28]
4
+ - Updates README.md with instructions for overrides.
2
5
 
6
+ ## 1.0.3 (2015-01-08)
7
+ BUG FIXES:
8
+ - Fix bad logic in suppress option. [GH-27]
3
9
 
10
+ IMPROVEMENTS
11
+ - Removed gem post install message.
12
+ - Safer setting of config values. [GH-24]
13
+ - Speedier builds via TravisCI Docker infrastructure. [GH-25]
4
14
 
5
15
  ## 1.0.2 (2014-11-19)
6
-
7
16
  BUG FIXES:
8
-
9
17
  - Fix bug introduced by [GH-17].
10
18
  - Fix issue where notification could be sent on failed deploy/rollback.
11
19
 
12
20
  IMPROVEMENTS:
13
-
14
21
  - Cleaner Rake syntax.
15
22
 
16
23
  ## 1.0.1 (2014-11-19)
17
-
18
24
  BUG FIXES:
19
-
20
25
  - Fix bug where multiple events were sent to graphite. [GH-18]
21
26
 
22
27
  IMPROVEMENTS:
23
-
24
28
  - Update test command example in README.md. [GH-19]
25
29
  - Lint entire project with RuboCop. [GH-17]
26
30
  - Add `rake` task to lint with RuboCop when Travis is run. [GH-17]
27
31
 
28
32
  ## Previous Versions
29
-
30
33
  Sorry, no true documentation was kept prior to 1.0.1.
data/README.md CHANGED
@@ -42,6 +42,17 @@ Disable sending events for a particular stage by setting the following:
42
42
 
43
43
  Note that the config `graphite_enable_events` was deprecated in version 1.0.0.
44
44
 
45
+ Optionally, override the rest of graphite settings:
46
+
47
+ set :graphite_event_user, ENV.fetch('USER', 'unknown')
48
+ set :graphite_event_data, -> { fetch(:graphite_event_user) }
49
+ set :graphite_event_tags, -> (action) do
50
+ [fetch(:application), fetch(:stage), release_timestamp, action].join(',')
51
+ end
52
+ set :graphite_event_msg, -> (action) do
53
+ "#{action} #{fetch(:application)} in #{fetch(:stage)}"
54
+ end
55
+
45
56
  ### Test that it's working
46
57
  You can run the following on it's own assuming you have configured the graphite url
47
58
 
@@ -12,15 +12,20 @@ class GraphiteInterface
12
12
  uri = URI.parse("#{fetch(:graphite_url)}")
13
13
  req = Net::HTTP::Post.new(uri.path)
14
14
  req.basic_auth(uri.user, uri.password) if uri.user
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)}\"}"
15
+ req.body = event(action).to_s
19
16
 
20
17
  Net::HTTP.start(uri.host, uri.port) do |http|
21
18
  http.request(req)
22
19
  end
23
20
  end
21
+
22
+ def event(action)
23
+ {
24
+ 'what' => fetch(:graphite_event_msg).call(action),
25
+ 'tags' => fetch(:graphite_event_tags).call(action),
26
+ 'data' => fetch(:graphite_event_data)
27
+ }
28
+ end
24
29
  end
25
30
 
26
31
  namespace :deploy do
@@ -50,7 +55,14 @@ end
50
55
 
51
56
  namespace :load do
52
57
  task :defaults do
53
- set_if_empty :suppress_graphite_events, 'false'
54
- set_if_empty :local_user, ENV['USER']
58
+ set :suppress_graphite_events, 'false'
59
+ set :graphite_event_user, ENV.fetch('USER', 'unknown')
60
+ set :graphite_event_data, -> { fetch(:graphite_event_user) }
61
+ set :graphite_event_tags, lambda do |action|
62
+ [fetch(:application), fetch(:stage), release_timestamp, action].join(',')
63
+ end
64
+ set :graphite_event_msg, lambda do |action|
65
+ "#{action} #{fetch(:application)} in #{fetch(:stage)}"
66
+ end
55
67
  end
56
68
  end
@@ -3,6 +3,6 @@
3
3
  module Capistrano
4
4
  # This module holds the capistrano-graphite version information.
5
5
  module Graphite
6
- VERSION = '1.0.3'
6
+ VERSION = '1.0.4'
7
7
  end
8
8
  end
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.3
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - scottsuch
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-08 00:00:00.000000000 Z
11
+ date: 2015-02-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capistrano