trailblazer-activity 0.11.5 → 0.12.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -0
- data/CHANGES.md +4 -0
- data/Gemfile +1 -6
- data/lib/trailblazer/activity/introspect.rb +14 -0
- data/lib/trailblazer/activity/task_builder.rb +6 -6
- data/lib/trailblazer/activity/task_wrap/call_task.rb +3 -1
- data/lib/trailblazer/activity/task_wrap/variable_mapping.rb +2 -2
- data/lib/trailblazer/activity/testing.rb +10 -4
- data/lib/trailblazer/activity/version.rb +1 -1
- data/trailblazer-activity.gemspec +2 -1
- metadata +21 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f790c2cce163e21a33c31093c7d74358574f851249b810a4e776472fccc9cb4f
|
4
|
+
data.tar.gz: 0e78fa480306d480850ef3709871e234ece90939e9552a4ddcfe0bb26f5e2853
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 35b942b116679ad0aae0793fc102ad274f2aef584dd91a9d808d0abf50f3ca62ba0e20b9eca9590063bf97096ed177c119d41e18c964d4f33730f9719e30836b
|
7
|
+
data.tar.gz: 63596947b49ca3bfd44d3cd567bf6abfdefbc086cea31da14716654a920caaa443c49071828114a2e7fa99905d3d5810ef9b19087b27b1782a7b1bdcdcddd410
|
data/.travis.yml
CHANGED
data/CHANGES.md
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"
|
@@ -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.
|
@@ -28,16 +28,16 @@ module Trailblazer
|
|
28
28
|
|
29
29
|
def call( (ctx, flow_options), **circuit_options )
|
30
30
|
# Execute the user step with TRB's kw args.
|
31
|
-
result = @task.( ctx, **circuit_options
|
31
|
+
result = @task.(ctx, keyword_arguments: ctx.to_hash, **circuit_options) # circuit_options contains :exec_context.
|
32
32
|
|
33
33
|
# Return an appropriate signal which direction to go next.
|
34
|
-
signal = Activity::TaskBuilder.binary_signal_for(
|
34
|
+
signal = Activity::TaskBuilder.binary_signal_for(result, Activity::Right, Activity::Left)
|
35
35
|
|
36
|
-
return signal, [
|
36
|
+
return signal, [ctx, flow_options]
|
37
37
|
end
|
38
38
|
|
39
|
-
def inspect
|
40
|
-
%{#<Trailblazer::Activity::TaskBuilder::Task user_proc=#{@user_proc}>}
|
39
|
+
def inspect # TODO: make me private!
|
40
|
+
%{#<Trailblazer::Activity::TaskBuilder::Task user_proc=#{Trailblazer::Activity::Introspect.render_task(@user_proc)}>}
|
41
41
|
end
|
42
42
|
alias_method :to_s, :inspect
|
43
43
|
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 )
|
@@ -57,7 +57,7 @@ class Trailblazer::Activity
|
|
57
57
|
|
58
58
|
# Invoke the @filter callable with the original circuit interface.
|
59
59
|
def apply_filter((ctx, original_flow_options), original_circuit_options)
|
60
|
-
@filter.([ctx, original_flow_options], original_circuit_options) # returns {new_ctx}.
|
60
|
+
@filter.([ctx, original_flow_options], **original_circuit_options) # returns {new_ctx}.
|
61
61
|
end
|
62
62
|
end
|
63
63
|
|
@@ -78,7 +78,7 @@ class Trailblazer::Activity
|
|
78
78
|
returned_ctx, returned_flow_options = wrap_ctx[:return_args] # this is the Context returned from {call}ing the wrapped user task.
|
79
79
|
original_ctx = wrap_ctx[@id] # grab the original ctx from before which was set in the {:input} filter.
|
80
80
|
# let user compute the output.
|
81
|
-
output_ctx = @filter.(returned_ctx, [original_ctx, returned_flow_options], original_circuit_options)
|
81
|
+
output_ctx = @filter.(returned_ctx, [original_ctx, returned_flow_options], **original_circuit_options)
|
82
82
|
|
83
83
|
wrap_ctx = wrap_ctx.merge( return_args: [output_ctx, returned_flow_options] )
|
84
84
|
|
@@ -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,11 @@ Gem::Specification.new do |spec|
|
|
17
17
|
end
|
18
18
|
spec.require_paths = ["lib"]
|
19
19
|
|
20
|
-
spec.add_dependency "trailblazer-context", ">= 0.
|
20
|
+
spec.add_dependency "trailblazer-context", ">= 0.4.0", "< 0.5.0"
|
21
21
|
|
22
22
|
spec.add_development_dependency "bundler"
|
23
23
|
spec.add_development_dependency "minitest", "~> 5.0"
|
24
|
+
spec.add_development_dependency "minitest-line"
|
24
25
|
spec.add_development_dependency "rake"
|
25
26
|
spec.add_development_dependency "trailblazer-developer", ">= 0.0.7"
|
26
27
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: trailblazer-activity
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.12.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-02-
|
11
|
+
date: 2021-02-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: trailblazer-context
|
@@ -16,20 +16,20 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: 0.4.0
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: 0.
|
22
|
+
version: 0.5.0
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
27
|
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: 0.
|
29
|
+
version: 0.4.0
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: 0.
|
32
|
+
version: 0.5.0
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: bundler
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -58,6 +58,20 @@ dependencies:
|
|
58
58
|
- - "~>"
|
59
59
|
- !ruby/object:Gem::Version
|
60
60
|
version: '5.0'
|
61
|
+
- !ruby/object:Gem::Dependency
|
62
|
+
name: minitest-line
|
63
|
+
requirement: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - ">="
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '0'
|
68
|
+
type: :development
|
69
|
+
prerelease: false
|
70
|
+
version_requirements: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - ">="
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '0'
|
61
75
|
- !ruby/object:Gem::Dependency
|
62
76
|
name: rake
|
63
77
|
requirement: !ruby/object:Gem::Requirement
|
@@ -139,7 +153,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
139
153
|
- !ruby/object:Gem::Version
|
140
154
|
version: '0'
|
141
155
|
requirements: []
|
142
|
-
rubygems_version: 3.
|
156
|
+
rubygems_version: 3.2.3
|
143
157
|
signing_key:
|
144
158
|
specification_version: 4
|
145
159
|
summary: Runtime code for Trailblazer activities.
|