stormtroopers 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -35,6 +35,9 @@ module Stormtroopers
35
35
  threads << Thread.new do
36
36
  begin
37
37
  trooper.run
38
+ rescue Exception => exception
39
+ logger.error("#{exception.message}:\n#{exception.backtrace.join("\n")}")
40
+ trooper.exception(exception)
38
41
  ensure
39
42
  if defined?(::Mongoid)
40
43
  ::Mongoid::IdentityMap.clear
@@ -1,3 +1,3 @@
1
1
  module Stormtroopers
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
3
3
  end
@@ -71,6 +71,24 @@ describe Stormtroopers::Army do
71
71
  army.run_trooper(trooper)
72
72
  end
73
73
 
74
+ it "calls trooper exception hook with the exception when trooper#run raises one" do
75
+ exception = StandardError.new
76
+ trooper = stub
77
+ trooper.stub(:run) { raise exception }
78
+ trooper.should_receive(:exception).with(exception)
79
+ Thread.should_receive(:new).and_yield
80
+ army.run_trooper(trooper)
81
+ end
82
+
83
+ it "calls logs the exceptions at error level when trooper#run raises one" do
84
+ exception = StandardError.new
85
+ trooper = stub.as_null_object
86
+ trooper.stub(:run) { raise exception }
87
+ army.logger.should_receive(:error)
88
+ Thread.should_receive(:new).and_yield
89
+ army.run_trooper(trooper)
90
+ end
91
+
74
92
  it "cleans up the Mongoid environment if Mongoid is defined" do
75
93
  stub_const("Mongoid", Class.new)
76
94
  stub_const("Mongoid::IdentityMap", Class.new)
@@ -15,6 +15,7 @@ Gem::Specification.new do |gem|
15
15
  gem.add_dependency('activesupport', '>= 3.2.0')
16
16
 
17
17
  gem.add_development_dependency('rspec')
18
+ gem.add_development_dependency('rake')
18
19
 
19
20
  gem.bindir = 'bin'
20
21
  gem.files = `git ls-files`.split($/)
metadata CHANGED
@@ -1,51 +1,65 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stormtroopers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
5
- prerelease:
4
+ version: 0.1.5
5
+ prerelease:
6
6
  platform: ruby
7
7
  authors:
8
8
  - Andre Meij
9
9
  - Mark Kremer
10
- autorequire:
10
+ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-11-20 00:00:00.000000000 Z
13
+ date: 2012-11-22 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport
17
- version_requirements: !ruby/object:Gem::Requirement
17
+ requirement: !ruby/object:Gem::Requirement
18
+ none: false
18
19
  requirements:
19
20
  - - ! '>='
20
21
  - !ruby/object:Gem::Version
21
22
  version: 3.2.0
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
22
26
  none: false
23
- requirement: !ruby/object:Gem::Requirement
24
27
  requirements:
25
28
  - - ! '>='
26
29
  - !ruby/object:Gem::Version
27
30
  version: 3.2.0
28
- none: false
29
- prerelease: false
30
- type: :runtime
31
31
  - !ruby/object:Gem::Dependency
32
32
  name: rspec
33
- version_requirements: !ruby/object:Gem::Requirement
33
+ requirement: !ruby/object:Gem::Requirement
34
+ none: false
34
35
  requirements:
35
36
  - - ! '>='
36
37
  - !ruby/object:Gem::Version
37
- version: !binary |-
38
- MA==
38
+ version: '0'
39
+ type: :development
40
+ prerelease: false
41
+ version_requirements: !ruby/object:Gem::Requirement
39
42
  none: false
40
- requirement: !ruby/object:Gem::Requirement
41
43
  requirements:
42
44
  - - ! '>='
43
45
  - !ruby/object:Gem::Version
44
- version: !binary |-
45
- MA==
46
+ version: '0'
47
+ - !ruby/object:Gem::Dependency
48
+ name: rake
49
+ requirement: !ruby/object:Gem::Requirement
46
50
  none: false
47
- prerelease: false
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
48
55
  type: :development
56
+ prerelease: false
57
+ version_requirements: !ruby/object:Gem::Requirement
58
+ none: false
59
+ requirements:
60
+ - - ! '>='
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
49
63
  description: ! 'Stormtroopers is a jruby execution environment for delayed jobs '
50
64
  email:
51
65
  - andre@socialreferral.com
@@ -86,28 +100,26 @@ files:
86
100
  - vagrant-provision
87
101
  homepage: http://github.com/socialreferral/stormtroopers
88
102
  licenses: []
89
- post_install_message:
103
+ post_install_message:
90
104
  rdoc_options: []
91
105
  require_paths:
92
106
  - lib
93
107
  required_ruby_version: !ruby/object:Gem::Requirement
108
+ none: false
94
109
  requirements:
95
110
  - - ! '>='
96
111
  - !ruby/object:Gem::Version
97
- version: !binary |-
98
- MA==
99
- none: false
112
+ version: '0'
100
113
  required_rubygems_version: !ruby/object:Gem::Requirement
114
+ none: false
101
115
  requirements:
102
116
  - - ! '>='
103
117
  - !ruby/object:Gem::Version
104
- version: !binary |-
105
- MA==
106
- none: false
118
+ version: '0'
107
119
  requirements: []
108
- rubyforge_project:
120
+ rubyforge_project:
109
121
  rubygems_version: 1.8.24
110
- signing_key:
122
+ signing_key:
111
123
  specification_version: 3
112
124
  summary: Execute delayed jobs in a threaded jruby environment
113
125
  test_files:
@@ -117,3 +129,4 @@ test_files:
117
129
  - spec/stormtroopers/manager_spec.rb
118
130
  - spec/stormtroopers/trooper/delayed_job_spec.rb
119
131
  - spec/stormtroopers/trooper_spec.rb
132
+ has_rdoc: