deputy 0.1.14 → 0.1.15
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/deputy.gemspec +2 -2
- data/lib/deputy.rb +14 -7
- data/spec/deputy_spec.rb +1 -0
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.15
|
data/deputy.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{deputy}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.15"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Michael Grosser"]
|
12
|
-
s.date = %q{2010-06-
|
12
|
+
s.date = %q{2010-06-05}
|
13
13
|
s.default_executable = %q{deputy}
|
14
14
|
s.email = %q{mirko@dawanda.com}
|
15
15
|
s.executables = ["deputy"]
|
data/lib/deputy.rb
CHANGED
@@ -13,11 +13,15 @@ class Scout
|
|
13
13
|
class Plugin
|
14
14
|
OPTIONS = {}.to_yaml
|
15
15
|
|
16
|
+
def self.clean_class_name
|
17
|
+
to_s.split('::')[1..-1].join('::')
|
18
|
+
end
|
19
|
+
|
16
20
|
protected
|
17
21
|
|
18
22
|
def report(metrics)
|
19
23
|
metrics.each do |key, value|
|
20
|
-
Deputy.send_report "#{clean_class_name}.#{key}", value
|
24
|
+
Deputy.send_report "#{self.class.clean_class_name}.#{key}", value
|
21
25
|
end
|
22
26
|
end
|
23
27
|
|
@@ -46,11 +50,7 @@ class Scout
|
|
46
50
|
end
|
47
51
|
|
48
52
|
def memory_file
|
49
|
-
"/tmp/deputy.memory.#{clean_class_name}.yml"
|
50
|
-
end
|
51
|
-
|
52
|
-
def clean_class_name
|
53
|
-
self.class.to_s.split('::')[1..-1].join('::')
|
53
|
+
"/tmp/deputy.memory.#{self.class.clean_class_name}.yml"
|
54
54
|
end
|
55
55
|
|
56
56
|
# stub options for now...
|
@@ -89,8 +89,15 @@ module Deputy
|
|
89
89
|
|
90
90
|
Scout.plugins(content).each do |interval, plugin|
|
91
91
|
run_every_n_minutes = interval/60
|
92
|
-
|
92
|
+
minutes_to_wait = START_MINUTE % run_every_n_minutes
|
93
|
+
if minutes_to_wait == 0
|
94
|
+
puts "#{plugin.clean_class_name}: running"
|
95
|
+
plugin.new.build_report
|
96
|
+
else
|
97
|
+
puts "#{plugin.clean_class_name}: waiting another #{minutes_to_wait} minutes"
|
98
|
+
end
|
93
99
|
end
|
100
|
+
send_report 'Deputies', 'finished'
|
94
101
|
rescue Exception => e
|
95
102
|
send_report "Deputies.Error", e.message
|
96
103
|
raise e
|
data/spec/deputy_spec.rb
CHANGED
@@ -123,6 +123,7 @@ describe Deputy do
|
|
123
123
|
$notify = 0
|
124
124
|
Deputy.stub!(:sheriff_url).and_return 'http://sheri.ff'
|
125
125
|
FakeWeb.register_uri(:get, "http://sheri.ff/plugins.rb", :body => klass('C', :code => '$notify=1'))
|
126
|
+
FakeWeb.register_uri(:get, "http://sheri.ff/report/Deputies?value=finished", :body => 'OK')
|
126
127
|
Deputy.run_plugins
|
127
128
|
$notify.should == 1
|
128
129
|
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
version: 0.1.
|
8
|
+
- 15
|
9
|
+
version: 0.1.15
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Michael Grosser
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-06-
|
17
|
+
date: 2010-06-05 00:00:00 +02:00
|
18
18
|
default_executable: deputy
|
19
19
|
dependencies: []
|
20
20
|
|