trailblazer-macro 2.1.0.beta6 → 2.1.0.beta7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES.md +4 -0
- data/Gemfile +2 -2
- data/lib/trailblazer/macro.rb +0 -1
- data/lib/trailblazer/macro/version.rb +1 -1
- data/lib/trailblazer/operation/nested.rb +17 -9
- metadata +2 -3
- data/lib/trailblazer/operation/input_output.rb +0 -28
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8b28fce36bb1ae4a995432b091624dfc319e60a216c0ee277cba94b7f17fcdf1
|
4
|
+
data.tar.gz: f50322231cf78170aa11c57698ac3e7bd629c40f7961960d21f5ba0aca9144de
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e0a7db056ec5573d1ad883387dd1d32a3c035d509aec54e023317d1e5061c73f88a098d13758d7fdbc4cc8101873ef4ad583ebef7116f9abd94fe7f5c1146f0a
|
7
|
+
data.tar.gz: d6ca9fc728a873a2f01ca832b4dbc4d21a48da02af2fe6a5d4790d11f267ad15f92b40f3b755ce71702d98e0055ae960dbafa0c9bd647493e05c90175430fa67
|
data/CHANGES.md
CHANGED
data/Gemfile
CHANGED
@@ -4,8 +4,8 @@ source 'https://rubygems.org'
|
|
4
4
|
gemspec
|
5
5
|
|
6
6
|
# gem "trailblazer", github: "trailblazer/trailblazer"
|
7
|
-
|
8
|
-
|
7
|
+
gem "trailblazer-activity", path: "../trailblazer-activity"
|
8
|
+
gem "trailblazer-operation", path: "../operation"
|
9
9
|
# gem "trailblazer-activity"#, github: "trailblazer/trailblazer-activity"
|
10
10
|
# gem "trailblazer-macro-contract", git: "https://github.com/trailblazer/trailblazer-macro-contract"
|
11
11
|
|
data/lib/trailblazer/macro.rb
CHANGED
@@ -2,33 +2,41 @@
|
|
2
2
|
module Trailblazer
|
3
3
|
class Operation
|
4
4
|
# {Nested} macro.
|
5
|
-
def self.Nested(callable,
|
5
|
+
def self.Nested(callable, id: "Nested(#{callable})", input: nil, output: nil)
|
6
6
|
task_wrap_extensions = Module.new do
|
7
7
|
extend Activity::Path::Plan()
|
8
8
|
end
|
9
9
|
|
10
|
-
|
10
|
+
input_output = Nested.input_output_extensions_for(input, output) # TODO: deprecate this?
|
11
11
|
|
12
|
-
|
13
|
-
if input || output
|
14
|
-
task_wrap_extensions = InputOutput.plan( input, output )
|
15
|
-
end
|
12
|
+
task, operation, is_dynamic = Nested.build(callable)
|
16
13
|
|
17
14
|
if is_dynamic
|
18
15
|
task_wrap_extensions.task task.method(:compute_nested_activity), id: ".compute_nested_activity", after: "Start.default", group: :start
|
19
16
|
task_wrap_extensions.task task.method(:compute_return_signal), id: ".compute_return_signal", after: "task_wrap.call_task"
|
20
17
|
end
|
21
18
|
|
22
|
-
{
|
19
|
+
options = {
|
23
20
|
task: task,
|
24
21
|
id: id,
|
25
22
|
Trailblazer::Activity::DSL::Extension.new(Trailblazer::Activity::TaskWrap::Merge.new(task_wrap_extensions)) => true,
|
26
|
-
outputs: operation.outputs
|
27
|
-
}
|
23
|
+
outputs: operation.outputs,
|
24
|
+
}.merge(input_output)
|
28
25
|
end
|
29
26
|
|
30
27
|
# @private
|
31
28
|
module Nested
|
29
|
+
def self.input_output_extensions_for(input, output)
|
30
|
+
return {} unless input || output
|
31
|
+
|
32
|
+
input = input || ->(original_ctx, **) { original_ctx }
|
33
|
+
output = output || ->(new_ctx, **) { new_ctx.decompose.last } # merges "mutable" part into original, since it's in Unscoped.
|
34
|
+
|
35
|
+
{
|
36
|
+
Activity::TaskWrap::VariableMapping(input: input, output: output) => true
|
37
|
+
}
|
38
|
+
end
|
39
|
+
|
32
40
|
# DISCUSS: use builders here?
|
33
41
|
def self.build(nested_operation)
|
34
42
|
return dynamic = Dynamic.new(nested_operation), dynamic, true unless nestable_object?(nested_operation)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: trailblazer-macro
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.0.
|
4
|
+
version: 2.1.0.beta7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nick Sutterer
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2018-05-
|
12
|
+
date: 2018-05-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -123,7 +123,6 @@ files:
|
|
123
123
|
- lib/trailblazer/macro.rb
|
124
124
|
- lib/trailblazer/macro/version.rb
|
125
125
|
- lib/trailblazer/operation/guard.rb
|
126
|
-
- lib/trailblazer/operation/input_output.rb
|
127
126
|
- lib/trailblazer/operation/model.rb
|
128
127
|
- lib/trailblazer/operation/nested.rb
|
129
128
|
- lib/trailblazer/operation/policy.rb
|
@@ -1,28 +0,0 @@
|
|
1
|
-
module Trailblazer
|
2
|
-
# Add an input and output filter for a task, allowing to control what a task "sees"
|
3
|
-
# (receives as input) and returns (or, what the outer caller "sees").
|
4
|
-
#
|
5
|
-
# This works by adding two variable mappers to the taskWrap.
|
6
|
-
# One before the actual task gets called (input) and one before the end (output).
|
7
|
-
module Operation::InputOutput
|
8
|
-
# naming: Macaroni, VariableMapping
|
9
|
-
def self.plan(input, output)
|
10
|
-
default_input_filter = ->(options, *) { ctx = options }
|
11
|
-
default_output_filter = ->(options, *) { options }
|
12
|
-
|
13
|
-
input ||= default_input_filter
|
14
|
-
output ||= default_output_filter
|
15
|
-
|
16
|
-
input_filter = Activity::TaskWrap::Input.new(input)
|
17
|
-
output_filter = Activity::TaskWrap::Output.new(output)
|
18
|
-
|
19
|
-
# taskWrap extensions
|
20
|
-
Module.new do
|
21
|
-
extend Activity::Path::Plan()
|
22
|
-
|
23
|
-
task input_filter, id: ".input", before: "task_wrap.call_task"
|
24
|
-
task output_filter, id: ".output", before: "End.success", group: :end # DISCUSS: position
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|