carry_out 1.0.0 → 1.1.0
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/lib/carry_out/plan_runner.rb +6 -9
- data/lib/carry_out/result.rb +24 -20
- data/lib/carry_out/result_error.rb +13 -0
- data/lib/carry_out/version.rb +1 -1
- data/lib/carry_out.rb +6 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 61806a31006a015a414678cc29c2dfec3102e821
|
4
|
+
data.tar.gz: c9119841ad6a1dc4556b8093cc2241b9c8d928fe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ceae682a4aa09f8d815fa9ac960d451ff9009c2be4ed4c03ca89c020767c8c61854305cd61f2f776dd89468155d572923eed3d317550762c1d141c420e2e32b2
|
7
|
+
data.tar.gz: 48ae6d41753a17cb56f3e9515865e9d86c996973542928c88c90abaa7baa81598513f15e4a22beb4a50f954db5afbff0924df3abd39850ebde100d3940ec9330
|
@@ -14,19 +14,16 @@ module CarryOut
|
|
14
14
|
begin
|
15
15
|
node_result = node.call(plan_result.artifacts)
|
16
16
|
|
17
|
-
if node_result.kind_of?(Plan::NodeResult)
|
17
|
+
if node_result.kind_of?(Plan::NodeResult)
|
18
18
|
plan_result.add(node.returns_as, node_result.value)
|
19
|
-
|
20
|
-
if node_result.value.kind_of?(CarryOut::Result) && !node_result.value.success?
|
21
|
-
break
|
22
|
-
end
|
23
19
|
end
|
24
|
-
|
25
|
-
node = node.connects_to
|
26
20
|
rescue StandardError => error
|
27
|
-
|
28
|
-
|
21
|
+
error = CarryOut::Error.new(error.message, error) unless error.kind_of?(CarryOut::Error)
|
22
|
+
plan_result.add node.returns_as, error
|
29
23
|
end
|
24
|
+
|
25
|
+
break unless plan_result.success?
|
26
|
+
node = node.connects_to
|
30
27
|
end
|
31
28
|
end
|
32
29
|
end
|
data/lib/carry_out/result.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'carry_out/result_error'
|
2
|
+
|
1
3
|
module CarryOut
|
2
4
|
class Result
|
3
5
|
|
@@ -7,20 +9,28 @@ module CarryOut
|
|
7
9
|
|
8
10
|
def add(group, object)
|
9
11
|
if object.kind_of?(CarryOut::Error)
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
elsif object.kind_of?(Hash)
|
18
|
-
artifacts[group] ||= {}
|
19
|
-
object.each { |k,v| artifacts[group][k] = v }
|
20
|
-
elsif !artifacts[group].nil?
|
21
|
-
artifacts[group] = [ artifacts[group], object ].flatten(1)
|
12
|
+
errors << ResultError.new(
|
13
|
+
group: group,
|
14
|
+
message: object.message,
|
15
|
+
details: object.details
|
16
|
+
)
|
17
|
+
elsif object.kind_of?(Enumerable) && !object.kind_of?(Hash)
|
18
|
+
object.each { |o| add(group, o) }
|
22
19
|
else
|
23
|
-
|
20
|
+
unless group.nil?
|
21
|
+
if object.kind_of?(Hash)
|
22
|
+
artifacts[group] ||= {}
|
23
|
+
object.each { |k,v| artifacts[group][k] = v }
|
24
|
+
elsif object.kind_of?(Result)
|
25
|
+
add(group, object.to_hash)
|
26
|
+
|
27
|
+
object.errors.each do |error|
|
28
|
+
add([group, error.group].flatten(1), e)
|
29
|
+
end
|
30
|
+
else
|
31
|
+
artifacts[group] = object
|
32
|
+
end
|
33
|
+
end
|
24
34
|
end
|
25
35
|
end
|
26
36
|
|
@@ -29,7 +39,7 @@ module CarryOut
|
|
29
39
|
end
|
30
40
|
|
31
41
|
def errors
|
32
|
-
@errors ||=
|
42
|
+
@errors ||= []
|
33
43
|
end
|
34
44
|
|
35
45
|
def success?
|
@@ -39,11 +49,5 @@ module CarryOut
|
|
39
49
|
def to_hash
|
40
50
|
artifacts
|
41
51
|
end
|
42
|
-
|
43
|
-
private
|
44
|
-
def add_error(group, error)
|
45
|
-
group = errors[group] ||= []
|
46
|
-
group << error
|
47
|
-
end
|
48
52
|
end
|
49
53
|
end
|
data/lib/carry_out/version.rb
CHANGED
data/lib/carry_out.rb
CHANGED
@@ -27,7 +27,12 @@ module CarryOut
|
|
27
27
|
def self.plan(options = {}, &block)
|
28
28
|
merged_options = Hash.new.merge(configuration).merge(options)
|
29
29
|
plan = PlanBuilder.build(merged_options, &block)
|
30
|
-
|
30
|
+
|
31
|
+
Proc.new do |context = nil, &block|
|
32
|
+
PlanRunner.run(plan, context).tap do |result|
|
33
|
+
block.call(result) unless block.nil?
|
34
|
+
end
|
35
|
+
end
|
31
36
|
end
|
32
37
|
|
33
38
|
def self.configuration
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: carry_out
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Fields
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-04-
|
11
|
+
date: 2017-04-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -112,6 +112,7 @@ files:
|
|
112
112
|
- lib/carry_out/plan_builder.rb
|
113
113
|
- lib/carry_out/plan_runner.rb
|
114
114
|
- lib/carry_out/result.rb
|
115
|
+
- lib/carry_out/result_error.rb
|
115
116
|
- lib/carry_out/unit.rb
|
116
117
|
- lib/carry_out/version.rb
|
117
118
|
homepage: https://github.com/ryanfields/carry_out
|