capistrano-graphite 0.1.1 → 0.1.2

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: 68a94a89d4e982b560cacd16c846944e03e04662
4
- data.tar.gz: 1ddf9051f5e37c8f55ad9400bd42a267428b0f0a
3
+ metadata.gz: b3064da706a0c929279ccdb160222bdb763a6de2
4
+ data.tar.gz: 2fa7efd27c5dfdd3f6a1ac66d324444b7d53b1df
5
5
  SHA512:
6
- metadata.gz: b1e47d19d54e1f4552dd171ed9526be011fb2519101f35744e8a814883ed9decbfda0a6bdae3c08e89c71de17f1fd3c56058b525c678e5d9154beccfe103ff8e
7
- data.tar.gz: ed981c9daedcd7ab83e6a892f2c2382bd4dfa1b8cc41033ac3965cbd43b5c70c5434b46d182c239805feeeb192b6b2e55ec9d02f3150309311e18c661b7840f0
6
+ metadata.gz: aa2d1b97f587fbb3c2cb68e6a204afc966debecbf3b2d07d885d8c632e0895c94969055445f33a0a02b141e26bd53ae81579153afd4e901e694438b4bc18374d
7
+ data.tar.gz: 230e3deb13c40f8ebc9f630519332be8a87b49e541cb7f0c0178335a401e878a11baccf52b11c814397ac9ffff695353b2088896ec4b374bfad26883b4e33256
@@ -5,6 +5,19 @@ require 'uri'
5
5
  set :local_user, ENV['USER']
6
6
 
7
7
  class GraphiteInterface
8
+ def self.events_enabled
9
+ if fetch(:graphite_enable_events).to_i == 1
10
+ return 1
11
+ elsif fetch(:graphite_enable_events).to_i == 0
12
+ puts "Not sending an event: graphite_enable_events was set to 0."
13
+ return 0
14
+ else
15
+ warn "Not sending an event: graphite_enable_events was assigned an "\
16
+ "invalid value."
17
+ return
18
+ end
19
+ end
20
+
8
21
  def self.post_event(action)
9
22
  uri = URI::parse("#{fetch(:graphite_url)}")
10
23
  Net::HTTP.start(uri.host, uri.port) do |http|
@@ -13,10 +26,11 @@ class GraphiteInterface
13
26
  end
14
27
  end
15
28
 
29
+
16
30
  namespace :deploy do
17
31
  desc 'notify graphite that a deployment occured'
18
32
  task :graphite_deploy do
19
- if fetch(:graphite_enable_events).to_i == 1
33
+ if GraphiteInterface.events_enabled == 1
20
34
  action = "deploy"
21
35
  GraphiteInterface.post_event(action)
22
36
  end
@@ -24,7 +38,7 @@ namespace :deploy do
24
38
 
25
39
  desc 'notify graphite that a rollback occured'
26
40
  task :graphite_rollback do
27
- if fetch(:graphite_enable_events).to_i == 1
41
+ if GraphiteIntervace.events_enabled == 1
28
42
  action = "rollback"
29
43
  GraphiteInterface.post_event(action)
30
44
  end
@@ -34,3 +48,9 @@ namespace :deploy do
34
48
  after 'deploy:updated', 'deploy:graphite_deploy'
35
49
  after 'deploy:reverted', 'deploy:graphite_rollback'
36
50
  end
51
+
52
+ namespace :load do
53
+ task :defaults do
54
+ set :graphite_enable_events, 1
55
+ end
56
+ end
@@ -1,5 +1,5 @@
1
1
  module Capistrano
2
2
  module Graphite
3
- VERSION = "0.1.1"
3
+ VERSION = "0.1.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-graphite
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - scottsuch