rockflow 1.2.3 → 1.2.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fcdf077ecb27ccf468ab8da1af72599dc39fee66
4
- data.tar.gz: 5836178ba3626ae072933cfdc37c3720392ef212
3
+ metadata.gz: 3a6f32418bebf4b6bc07857b5c041eaa43362ac2
4
+ data.tar.gz: 51a8ae2808e2f8dd8c868e57d01ab36a68056a62
5
5
  SHA512:
6
- metadata.gz: a68d63919a65c0b1fa18c46588bacc6333016b0f2bc259373f2b7ae919b5d478ea0d137612dcbdded9002c203316001012e09663154279519ff4f2b0397c2114
7
- data.tar.gz: 8544180bf65e0f71167ea37fb02b2acfd1c6a04503215d0fbdb2ea1bf71dd48a7838f4d94e6758d90156b6b58b030c59be409e741333390338c12f7729a747b8
6
+ metadata.gz: 40a81c6a30bb032e83ce752b11cb949cbb248909393576890ab5964187f267ff37dd4f3803ea4c0a4c472d8dc91a2ad416ed7134cb1d615e69329f1f8c9a5623
7
+ data.tar.gz: ba199ad0e1a99cd5535b31c9923319ed51e6a072156f8584bde7a9629d52ef3a4d6b277ddd86bf8c31f47dfaf49e02ca87b667fe2ee7a208a417cdc06d38d9d9
data/README.md CHANGED
@@ -85,8 +85,8 @@ So now i have defined my steps and my flow but how can i execute it? Well simple
85
85
 
86
86
  ```ruby
87
87
  flow = AwesomeFlow.new
88
- flow.concert! # execute all steps and returns all steps
89
- flow.concert # returns false or true
88
+ flow.concert! # execute all steps and returns all steps. If an error occurs inside the steps it is raised.
89
+ flow.concert # returns false or true depending if a step fails.
90
90
  ```
91
91
 
92
92
  Please note that if any of your steps fail the parallel execution is interrupted and and an exception is raised.
@@ -16,19 +16,28 @@ module Rockflow
16
16
  @steps << klazz.new(self, opts)
17
17
  end
18
18
 
19
+ # Returns true or false depending if the flow raised any errors or violated any conditions.
20
+ # @return [TrueClass, FalseClass] returns true if no exception is raised else false.
19
21
  def concert
20
22
  execute_steps.inject(true) do |result, elem|
21
23
  result && !elem.errors.any?
22
24
  end
23
25
  end
24
26
 
27
+ # Returns all steps if successfull. If any error is raised inside the step it is raised.
28
+ # @return [Array] array of all defined steps in the flow.
25
29
  def concert!
26
30
  execute_steps
31
+ @steps.map do |step|
32
+ step.errors
33
+ end.flatten.each do |error|
34
+ raise error
35
+ end
27
36
  end
28
37
 
29
38
  def next_free_steps
30
39
  @steps.select do |step|
31
- step.after_dependencies_finished? && !step.finished?
40
+ step.after_dependencies_finished? && !step.finished? && !step.failed?
32
41
  end
33
42
  end
34
43
 
@@ -41,13 +50,14 @@ module Rockflow
41
50
 
42
51
  def execute_steps
43
52
  while !steps_finished?
53
+ break if next_free_steps.blank?
44
54
  ::Parallel.each(next_free_steps, threads_or_processes.to_sym => Rockflow.configuration.thread_or_processes) do |step|
45
55
  begin
46
56
  step.execute_pre_conditions
47
57
  step.it_up unless step.failed?
48
58
  step.execute_post_conditions
49
59
  step.finish! unless step.failed?
50
- rescue Exception => e
60
+ rescue => e
51
61
  step.fail!
52
62
  step.errors << e
53
63
  raise Parallel::Break, e.message
@@ -1,3 +1,3 @@
1
1
  module Rockflow
2
- VERSION = "1.2.3"
2
+ VERSION = "1.2.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rockflow
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.3
4
+ version: 1.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Erwin Schens
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-10-19 00:00:00.000000000 Z
11
+ date: 2015-11-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parallel