trailblazer-activity 0.11.5 → 0.13.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +17 -0
- data/CHANGES.md +20 -0
- data/Gemfile +1 -6
- data/README.md +7 -7
- data/lib/trailblazer/activity/introspect.rb +14 -0
- data/lib/trailblazer/activity/task_builder.rb +16 -8
- data/lib/trailblazer/activity/task_wrap/call_task.rb +3 -1
- data/lib/trailblazer/activity/task_wrap/pipeline.rb +18 -4
- data/lib/trailblazer/activity/task_wrap/runner.rb +1 -1
- data/lib/trailblazer/activity/task_wrap/variable_mapping.rb +11 -18
- data/lib/trailblazer/activity/task_wrap.rb +10 -4
- data/lib/trailblazer/activity/testing.rb +10 -4
- data/lib/trailblazer/activity/version.rb +1 -1
- data/trailblazer-activity.gemspec +3 -1
- metadata +35 -14
- data/.travis.yml +0 -12
- data/lib/trailblazer/activity/task_wrap/inject.rb +0 -39
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 36888239a75b308074977ecb9637e421940f63a53fdafbadb5a65106152fc550
|
4
|
+
data.tar.gz: 3aff2a8fb3da591b98f72f387555791c8273dc02968b68a5f4eb8d59a69f7e45
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bffee75027f1af8e1dd87487f07505bc5e8238e62eb67ffc1a128f90fbaeb5d4feadcbac2294991ef69febd71245292dd39128fd52e78bba11a9be8afce1cdf9
|
7
|
+
data.tar.gz: 8ac7bc2b36e8db2349134ce935d1da0881a749c881dca6703c1ed192862d526a734de5da8c956f59b60293300f3dd3fabb05c0e21fbd5187cf2a53b09992c368
|
@@ -0,0 +1,17 @@
|
|
1
|
+
name: CI
|
2
|
+
on: [push, pull_request]
|
3
|
+
jobs:
|
4
|
+
test:
|
5
|
+
strategy:
|
6
|
+
fail-fast: false
|
7
|
+
matrix:
|
8
|
+
# Due to https://github.com/actions/runner/issues/849, we have to use quotes for '3.0'
|
9
|
+
ruby: [2.5, 2.6, 2.7, '3.0', head, jruby, jruby-head]
|
10
|
+
runs-on: ubuntu-latest
|
11
|
+
steps:
|
12
|
+
- uses: actions/checkout@v2
|
13
|
+
- uses: ruby/setup-ruby@v1
|
14
|
+
with:
|
15
|
+
ruby-version: ${{ matrix.ruby }}
|
16
|
+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
17
|
+
- run: bundle exec rake
|
data/CHANGES.md
CHANGED
@@ -1,3 +1,23 @@
|
|
1
|
+
# 0.13.0
|
2
|
+
|
3
|
+
* Removed `TaskWrap::Inject::Defaults`. This is now implemented through `dsl`'s `:inject` option.
|
4
|
+
* Removed `TaskWrap::VariableMapping.Extension`.
|
5
|
+
* Renamed private `TaskWrap::VariableMapping.merge_for` to `.merge_instructions_for` as there's no {Merge} instance, yet.
|
6
|
+
* Extract invocation logic in `TaskBuilder::Task` into `Task#call_option`.
|
7
|
+
* Add `TaskWrap::Pipeline::prepend`.
|
8
|
+
|
9
|
+
# 0.12.2
|
10
|
+
|
11
|
+
* Use extracted `trailblazer-option`.
|
12
|
+
|
13
|
+
# 0.12.1
|
14
|
+
|
15
|
+
* Allow injecting `:wrap_static` into `TaskWrap.invoke`.
|
16
|
+
|
17
|
+
# 0.12.0
|
18
|
+
|
19
|
+
* Support for Ruby 3.0.
|
20
|
+
|
1
21
|
# 0.11.5
|
2
22
|
|
3
23
|
* Bug fix: `:output` filter from `TaskWrap::VariableMapping` wasn't returning the correct `flow_options`. If the wrapped task changed
|
data/Gemfile
CHANGED
@@ -1,10 +1,5 @@
|
|
1
1
|
source "https://rubygems.org"
|
2
|
-
|
3
|
-
# Specify your gem's dependencies in workflow.gemspec
|
4
2
|
gemspec
|
5
3
|
|
6
|
-
gem "benchmark-ips"
|
7
|
-
gem "minitest-line"
|
8
|
-
|
9
|
-
# gem "trailblazer-context", path: "../trailblazer-context"
|
10
4
|
# gem "trailblazer-developer", path: "../trailblazer-developer"
|
5
|
+
# gem "trailblazer-context", github: "trailblazer/trailblazer-context", branch: "ruby-3"
|
data/README.md
CHANGED
@@ -2,15 +2,15 @@
|
|
2
2
|
|
3
3
|
Implements Intermediate, Implementation and compiler
|
4
4
|
|
5
|
-
The `activity` gem
|
5
|
+
The `activity` gem implements the runtime logic to invoke a new abstraction called "activities". Ideally, activities are defined using the [`dsl-linear` DSL gem](https://github.com/trailblazer/trailblazer-activity-dsl-linear).
|
6
6
|
|
7
7
|
A process is a set of arbitrary pieces of logic you define, chained together and put into a meaningful context by an activity. Activity lets you focus on the implementation of steps while Trailblazer takes care of the control flow.
|
8
8
|
|
9
|
-
Please find the [full documentation on the Trailblazer website](https://
|
9
|
+
Please find the [full documentation on the Trailblazer website](https://trailblazer.to/2.1/docs/activity.html).
|
10
10
|
|
11
11
|
## Example
|
12
12
|
|
13
|
-
In conjunction with [`dsl-linear`](https://github.com/trailblazer/trailblazer-activity-dsl-linear), the `activity` gem provides three default patterns to model processes: `Path`, `Railway` and `FastTrack`. Here's an example of what a railway activity could look like, along with some more complex connections (you can read more about Railway strategy in the [docs](https://
|
13
|
+
In conjunction with [`dsl-linear`](https://github.com/trailblazer/trailblazer-activity-dsl-linear), the `activity` gem provides three default patterns to model processes: `Path`, `Railway` and `FastTrack`. Here's an example of what a railway activity could look like, along with some more complex connections (you can read more about Railway strategy in the [docs](https://trailblazer.to/2.1/docs/activity.html#activity-strategy-railway)).
|
14
14
|
|
15
15
|
```ruby
|
16
16
|
require "trailblazer-activity"
|
@@ -78,15 +78,15 @@ With Activity, modeling business processes turns out to be ridiculously simple:
|
|
78
78
|
|
79
79
|
## Operation
|
80
80
|
|
81
|
-
Trailblazer's [`Operation`](https://
|
81
|
+
Trailblazer's [`Operation`](https://trailblazer.to/2.1/docs/operation.html#operation-overview) internally uses an activity to model the processes.
|
82
82
|
|
83
83
|
## Workflow
|
84
|
-
Activities can be formed into bigger compounds and using workflow, you can build long-running processes such as a moderated blog post or a parcel delivery. Also, you don't have to use the DSL but can use the [`editor`](https://
|
84
|
+
Activities can be formed into bigger compounds and using workflow, you can build long-running processes such as a moderated blog post or a parcel delivery. Also, you don't have to use the DSL but can use the [`editor`](https://trailblazer.to/2.1/docs/pro.html#pro-editor)instead(cool for more complex, long-running flows). Here comes a sample screenshot.
|
85
85
|
|
86
|
-
<img src="http://
|
86
|
+
<img src="http://trailblazer.to/2.1/dist/img/flow.png">
|
87
87
|
|
88
88
|
## License
|
89
89
|
|
90
90
|
© Copyright 2018, Trailblazer GmbH
|
91
91
|
|
92
|
-
Licensed under the LGPLv3 license. We also offer a commercial-friendly [license](https://
|
92
|
+
Licensed under the LGPLv3 license. We also offer a commercial-friendly [license](https://trailblazer.to/2.1/docs/pro.html#pro-license).
|
@@ -68,6 +68,20 @@ module Trailblazer
|
|
68
68
|
def self.Graph(*args)
|
69
69
|
Graph.new(*args)
|
70
70
|
end
|
71
|
+
|
72
|
+
def self.render_task(proc)
|
73
|
+
if proc.is_a?(Method)
|
74
|
+
|
75
|
+
receiver = proc.receiver
|
76
|
+
receiver = receiver.is_a?(Class) ? (receiver.name || "#<Class:0x>") : (receiver.name || "#<Module:0x>") #"#<Class:0x>"
|
77
|
+
|
78
|
+
return "#<Method: #{receiver}.#{proc.name}>"
|
79
|
+
elsif proc.is_a?(Symbol)
|
80
|
+
return proc.to_s
|
81
|
+
end
|
82
|
+
|
83
|
+
proc.inspect
|
84
|
+
end
|
71
85
|
end # Introspect
|
72
86
|
end
|
73
87
|
end
|
@@ -5,7 +5,7 @@ module Trailblazer
|
|
5
5
|
# Output signal binary: true=>Right, false=>Left.
|
6
6
|
# Passes through all subclasses of Direction.~~~~~~~~~~~~~~~~~
|
7
7
|
def self.Binary(user_proc)
|
8
|
-
Task.new(Trailblazer::Option
|
8
|
+
Task.new(Trailblazer::Option(user_proc), user_proc)
|
9
9
|
end
|
10
10
|
|
11
11
|
# Translates the return value of the user step into a valid signal.
|
@@ -18,26 +18,34 @@ module Trailblazer
|
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
21
|
+
# Wraps a {task} (that usually expects the task interface) into a circuit interface
|
22
|
+
# that can be used directly in a {Circuit}.
|
23
|
+
# We expect {task} to be exposing an {Option()} interface when calling it.
|
21
24
|
class Task
|
22
25
|
def initialize(task, user_proc)
|
23
26
|
@task = task
|
24
27
|
@user_proc = user_proc
|
25
|
-
|
26
28
|
freeze
|
27
29
|
end
|
28
30
|
|
29
|
-
def call(
|
31
|
+
def call((ctx, flow_options), **circuit_options)
|
30
32
|
# Execute the user step with TRB's kw args.
|
31
|
-
|
33
|
+
# {@task} is/implements {Trailblazer::Option} interface.
|
34
|
+
result = call_option(@task, [ctx, flow_options], **circuit_options)
|
32
35
|
|
33
36
|
# Return an appropriate signal which direction to go next.
|
34
|
-
signal = Activity::TaskBuilder.binary_signal_for(
|
37
|
+
signal = Activity::TaskBuilder.binary_signal_for(result, Activity::Right, Activity::Left)
|
38
|
+
|
39
|
+
return signal, [ctx, flow_options]
|
40
|
+
end
|
35
41
|
|
36
|
-
|
42
|
+
# Invoke the original {user_proc} that is wrapped in an {Option()}.
|
43
|
+
private def call_option(task_with_option_interface, (ctx, _flow_options), **circuit_options)
|
44
|
+
task_with_option_interface.(ctx, keyword_arguments: ctx.to_hash, **circuit_options) # circuit_options contains :exec_context.
|
37
45
|
end
|
38
46
|
|
39
|
-
def inspect
|
40
|
-
%{#<Trailblazer::Activity::TaskBuilder::Task user_proc=#{@user_proc}>}
|
47
|
+
def inspect # TODO: make me private!
|
48
|
+
%{#<Trailblazer::Activity::TaskBuilder::Task user_proc=#{Trailblazer::Activity::Introspect.render_task(@user_proc)}>}
|
41
49
|
end
|
42
50
|
alias_method :to_s, :inspect
|
43
51
|
end
|
@@ -6,9 +6,11 @@ class Trailblazer::Activity
|
|
6
6
|
def self.call_task(wrap_ctx, original_args)
|
7
7
|
task = wrap_ctx[:task]
|
8
8
|
|
9
|
+
original_arguments, original_circuit_options = original_args
|
10
|
+
|
9
11
|
# Call the actual task we're wrapping here.
|
10
12
|
# puts "~~~~wrap.call: #{task}"
|
11
|
-
return_signal, return_args = task.(
|
13
|
+
return_signal, return_args = task.(original_arguments, **original_circuit_options)
|
12
14
|
|
13
15
|
# DISCUSS: do we want original_args here to be passed on, or the "effective" return_args which are different to original_args now?
|
14
16
|
wrap_ctx = wrap_ctx.merge( return_signal: return_signal, return_args: return_args )
|
@@ -17,7 +17,7 @@ class Trailblazer::Activity
|
|
17
17
|
attr_reader :sequence
|
18
18
|
|
19
19
|
def self.insert_before(pipe, before_id, insertion)
|
20
|
-
index =
|
20
|
+
index = find_index(pipe, before_id)
|
21
21
|
|
22
22
|
seq = pipe.sequence.dup
|
23
23
|
|
@@ -25,18 +25,32 @@ class Trailblazer::Activity
|
|
25
25
|
end
|
26
26
|
|
27
27
|
def self.insert_after(pipe, after_id, insertion)
|
28
|
-
index =
|
28
|
+
index = find_index(pipe, after_id)
|
29
29
|
|
30
30
|
seq = pipe.sequence.dup
|
31
31
|
|
32
32
|
Pipeline.new(seq.insert(index+1, insertion))
|
33
33
|
end
|
34
34
|
|
35
|
-
def self.append(pipe, _, insertion)
|
35
|
+
def self.append(pipe, _, insertion)
|
36
36
|
Pipeline.new(pipe.sequence + [insertion])
|
37
37
|
end
|
38
38
|
|
39
|
-
|
39
|
+
def self.prepend(pipe, insertion_id, insertion, replace: 0)
|
40
|
+
return Pipeline.new(insertion.to_a + pipe.sequence) if insertion_id.nil?
|
41
|
+
|
42
|
+
index = find_index(pipe, insertion_id)
|
43
|
+
|
44
|
+
Pipeline.new(pipe.sequence[0..index-1] + insertion.to_a + pipe.sequence[index+replace..-1])
|
45
|
+
end
|
46
|
+
|
47
|
+
# @private
|
48
|
+
def self.find_index(pipe, id)
|
49
|
+
index = pipe.sequence.find_index { |(seq_id, _)| seq_id == id }
|
50
|
+
end
|
51
|
+
|
52
|
+
|
53
|
+
# Merges {extension_rows} into the {Pipeline} instance.
|
40
54
|
# This is usually used in step extensions or at runtime for {wrap_runtime}.
|
41
55
|
#
|
42
56
|
# {Extension} API
|
@@ -17,7 +17,7 @@ class Trailblazer::Activity
|
|
17
17
|
|
18
18
|
# We save all original args passed into this Runner.call, because we want to return them later after this wrap
|
19
19
|
# is finished.
|
20
|
-
original_args = [
|
20
|
+
original_args = [args, circuit_options]
|
21
21
|
|
22
22
|
# call the wrap {Activity} around the task.
|
23
23
|
wrap_ctx, _ = task_wrap_pipeline.(wrap_ctx, original_args) # we omit circuit_options here on purpose, so the wrapping activity uses the default, plain Runner.
|
@@ -5,17 +5,11 @@ class Trailblazer::Activity
|
|
5
5
|
# translate them into a {DSL::Extension}.
|
6
6
|
#
|
7
7
|
# Note that the two options are not the only way to create filters, you can use the
|
8
|
-
# more low-level {Scoped()}
|
8
|
+
# more low-level {Scoped()} from the `dsl` gem, too, and write your own filter logic.
|
9
9
|
module VariableMapping
|
10
|
-
#
|
11
|
-
|
12
|
-
|
13
|
-
merge: merge_for(input, output, id: id),
|
14
|
-
)
|
15
|
-
end
|
16
|
-
|
17
|
-
# DISCUSS: do we want the automatic wrapping of {input} and {output}?
|
18
|
-
def self.merge_for(input, output, id:) # TODO: rename
|
10
|
+
# Places filters before/after the {call_task}.
|
11
|
+
# Note that {input} and {output} are automatically wrapped.
|
12
|
+
def self.merge_instructions_for(input, output, id:)
|
19
13
|
[
|
20
14
|
[TaskWrap::Pipeline.method(:insert_before), "task_wrap.call_task", ["task_wrap.input", TaskWrap::Input.new(input, id: id)]],
|
21
15
|
[TaskWrap::Pipeline.method(:insert_after), "task_wrap.call_task", ["task_wrap.output", TaskWrap::Output.new(output, id: id)]],
|
@@ -37,9 +31,10 @@ class Trailblazer::Activity
|
|
37
31
|
@id = id
|
38
32
|
end
|
39
33
|
|
40
|
-
# {input.call()} is invoked in the
|
41
|
-
#
|
42
|
-
#
|
34
|
+
# {input.call()} is invoked in the taskWrap pipeline.
|
35
|
+
# {original_args} are the actual args passed to the wrapped task: [ [ctx, ..], circuit_options ]
|
36
|
+
# We now swap the ctx in {original_args} and our filtered one. The original "outside" ctx is keyed in
|
37
|
+
# {wrap_ctx} with the filter ID.
|
43
38
|
def call(wrap_ctx, original_args)
|
44
39
|
# let user compute new ctx for the wrapped task.
|
45
40
|
input_ctx = apply_filter(*original_args)
|
@@ -57,7 +52,7 @@ class Trailblazer::Activity
|
|
57
52
|
|
58
53
|
# Invoke the @filter callable with the original circuit interface.
|
59
54
|
def apply_filter((ctx, original_flow_options), original_circuit_options)
|
60
|
-
@filter.([ctx, original_flow_options], original_circuit_options) # returns {new_ctx}.
|
55
|
+
@filter.([ctx, original_flow_options], **original_circuit_options) # returns {new_ctx}.
|
61
56
|
end
|
62
57
|
end
|
63
58
|
|
@@ -71,14 +66,12 @@ class Trailblazer::Activity
|
|
71
66
|
|
72
67
|
# Runs your filter and replaces the ctx in `wrap_ctx[:return_args]` with the filtered one.
|
73
68
|
def call(wrap_ctx, original_args)
|
74
|
-
(original_ctx,
|
75
|
-
|
76
|
-
return_args = wrap_ctx[:return_args]
|
69
|
+
(original_ctx, _original_flow_options), original_circuit_options = original_args
|
77
70
|
|
78
71
|
returned_ctx, returned_flow_options = wrap_ctx[:return_args] # this is the Context returned from {call}ing the wrapped user task.
|
79
72
|
original_ctx = wrap_ctx[@id] # grab the original ctx from before which was set in the {:input} filter.
|
80
73
|
# let user compute the output.
|
81
|
-
output_ctx = @filter.(returned_ctx, [original_ctx, returned_flow_options], original_circuit_options)
|
74
|
+
output_ctx = @filter.(returned_ctx, [original_ctx, returned_flow_options], **original_circuit_options)
|
82
75
|
|
83
76
|
wrap_ctx = wrap_ctx.merge( return_args: [output_ctx, returned_flow_options] )
|
84
77
|
|
@@ -13,15 +13,19 @@ module Trailblazer
|
|
13
13
|
module_function
|
14
14
|
|
15
15
|
# Compute runtime arguments necessary to execute a taskWrap per task of the activity.
|
16
|
-
|
16
|
+
# This method is the top-level entry, called only once for the entire activity graph.
|
17
|
+
# [:wrap_static] The taskWrap used for the topmost activity/operation.
|
18
|
+
def invoke(activity, args, wrap_runtime: {}, wrap_static: initial_wrap_static, **circuit_options) # FIXME: why do we need this method?
|
17
19
|
circuit_options = circuit_options.merge(
|
18
20
|
runner: TaskWrap::Runner,
|
19
21
|
wrap_runtime: wrap_runtime,
|
20
|
-
|
22
|
+
# This {:activity} structure is currently (?) only needed in {TaskWrap.wrap_static_for}, where we
|
23
|
+
# access {activity[:wrap_static]} to compile the effective taskWrap.
|
24
|
+
activity: {wrap_static: {activity => wrap_static}, nodes: {}}, # for Runner. Ideally we'd have a list of all static_wraps here (even nested).
|
21
25
|
)
|
22
26
|
|
23
27
|
# signal, (ctx, flow), circuit_options =
|
24
|
-
Runner.(activity, args, **circuit_options)
|
28
|
+
TaskWrap::Runner.(activity, args, **circuit_options)
|
25
29
|
end
|
26
30
|
|
27
31
|
# {:extension} API
|
@@ -43,6 +47,9 @@ module Trailblazer
|
|
43
47
|
@merge = merge
|
44
48
|
end
|
45
49
|
|
50
|
+
# Compile-time:
|
51
|
+
# Gets called via the {Normalizer} and represents an {:extensions} item.
|
52
|
+
# Adds/alters the activity's {wrap_static}.
|
46
53
|
def call(config:, task:, **)
|
47
54
|
before_pipe = State::Config.get(config, :wrap_static, task.circuit_task)
|
48
55
|
|
@@ -56,4 +63,3 @@ require "trailblazer/activity/task_wrap/pipeline"
|
|
56
63
|
require "trailblazer/activity/task_wrap/call_task"
|
57
64
|
require "trailblazer/activity/task_wrap/runner"
|
58
65
|
require "trailblazer/activity/task_wrap/variable_mapping"
|
59
|
-
require "trailblazer/activity/task_wrap/inject"
|
@@ -62,10 +62,6 @@ module Trailblazer
|
|
62
62
|
Success = Activity::End(:success)
|
63
63
|
end
|
64
64
|
|
65
|
-
def Cct(activity)
|
66
|
-
Trailblazer::Developer::Render::Circuit.(activity)
|
67
|
-
end
|
68
|
-
|
69
65
|
# TODO: Remove this once all it's references are removed
|
70
66
|
def implementing
|
71
67
|
Implementing
|
@@ -143,9 +139,19 @@ module Trailblazer
|
|
143
139
|
|
144
140
|
def assert_circuit(schema, circuit)
|
145
141
|
cct = Cct(schema)
|
142
|
+
|
146
143
|
cct = cct.gsub("#<Trailblazer::Activity::TaskBuilder::Task user_proc=", "<*")
|
147
144
|
assert_equal %{#{circuit}}, cct
|
148
145
|
end
|
146
|
+
|
147
|
+
def Cct(activity)
|
148
|
+
Trailblazer::Developer::Render::Circuit.(activity, inspect_task: Trailblazer::Activity::Testing.method(:render_task))
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
152
|
+
# Use this in {#Cct}.
|
153
|
+
def self.render_task(proc)
|
154
|
+
Activity::Introspect.render_task(proc)
|
149
155
|
end
|
150
156
|
end
|
151
157
|
end
|
@@ -17,10 +17,12 @@ Gem::Specification.new do |spec|
|
|
17
17
|
end
|
18
18
|
spec.require_paths = ["lib"]
|
19
19
|
|
20
|
-
spec.add_dependency "trailblazer-context", "
|
20
|
+
spec.add_dependency "trailblazer-context", "~> 0.5.0"
|
21
|
+
spec.add_dependency "trailblazer-option", "~> 0.1.0"
|
21
22
|
|
22
23
|
spec.add_development_dependency "bundler"
|
23
24
|
spec.add_development_dependency "minitest", "~> 5.0"
|
25
|
+
spec.add_development_dependency "minitest-line"
|
24
26
|
spec.add_development_dependency "rake"
|
25
27
|
spec.add_development_dependency "trailblazer-developer", ">= 0.0.7"
|
26
28
|
|
metadata
CHANGED
@@ -1,35 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: trailblazer-activity
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.13.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nick Sutterer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-12-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: trailblazer-context
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: 0.3.1
|
20
|
-
- - "<"
|
17
|
+
- - "~>"
|
21
18
|
- !ruby/object:Gem::Version
|
22
|
-
version: 0.
|
19
|
+
version: 0.5.0
|
23
20
|
type: :runtime
|
24
21
|
prerelease: false
|
25
22
|
version_requirements: !ruby/object:Gem::Requirement
|
26
23
|
requirements:
|
27
|
-
- - "
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.5.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: trailblazer-option
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
28
32
|
- !ruby/object:Gem::Version
|
29
|
-
version: 0.
|
30
|
-
|
33
|
+
version: 0.1.0
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
31
39
|
- !ruby/object:Gem::Version
|
32
|
-
version: 0.
|
40
|
+
version: 0.1.0
|
33
41
|
- !ruby/object:Gem::Dependency
|
34
42
|
name: bundler
|
35
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -58,6 +66,20 @@ dependencies:
|
|
58
66
|
- - "~>"
|
59
67
|
- !ruby/object:Gem::Version
|
60
68
|
version: '5.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: minitest-line
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
61
83
|
- !ruby/object:Gem::Dependency
|
62
84
|
name: rake
|
63
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -93,8 +115,8 @@ executables: []
|
|
93
115
|
extensions: []
|
94
116
|
extra_rdoc_files: []
|
95
117
|
files:
|
118
|
+
- ".github/workflows/ci.yml"
|
96
119
|
- ".gitignore"
|
97
|
-
- ".travis.yml"
|
98
120
|
- CHANGES.md
|
99
121
|
- Gemfile
|
100
122
|
- LICENSE
|
@@ -113,7 +135,6 @@ files:
|
|
113
135
|
- lib/trailblazer/activity/task_builder.rb
|
114
136
|
- lib/trailblazer/activity/task_wrap.rb
|
115
137
|
- lib/trailblazer/activity/task_wrap/call_task.rb
|
116
|
-
- lib/trailblazer/activity/task_wrap/inject.rb
|
117
138
|
- lib/trailblazer/activity/task_wrap/pipeline.rb
|
118
139
|
- lib/trailblazer/activity/task_wrap/runner.rb
|
119
140
|
- lib/trailblazer/activity/task_wrap/variable_mapping.rb
|
@@ -139,7 +160,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
139
160
|
- !ruby/object:Gem::Version
|
140
161
|
version: '0'
|
141
162
|
requirements: []
|
142
|
-
rubygems_version: 3.
|
163
|
+
rubygems_version: 3.2.3
|
143
164
|
signing_key:
|
144
165
|
specification_version: 4
|
145
166
|
summary: Runtime code for Trailblazer activities.
|
data/.travis.yml
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
class Trailblazer::Activity
|
2
|
-
module TaskWrap
|
3
|
-
# Allows to inject attributes for a task and defaults them if not.
|
4
|
-
# Per default, the defaulting is scoped, meaning only the task will see it.
|
5
|
-
module Inject
|
6
|
-
module Defaults
|
7
|
-
module_function
|
8
|
-
|
9
|
-
def Extension(defaults)
|
10
|
-
# Returns new ctx.
|
11
|
-
input = ->((original_ctx, flow_options), circuit_options) do
|
12
|
-
defaulted_options = defaults_for(defaults, original_ctx)
|
13
|
-
|
14
|
-
ctx = original_ctx.merge(defaulted_options)
|
15
|
-
|
16
|
-
Trailblazer::Context(ctx, {}, flow_options[:context_options])
|
17
|
-
end
|
18
|
-
|
19
|
-
output = ->(new_ctx, (original_ctx, _flow_options), _circuit_options) { # FIXME: use Unscope
|
20
|
-
_, mutable_data = new_ctx.decompose
|
21
|
-
|
22
|
-
# we are only interested in the {mutable_data} part since the disposed part
|
23
|
-
# represents the injected/defaulted data.
|
24
|
-
original_ctx.merge(mutable_data)
|
25
|
-
}
|
26
|
-
|
27
|
-
VariableMapping::Extension(input, output, id: input)
|
28
|
-
end
|
29
|
-
|
30
|
-
# go through all defaultable options and default them if appropriate.
|
31
|
-
def defaults_for(defaults, original_ctx)
|
32
|
-
Hash[
|
33
|
-
defaults.collect { |k, v| [k, original_ctx[k] || v] } # FIXME: doesn't allow {false/nil} currently.
|
34
|
-
]
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end # Inject
|
38
|
-
end
|
39
|
-
end
|