trailblazer-macro 2.1.13 → 2.1.14
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/.github/workflows/ci.yml +1 -4
- data/CHANGES.md +4 -0
- data/Gemfile +5 -5
- data/Rakefile +1 -1
- data/lib/trailblazer/macro/each.rb +12 -8
- data/lib/trailblazer/macro/nested.rb +3 -3
- data/lib/trailblazer/macro/version.rb +1 -1
- data/test/docs/each_test.rb +6 -4
- data/test/docs/wrap_test.rb +6 -4
- data/test/test_helper.rb +3 -46
- data/trailblazer-macro.gemspec +5 -5
- metadata +15 -20
- data/.github/workflows/ci_jruby.yml +0 -19
- data/.github/workflows/ci_legacy.yml +0 -19
- data/.github/workflows/ci_truffleruby.yml +0 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bdbc731c17b52586de5a713605423d506a6ea91866db65f4a04be858fa5afb1e
|
4
|
+
data.tar.gz: 254f4e89aca81b120e6f1392c99ac30dfe9dd70cde79e2f2a9aa669a88448bfb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d0b26e20fe1f14def81e30ca0a39a37cf58b6257530307bb9db1f80d914c04b8c5dfb4143f98c012a0605074f31c1cf42b91930aeaecd1cf8f820158cfac6ee4
|
7
|
+
data.tar.gz: cdee315a8ac8900bf438694f7320b88cd3ceb32436baf544826bb550289f56a466ef18da3142ef15e1bde8eb3fc575eadb87e6670106c6be204e921d1285ab00
|
data/.github/workflows/ci.yml
CHANGED
@@ -1,6 +1,3 @@
|
|
1
|
-
## This file is managed by Terraform.
|
2
|
-
## Do not modify this file directly, as it may be overwritten.
|
3
|
-
## Please open an issue instead.
|
4
1
|
name: CI
|
5
2
|
on: [push, pull_request]
|
6
3
|
jobs:
|
@@ -8,7 +5,7 @@ jobs:
|
|
8
5
|
strategy:
|
9
6
|
fail-fast: false
|
10
7
|
matrix:
|
11
|
-
ruby: [2.7, '3.0', '3.1']
|
8
|
+
ruby: [2.5, 2.6, 2.7, '3.0', '3.1', '3.2', 'jruby']
|
12
9
|
runs-on: ubuntu-latest
|
13
10
|
steps:
|
14
11
|
- uses: actions/checkout@v3
|
data/CHANGES.md
CHANGED
data/Gemfile
CHANGED
@@ -6,12 +6,12 @@ gemspec
|
|
6
6
|
# gem "trailblazer-developer", github: "trailblazer/trailblazer-developer"
|
7
7
|
# gem "trailblazer-activity", github: "trailblazer/trailblazer-activity"
|
8
8
|
# gem "trailblazer-activity-dsl-linear", github: "trailblazer/trailblazer-activity-dsl-linear"
|
9
|
-
# gem "trailblazer-activity-dsl-linear", path: "../trailblazer-activity-dsl-linear"
|
10
|
-
# gem "trailblazer-developer", path: "../trailblazer-developer"
|
11
|
-
# gem "trailblazer-activity", path: "../trailblazer-activity"
|
12
9
|
# gem "trailblazer-macro-contract", git: "https://github.com/trailblazer/trailblazer-macro-contract"
|
13
|
-
|
14
|
-
# gem "trailblazer-
|
10
|
+
|
11
|
+
# gem "trailblazer-activity-dsl-linear", path: "../trailblazer-activity-dsl-linear"
|
12
|
+
# gem "trailblazer-developer", path: "../trailblazer-developer"
|
13
|
+
# gem "trailblazer-activity", path: "../trailblazer-activity"
|
14
|
+
# gem "trailblazer-operation", path: "../trailblazer-operation"
|
15
15
|
|
16
16
|
gem "minitest-line"
|
17
17
|
# gem "trailblazer-core-utils", path: "../trailblazer-core-utils"
|
data/Rakefile
CHANGED
@@ -68,7 +68,7 @@ module Trailblazer
|
|
68
68
|
# Gets included in Debugger's Normalizer. Results in IDs like {invoke_block_activity.1}.
|
69
69
|
def self.compute_runtime_id(ctx, captured_node:, activity:, compile_id:, **)
|
70
70
|
# activity is the host activity
|
71
|
-
return compile_id unless activity[:each] == true
|
71
|
+
return compile_id unless activity.to_h[:config][:each] == true
|
72
72
|
|
73
73
|
index = captured_node.captured_input.data[:ctx_snapshot].fetch(:index)
|
74
74
|
|
@@ -94,16 +94,20 @@ module Trailblazer
|
|
94
94
|
# This activity is passed into the {Runner} for each iteration of {block_activity}.
|
95
95
|
container_activity = Activity::TaskWrap.container_activity_for(
|
96
96
|
block_activity,
|
97
|
-
|
98
|
-
|
99
|
-
|
97
|
+
id: "invoke_block_activity",
|
98
|
+
# merged into {:config}:
|
99
|
+
each: true, # mark this activity for {compute_runtime_id}.
|
100
100
|
).merge(
|
101
|
-
|
102
|
-
# because when patching, the container_activity is not recompiled, so we need the Hash here
|
103
|
-
# with defaulting.
|
104
|
-
wrap_static: Hash.new(wrap_static_for_block_activity)
|
101
|
+
outputs: outputs_from_block_activity,
|
105
102
|
)
|
106
103
|
|
104
|
+
# FIXME: we can't pass {wrap_static: wrap_static_for_block_activity} into {#container_activity_for}
|
105
|
+
# because when patching, the container_activity is not recompiled, so we need the Hash here
|
106
|
+
# with defaulting.
|
107
|
+
# FIXME: this "hack" is only here to satify patching.
|
108
|
+
config = container_activity[:config].merge(wrap_static: Hash.new(wrap_static_for_block_activity))
|
109
|
+
container_activity.merge!(config: config)
|
110
|
+
|
107
111
|
# DISCUSS: move to Wrap.
|
108
112
|
termini_from_block_activity =
|
109
113
|
outputs_from_block_activity.
|
@@ -113,7 +113,7 @@ module Trailblazer
|
|
113
113
|
def self.host_activity_for(activity:)
|
114
114
|
Activity::TaskWrap.container_activity_for(
|
115
115
|
activity,
|
116
|
-
|
116
|
+
id: activity.to_s
|
117
117
|
)
|
118
118
|
end
|
119
119
|
|
@@ -127,7 +127,7 @@ module Trailblazer
|
|
127
127
|
# this will help when semantics overlap.
|
128
128
|
#
|
129
129
|
def self.Static(decider, id:, auto_wire:)
|
130
|
-
|
130
|
+
decider_connectors = auto_wire.collect do |activity|
|
131
131
|
[Activity::Railway.Output(activity, "decision:#{activity}"), Activity::Railway.Track(activity)]
|
132
132
|
end.to_h
|
133
133
|
|
@@ -136,7 +136,7 @@ module Trailblazer
|
|
136
136
|
{
|
137
137
|
task: Static.method(:return_route_signal),
|
138
138
|
id: :route_to_nested_activity, # returns the {nested_activity} signal
|
139
|
-
}.merge(
|
139
|
+
}.merge(decider_connectors)
|
140
140
|
)
|
141
141
|
|
142
142
|
auto_wire.each do |activity|
|
data/test/docs/each_test.rb
CHANGED
@@ -54,10 +54,11 @@ class EachTest < Minitest::Spec
|
|
54
54
|
def composers_for_each(ctx, model:, **)
|
55
55
|
model.composers
|
56
56
|
end
|
57
|
-
|
57
|
+
#:iterated-value
|
58
58
|
def notify_composers(ctx, index:, item:, **)
|
59
59
|
ctx[:value] = [index, item.full_name]
|
60
60
|
end
|
61
|
+
#:iterated-value end
|
61
62
|
|
62
63
|
#~meths
|
63
64
|
def model(ctx, params:, **)
|
@@ -590,9 +591,10 @@ class EachStrategyComplianceTest < Minitest::Spec
|
|
590
591
|
EachPureTest::Mailer.send_options = []
|
591
592
|
|
592
593
|
#:patch
|
593
|
-
cover_patched = Trailblazer::Activity::DSL::Linear.
|
594
|
+
cover_patched = Trailblazer::Activity::DSL::Linear::Patch.(
|
594
595
|
Song::Activity::Cover,
|
595
|
-
["Each/composers_for_each", "Each.iterate.block"]
|
596
|
+
["Each/composers_for_each", "Each.iterate.block"],
|
597
|
+
-> { step :log_email }
|
596
598
|
)
|
597
599
|
#:patch end
|
598
600
|
cover_patched.include(T.def_steps(:log_email, :notify_composers))
|
@@ -707,7 +709,7 @@ class EachIDTest < Minitest::Spec
|
|
707
709
|
assert_equal Trailblazer::Developer::Introspect.find_path(activity, ["Each-1"])[0].id, "Each-1"
|
708
710
|
assert_equal Trailblazer::Developer::Introspect.find_path(activity, ["Each/composers_for_each"])[0].id, "Each/composers_for_each"
|
709
711
|
|
710
|
-
assert_match /Each\/\w+/, Trailblazer::Activity::Introspect::
|
712
|
+
assert_match /Each\/\w+/, Trailblazer::Activity::Introspect::Nodes(activity).values[1].id # FIXME: this test sucks.
|
711
713
|
end
|
712
714
|
end
|
713
715
|
|
data/test/docs/wrap_test.rb
CHANGED
@@ -650,9 +650,10 @@ class WrapUnitTest < Minitest::Spec
|
|
650
650
|
%{#<Trailblazer::Activity::TaskBuilder::Task user_proc=validate>}
|
651
651
|
|
652
652
|
#@ Patch interface
|
653
|
-
patched_activity = Trailblazer::Activity::DSL::Linear.
|
653
|
+
patched_activity = Trailblazer::Activity::DSL::Linear::Patch.call(
|
654
654
|
activity,
|
655
|
-
["Wrap/WrapUnitTest::HandleUnsafeProcess"]
|
655
|
+
["Wrap/WrapUnitTest::HandleUnsafeProcess"],
|
656
|
+
-> { step mock_validation, replace: :validation, id: :validation }
|
656
657
|
)
|
657
658
|
|
658
659
|
#@ the original activity with Wrap is unchanged.
|
@@ -668,9 +669,10 @@ class WrapStrategyComplianceTest < Minitest::Spec
|
|
668
669
|
|
669
670
|
it do
|
670
671
|
#:patch
|
671
|
-
upload_with_upsert = Trailblazer::Activity::DSL::Linear.
|
672
|
+
upload_with_upsert = Trailblazer::Activity::DSL::Linear::Patch.call(
|
672
673
|
Song::Activity::Upload,
|
673
|
-
["Wrap/MyTransaction"]
|
674
|
+
["Wrap/MyTransaction"],
|
675
|
+
-> { step :upsert, replace: :update }
|
674
676
|
)
|
675
677
|
#:patch end
|
676
678
|
upload_with_upsert.include(T.def_steps(:upsert))
|
data/test/test_helper.rb
CHANGED
@@ -1,31 +1,11 @@
|
|
1
1
|
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
|
2
|
-
require "trailblazer/macro"
|
3
|
-
|
4
|
-
require "delegate" # Ruby 2.2
|
5
2
|
require "minitest/autorun"
|
6
3
|
|
4
|
+
require "trailblazer/macro"
|
7
5
|
require "trailblazer/developer"
|
6
|
+
require "trailblazer/activity/testing"
|
8
7
|
|
9
|
-
|
10
|
-
class Result
|
11
|
-
def initialize(bool); @bool = bool end
|
12
|
-
def success?; @bool end
|
13
|
-
def errors; ["hihi"] end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
module Test
|
18
|
-
module ReturnCall
|
19
|
-
def self.included(includer)
|
20
|
-
includer._insert :_insert, ReturnResult, {replace: Trailblazer::Operation::Result::Build}, ReturnResult, ""
|
21
|
-
end
|
22
|
-
end
|
23
|
-
ReturnResult = ->(last, input, options) { input }
|
24
|
-
end
|
25
|
-
|
26
|
-
require "pp"
|
27
|
-
|
28
|
-
# Minitest::Spec::Operation = Trailblazer::Operation
|
8
|
+
T = Trailblazer::Activity::Testing
|
29
9
|
|
30
10
|
Memo = Struct.new(:id, :body) do
|
31
11
|
def self.find(id)
|
@@ -34,9 +14,6 @@ Memo = Struct.new(:id, :body) do
|
|
34
14
|
end
|
35
15
|
end
|
36
16
|
|
37
|
-
require "trailblazer/activity/testing"
|
38
|
-
T = Trailblazer::Activity::Testing
|
39
|
-
|
40
17
|
module Rehash
|
41
18
|
def rehash(ctx, seq:, rehash_raise: false, **)
|
42
19
|
seq << :rehash
|
@@ -53,23 +30,3 @@ Minitest::Spec.class_eval do
|
|
53
30
|
return Trailblazer::Developer::Trace::Present.(stack, node_options: {stack.to_a[0]=>{label: "TOP"}}).gsub(/:\d+/, ""), signal, ctx
|
54
31
|
end
|
55
32
|
end
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
# signal, (ctx, _) = Trailblazer::Activity.(Song::Activity::Create,
|
60
|
-
# params: {title: "Olympia"}, # some random variable.
|
61
|
-
# "model.class": Hit,
|
62
|
-
# "model.action": :find_by,
|
63
|
-
# "model.find_by_key": :title, seq: []
|
64
|
-
# )
|
65
|
-
|
66
|
-
# #:update-ok
|
67
|
-
# signal, (ctx, _) = Trailblazer::Activity.(Song::Activity::Update, params: {id: 1}, seq: [])
|
68
|
-
# ctx[:model] #=> #<Song id=1, ...>
|
69
|
-
# puts signal #=> #<Trailblazer::Activity::End semantic=:success>
|
70
|
-
# #:update-ok end
|
71
|
-
|
72
|
-
|
73
|
-
# require "trailblazer/core"
|
74
|
-
# Trailblazer::Core.convert_operation_test("test/docs/model_test.rb")
|
75
|
-
# Trailblazer::Core.convert_operation_test("test/docs/each_test.rb")
|
data/trailblazer-macro.gemspec
CHANGED
@@ -5,8 +5,8 @@ require 'trailblazer/macro/version'
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = "trailblazer-macro"
|
7
7
|
spec.version = Trailblazer::Version::Macro::VERSION
|
8
|
-
spec.authors = ["Nick Sutterer"
|
9
|
-
spec.email = ["apotonick@gmail.com"
|
8
|
+
spec.authors = ["Nick Sutterer"]
|
9
|
+
spec.email = ["apotonick@gmail.com"]
|
10
10
|
spec.description = "Macros for Trailblazer's operation"
|
11
11
|
spec.summary = "Macros for Trailblazer's operation: Policy, Wrap, Rescue and more."
|
12
12
|
spec.homepage = "http://trailblazer.to"
|
@@ -20,9 +20,9 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.add_development_dependency "minitest"
|
21
21
|
spec.add_development_dependency "rake"
|
22
22
|
spec.add_development_dependency "trailblazer-developer"
|
23
|
+
spec.add_dependency "trailblazer-operation", ">= 0.10.0" # TODO: this dependency will be removed. currently needed for tests and for Guard::Result
|
23
24
|
|
24
|
-
spec.add_dependency "trailblazer-activity-dsl-linear", ">= 1.
|
25
|
-
spec.add_dependency "trailblazer-operation", ">= 0.9.0" # TODO: this dependency will be removed. currently needed for tests?! and for Guard::Result
|
25
|
+
spec.add_dependency "trailblazer-activity-dsl-linear", ">= 1.2.0", "< 1.3.0"
|
26
26
|
|
27
|
-
spec.required_ruby_version = ">= 2.
|
27
|
+
spec.required_ruby_version = ">= 2.5.0"
|
28
28
|
end
|
metadata
CHANGED
@@ -1,15 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: trailblazer-macro
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nick Sutterer
|
8
|
-
- Marc Tich
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2023-03-02 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: minitest
|
@@ -54,51 +53,47 @@ dependencies:
|
|
54
53
|
- !ruby/object:Gem::Version
|
55
54
|
version: '0'
|
56
55
|
- !ruby/object:Gem::Dependency
|
57
|
-
name: trailblazer-
|
56
|
+
name: trailblazer-operation
|
58
57
|
requirement: !ruby/object:Gem::Requirement
|
59
58
|
requirements:
|
60
59
|
- - ">="
|
61
60
|
- !ruby/object:Gem::Version
|
62
|
-
version:
|
63
|
-
- - "<"
|
64
|
-
- !ruby/object:Gem::Version
|
65
|
-
version: 1.2.0
|
61
|
+
version: 0.10.0
|
66
62
|
type: :runtime
|
67
63
|
prerelease: false
|
68
64
|
version_requirements: !ruby/object:Gem::Requirement
|
69
65
|
requirements:
|
70
66
|
- - ">="
|
71
67
|
- !ruby/object:Gem::Version
|
72
|
-
version:
|
73
|
-
- - "<"
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: 1.2.0
|
68
|
+
version: 0.10.0
|
76
69
|
- !ruby/object:Gem::Dependency
|
77
|
-
name: trailblazer-
|
70
|
+
name: trailblazer-activity-dsl-linear
|
78
71
|
requirement: !ruby/object:Gem::Requirement
|
79
72
|
requirements:
|
80
73
|
- - ">="
|
81
74
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
75
|
+
version: 1.2.0
|
76
|
+
- - "<"
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: 1.3.0
|
83
79
|
type: :runtime
|
84
80
|
prerelease: false
|
85
81
|
version_requirements: !ruby/object:Gem::Requirement
|
86
82
|
requirements:
|
87
83
|
- - ">="
|
88
84
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
85
|
+
version: 1.2.0
|
86
|
+
- - "<"
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: 1.3.0
|
90
89
|
description: Macros for Trailblazer's operation
|
91
90
|
email:
|
92
91
|
- apotonick@gmail.com
|
93
|
-
- marc@mudsu.com
|
94
92
|
executables: []
|
95
93
|
extensions: []
|
96
94
|
extra_rdoc_files: []
|
97
95
|
files:
|
98
96
|
- ".github/workflows/ci.yml"
|
99
|
-
- ".github/workflows/ci_jruby.yml"
|
100
|
-
- ".github/workflows/ci_legacy.yml"
|
101
|
-
- ".github/workflows/ci_truffleruby.yml"
|
102
97
|
- ".gitignore"
|
103
98
|
- CHANGES.md
|
104
99
|
- Gemfile
|
@@ -143,7 +138,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
143
138
|
requirements:
|
144
139
|
- - ">="
|
145
140
|
- !ruby/object:Gem::Version
|
146
|
-
version: 2.
|
141
|
+
version: 2.5.0
|
147
142
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
148
143
|
requirements:
|
149
144
|
- - ">="
|
@@ -1,19 +0,0 @@
|
|
1
|
-
## This file is managed by Terraform.
|
2
|
-
## Do not modify this file directly, as it may be overwritten.
|
3
|
-
## Please open an issue instead.
|
4
|
-
name: CI JRuby
|
5
|
-
on: [push, pull_request]
|
6
|
-
jobs:
|
7
|
-
test:
|
8
|
-
strategy:
|
9
|
-
fail-fast: false
|
10
|
-
matrix:
|
11
|
-
ruby: [jruby, jruby-head]
|
12
|
-
runs-on: ubuntu-latest
|
13
|
-
steps:
|
14
|
-
- uses: actions/checkout@v3
|
15
|
-
- uses: ruby/setup-ruby@v1
|
16
|
-
with:
|
17
|
-
ruby-version: ${{ matrix.ruby }}
|
18
|
-
bundler-cache: true
|
19
|
-
- run: bundle exec rake
|
@@ -1,19 +0,0 @@
|
|
1
|
-
## This file is managed by Terraform.
|
2
|
-
## Do not modify this file directly, as it may be overwritten.
|
3
|
-
## Please open an issue instead.
|
4
|
-
name: CI with EOL ruby versions
|
5
|
-
on: [push, pull_request]
|
6
|
-
jobs:
|
7
|
-
test:
|
8
|
-
strategy:
|
9
|
-
fail-fast: false
|
10
|
-
matrix:
|
11
|
-
ruby: [2.5, 2.6]
|
12
|
-
runs-on: ubuntu-latest
|
13
|
-
steps:
|
14
|
-
- uses: actions/checkout@v3
|
15
|
-
- uses: ruby/setup-ruby@v1
|
16
|
-
with:
|
17
|
-
ruby-version: ${{ matrix.ruby }}
|
18
|
-
bundler-cache: true
|
19
|
-
- run: bundle exec rake
|
@@ -1,19 +0,0 @@
|
|
1
|
-
## This file is managed by Terraform.
|
2
|
-
## Do not modify this file directly, as it may be overwritten.
|
3
|
-
## Please open an issue instead.
|
4
|
-
name: CI TruffleRuby
|
5
|
-
on: [push, pull_request]
|
6
|
-
jobs:
|
7
|
-
test:
|
8
|
-
strategy:
|
9
|
-
fail-fast: false
|
10
|
-
matrix:
|
11
|
-
ruby: [truffleruby, truffleruby-head]
|
12
|
-
runs-on: ubuntu-latest
|
13
|
-
steps:
|
14
|
-
- uses: actions/checkout@v3
|
15
|
-
- uses: ruby/setup-ruby@v1
|
16
|
-
with:
|
17
|
-
ruby-version: ${{ matrix.ruby }}
|
18
|
-
bundler-cache: true
|
19
|
-
- run: bundle exec rake
|