seam 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/seam/version.rb +1 -1
- data/lib/seam/worker.rb +27 -19
- metadata +4 -4
data/lib/seam/version.rb
CHANGED
data/lib/seam/worker.rb
CHANGED
@@ -4,6 +4,14 @@ module Seam
|
|
4
4
|
@step = step
|
5
5
|
end
|
6
6
|
|
7
|
+
def effort
|
8
|
+
@current_effort
|
9
|
+
end
|
10
|
+
|
11
|
+
def history
|
12
|
+
@current_run
|
13
|
+
end
|
14
|
+
|
7
15
|
def execute effort
|
8
16
|
@current_run = HashWithIndifferentAccess.new( {
|
9
17
|
started_at: Time.now,
|
@@ -12,10 +20,10 @@ module Seam
|
|
12
20
|
} )
|
13
21
|
@current_effort = effort
|
14
22
|
process
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
23
|
+
history[:data_after] = effort.data
|
24
|
+
history[:stopped_at] = Time.now
|
25
|
+
effort.history << history
|
26
|
+
effort.save
|
19
27
|
end
|
20
28
|
|
21
29
|
def execute_all
|
@@ -25,32 +33,32 @@ module Seam
|
|
25
33
|
end
|
26
34
|
|
27
35
|
def eject
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
36
|
+
history[:result] = "eject"
|
37
|
+
effort.complete = true
|
38
|
+
effort.next_step = nil
|
39
|
+
effort.save
|
32
40
|
end
|
33
41
|
|
34
42
|
def move_to_next_step
|
35
|
-
|
36
|
-
|
43
|
+
history[:result] = "move_to_next_step"
|
44
|
+
effort.completed_steps << effort.next_step
|
37
45
|
|
38
|
-
steps =
|
46
|
+
steps = effort.flow['steps'].map { |x| x['name'] }
|
39
47
|
|
40
|
-
next_step = steps[
|
41
|
-
|
42
|
-
|
43
|
-
|
48
|
+
next_step = steps[effort.completed_steps.count]
|
49
|
+
effort.next_step = next_step
|
50
|
+
effort.complete = next_step.nil?
|
51
|
+
effort.save
|
44
52
|
end
|
45
53
|
|
46
54
|
def try_again_in seconds
|
47
55
|
try_again_on = Time.now + seconds
|
48
56
|
|
49
|
-
|
50
|
-
|
57
|
+
history[:result] = "try_again_in"
|
58
|
+
history[:try_again_on] = try_again_on
|
51
59
|
|
52
|
-
|
53
|
-
|
60
|
+
effort.next_execute_at = try_again_on
|
61
|
+
effort.save
|
54
62
|
end
|
55
63
|
end
|
56
64
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: seam
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -243,7 +243,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
243
243
|
version: '0'
|
244
244
|
segments:
|
245
245
|
- 0
|
246
|
-
hash:
|
246
|
+
hash: 4310654734258751249
|
247
247
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
248
248
|
none: false
|
249
249
|
requirements:
|
@@ -252,10 +252,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
252
252
|
version: '0'
|
253
253
|
segments:
|
254
254
|
- 0
|
255
|
-
hash:
|
255
|
+
hash: 4310654734258751249
|
256
256
|
requirements: []
|
257
257
|
rubyforge_project:
|
258
|
-
rubygems_version: 1.8.
|
258
|
+
rubygems_version: 1.8.25
|
259
259
|
signing_key:
|
260
260
|
specification_version: 3
|
261
261
|
summary: Simple workflows
|