deputy 0.1.55 → 0.1.56

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.55
1
+ 0.1.56
data/deputy.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{deputy}
8
- s.version = "0.1.55"
8
+ s.version = "0.1.56"
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"]
data/lib/deputy.rb CHANGED
@@ -5,7 +5,11 @@ require "socket"
5
5
 
6
6
  def eval_and_fetch_constants(x)
7
7
  old = Module.constants.map{|c| c.to_s}
8
- eval(x)
8
+ begin
9
+ eval(x)
10
+ rescue Exception => e
11
+ raise e unless Deputy.config['silent_on_errors']
12
+ end
9
13
  new = (Module.constants.map{|c| c.to_s} - old)
10
14
  new = new.select{|c| c.to_s =~ /^TEMP/ } # do not fetch required libs, just user-defined
11
15
  new.map{|c| const_get(c) }
data/spec/deputy_spec.rb CHANGED
@@ -237,11 +237,17 @@ describe Deputy do
237
237
  FakeWeb.register_uri(:get, "http://sheri.ff/notify?group=Xxx.yy%3Fy&value=123&hostname=general&forced_host=true", :body => 'OK')
238
238
  Deputy.send_report('Xxx.yy?y', '123', {:host => 'general'}).should == 'OK'
239
239
  end
240
-
240
+
241
241
  it "does nothing, if disabled" do
242
242
  Deputy.stub!(:config).and_return "disabled" => true
243
243
  Deputy.send_report('Xxx.yy?y', '123', {:host => 'general'}).should == nil
244
244
  end
245
+
246
+ it "does not reraise if silent_on_errors configured" do
247
+ Deputy.config['silent_on_errors'] = true
248
+ FakeWeb.register_uri(:get, "http://sheri.ff/notify?group=Xxx.yy%3Fy&value=123&hostname=general&forced_host=true", :body => 'ERROR', :status => ["500", "Internal Server Error"])
249
+ Deputy.send_report('Xxx.yy?y', '123', {:host => 'general'}).should == nil
250
+ end
245
251
  end
246
252
 
247
253
  describe :extract_auth_from_url! do
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: deputy
3
3
  version: !ruby/object:Gem::Version
4
- hash: 117
4
+ hash: 107
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 55
10
- version: 0.1.55
9
+ - 56
10
+ version: 0.1.56
11
11
  platform: ruby
12
12
  authors:
13
13
  - Michael Grosser