sisyphus 0.2.1 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/lib/sisyphus/worker.rb +3 -3
- data/lib/version.rb +1 -1
- data/spec/sisyphus/worker_spec.rb +6 -6
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 09c4ed5586564bbe862e247e22ade9cf3b8d0d91
|
|
4
|
+
data.tar.gz: 89cb27f90e6b9b62e7152cea92866ef3b88f83f1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1835644e1bb451fa689024a33fba8e1e12f2f6ce6ded605611b4564117ae09f0c67f58c749f984c271ef8eab2509da5f56f3c832e11a3fcf08036830c0503797
|
|
7
|
+
data.tar.gz: 823fb159c29104d485fa6f7320b2340de260fb36d463cd80096d3c78d45e275687d6b30ccf3c5dcdb238dfaabea886d9a9912ccc5e7f2a1ca2a1c3a948e007f0
|
data/Gemfile.lock
CHANGED
data/lib/sisyphus/worker.rb
CHANGED
|
@@ -16,7 +16,7 @@ module Sisyphus
|
|
|
16
16
|
perform_job
|
|
17
17
|
end
|
|
18
18
|
|
|
19
|
-
exit 0
|
|
19
|
+
exit! 0
|
|
20
20
|
end
|
|
21
21
|
|
|
22
22
|
private
|
|
@@ -33,9 +33,9 @@ module Sisyphus
|
|
|
33
33
|
self.process_name = "Child of worker #{Process.ppid}"
|
|
34
34
|
begin
|
|
35
35
|
@job.perform
|
|
36
|
-
exit 0
|
|
36
|
+
exit! 0
|
|
37
37
|
rescue Exception
|
|
38
|
-
exit 1
|
|
38
|
+
exit! 1
|
|
39
39
|
end
|
|
40
40
|
end
|
|
41
41
|
end
|
data/lib/version.rb
CHANGED
|
@@ -7,7 +7,7 @@ module Sisyphus
|
|
|
7
7
|
let(:worker) { Worker.new job, output }
|
|
8
8
|
|
|
9
9
|
it 'traps signals when started' do
|
|
10
|
-
worker.stub :exit
|
|
10
|
+
worker.stub :exit!
|
|
11
11
|
worker.instance_variable_set(:@stopped, true)
|
|
12
12
|
worker.should_receive :trap_signals
|
|
13
13
|
worker.start
|
|
@@ -15,7 +15,7 @@ module Sisyphus
|
|
|
15
15
|
|
|
16
16
|
it 'exits when it has been stopped' do
|
|
17
17
|
worker.instance_variable_set(:@stopped, true)
|
|
18
|
-
worker.should_receive :exit
|
|
18
|
+
worker.should_receive :exit!
|
|
19
19
|
worker.start
|
|
20
20
|
end
|
|
21
21
|
|
|
@@ -42,19 +42,19 @@ module Sisyphus
|
|
|
42
42
|
|
|
43
43
|
it 'should perform the job' do
|
|
44
44
|
job.should_receive :perform
|
|
45
|
-
worker.stub :exit
|
|
45
|
+
worker.stub :exit!
|
|
46
46
|
worker.send :perform_job
|
|
47
47
|
end
|
|
48
48
|
|
|
49
49
|
it 'should exit after having performed the job' do
|
|
50
50
|
job.stub :perform
|
|
51
|
-
worker.should_receive(:exit).with 0
|
|
51
|
+
worker.should_receive(:exit!).with 0
|
|
52
52
|
worker.send :perform_job
|
|
53
53
|
end
|
|
54
54
|
|
|
55
55
|
it 'should change process name' do
|
|
56
56
|
job.stub :perform
|
|
57
|
-
worker.stub :exit
|
|
57
|
+
worker.stub :exit!
|
|
58
58
|
Process.stub(:ppid) { 666 }
|
|
59
59
|
worker.should_receive(:process_name=).with "Child of worker 666"
|
|
60
60
|
worker.send :perform_job
|
|
@@ -63,7 +63,7 @@ module Sisyphus
|
|
|
63
63
|
context 'when job.perform raises an error' do
|
|
64
64
|
it 'should exit with a non-zero status' do
|
|
65
65
|
job.stub(:perform).and_raise Exception.new "should be rescued!"
|
|
66
|
-
worker.should_receive(:exit).with(1)
|
|
66
|
+
worker.should_receive(:exit!).with(1)
|
|
67
67
|
worker.send :perform_job
|
|
68
68
|
end
|
|
69
69
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: sisyphus
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Rasmus Bang Grouleff
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2013-
|
|
11
|
+
date: 2013-10-29 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -94,7 +94,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
94
94
|
version: '0'
|
|
95
95
|
requirements: []
|
|
96
96
|
rubyforge_project:
|
|
97
|
-
rubygems_version: 2.
|
|
97
|
+
rubygems_version: 2.1.5
|
|
98
98
|
signing_key:
|
|
99
99
|
specification_version: 4
|
|
100
100
|
summary: A tiny library for spawning worker processes
|