trailblazer-macro 2.1.12 → 2.1.13

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 14fa43e34517eca4e07e257fc5a172f406b88294b72f222109203156af53b684
4
- data.tar.gz: 4d357be0a556d5431d7e10971e8ca1f9853e8029ecd5c1835c356d2169c9b7cb
3
+ metadata.gz: 5cdf91d3afe4c31815401fd46ca1b6a8778dd2b1b89db4871c7dcff708cc73ff
4
+ data.tar.gz: 48c050c6086a5be67804385a427a95e0df1ab4cf0802de5004b61a96a8e54ced
5
5
  SHA512:
6
- metadata.gz: 600a2b8ae99cb504a0574b929e59ca63edc219b43e219b5af3c414d0c362e323f3cb6ff276f86ce02b19466aab1723ae60bc8b34f91d94764f3b82eadeaa7c2c
7
- data.tar.gz: f03b36faa58d2e0ea5c265b48194cd14bb5825cfecace98777637d44a91bb2404ebb710e1db3ce7a7b7b383158413db9f4ffac5f6bb7abf7226ea1e02749d97c
6
+ metadata.gz: 3a27a00484972d2c65a6ffad50bd34e1fff0cfee69382bb5fabd3a06f20e15f818f95d44ce03a13727095fe352901ca0fdfcc544e15ec066bc73e43d14b8b6df
7
+ data.tar.gz: c64786889c195182f399c9df157f67926622ae7c032d9ef8c8de47db89b37750544721b1261a7ea5fe5f731208eccb3192aac2fe2c92b77036cbcd3ce68e4070
data/CHANGES.md CHANGED
@@ -1,3 +1,7 @@
1
+ # 2.1.13
2
+
3
+ * Fix an introspect bug in `Each()` where we couldn't look into `"invoke_block_activity"`.
4
+
1
5
  # 2.1.12
2
6
 
3
7
  ## Internals
@@ -52,6 +52,12 @@ module Trailblazer
52
52
  end
53
53
 
54
54
  return signal, [ctx, flow_options]
55
+ end #call
56
+
57
+ def self.to_h
58
+ container_activity = @state.get(:activity)
59
+ # FIXME: this is needed for a proper {find_path} introspect lookup.
60
+ container_activity.to_h.merge(activity: container_activity)
55
61
  end
56
62
 
57
63
  # This is basically Out() => {copy all mutable variables}
@@ -90,7 +96,11 @@ module Trailblazer
90
96
  block_activity,
91
97
  each: true, # mark this activity for {compute_runtime_id}.
92
98
  nodes: [Activity::NodeAttributes.new("invoke_block_activity", nil, block_activity)], # TODO: use TaskMap::TaskAttributes
99
+ outputs: outputs_from_block_activity,
93
100
  ).merge(
101
+ # FIXME: we can't pass {wrap_static: wrap_static_for_block_activity} into {#container_activity_for}
102
+ # because when patching, the container_activity is not recompiled, so we need the Hash here
103
+ # with defaulting.
94
104
  wrap_static: Hash.new(wrap_static_for_block_activity)
95
105
  )
96
106
 
@@ -111,9 +121,16 @@ module Trailblazer
111
121
  success_signal: [termini_from_block_activity[-1][0], {}] # FIXME: when subclassing (e.g. patching) this must be recomputed.
112
122
  )
113
123
 
114
- # {block_activity} looped. In the Stack, this will look as if {block_activity} is
115
- # a child of {iterate_activity}, that's why we add {block_activity} as a Node in
116
- # {iterate_activity}'s schema.
124
+ # |-- Each/composers_for_each
125
+ # | |-- Start.default
126
+ # | |-- Each.iterate.block This is Class.new(Each), outputs_from_block_activity
127
+ # | | |-- invoke_block_activity.0 step :invoke_block_activity.0
128
+ # | | | |-- Start.default
129
+ # | | | |-- notify_composers
130
+ # | | | `-- End.success
131
+ # | | `-- invoke_block_activity.1 step "invoke_block_activity.1"
132
+ # | | |-- Start.default
133
+ # | | |-- notify_composers
117
134
  iterate_strategy = Class.new(Each) do
118
135
  extend Macro::Strategy::State # now, the Wrap subclass can inherit its state and copy the {block_activity}.
119
136
  initialize!(state)
@@ -1,7 +1,7 @@
1
1
  module Trailblazer
2
2
  module Version
3
3
  module Macro
4
- VERSION = "2.1.12"
4
+ VERSION = "2.1.13"
5
5
  end
6
6
  end
7
7
  end
@@ -616,20 +616,53 @@ class EachStrategyComplianceTest < Minitest::Spec
616
616
 
617
617
  it "find_path" do
618
618
  assert_equal Trailblazer::Developer::Introspect.find_path(Song::Activity::Cover,
619
- ["Each/composers_for_each", "Each.iterate.block", :notify_composers])[0].task.inspect,
619
+ ["Each/composers_for_each", "Each.iterate.block", "invoke_block_activity", :notify_composers])[0].task.inspect,
620
620
  %{#<Trailblazer::Activity::TaskBuilder::Task user_proc=notify_composers>}
621
621
 
622
622
  =begin
623
623
  #:find_path
624
624
  node, _ = Trailblazer::Developer::Introspect.find_path(
625
625
  Song::Activity::Cover,
626
- ["Each/composers_for_each", "Each.iterate.block", :notify_composers])
626
+ ["Each/composers_for_each", "Each.iterate.block", "invoke_block_activity", :notify_composers])
627
627
  #=> #<Node ...>
628
628
  #:find_path end
629
629
  =end
630
630
 
631
631
  end
632
632
 
633
+ it "{#find_path} for Each(Activity) with anonymous class" do
634
+ id = nil
635
+
636
+ activity = Class.new(Trailblazer::Activity::Railway) do
637
+ sub_activity = Class.new(Trailblazer::Activity::Railway) do
638
+ step :notify_composers
639
+ end
640
+ id = sub_activity.to_s
641
+
642
+ step :model
643
+ step Each(sub_activity, dataset_from: :composers_for_each)
644
+ step :rearrange
645
+
646
+ def composers_for_each(ctx, model:, **)
647
+ model.composers
648
+ end
649
+ # include CoverMethods
650
+ end
651
+
652
+ node, _activity = Trailblazer::Developer::Introspect.find_path(activity,
653
+ [%{Each/#{id}}, "Each.iterate.#{id}", "invoke_block_activity"])
654
+
655
+ assert_equal _activity.class.inspect, "Hash" # container_activity
656
+
657
+ #@ inside {invoke_block_activity}
658
+ node, _activity = Trailblazer::Developer::Introspect.find_path(activity,
659
+ [%{Each/#{id}}, "Each.iterate.#{id}", "invoke_block_activity", :notify_composers])
660
+
661
+ assert_equal node.task.inspect,
662
+ %{#<Trailblazer::Activity::TaskBuilder::Task user_proc=notify_composers>}
663
+ assert_equal _activity.class.inspect, "Trailblazer::Activity"
664
+ end
665
+
633
666
 
634
667
  it "tracing" do
635
668
  EachPureTest::Mailer.send_options = []
@@ -731,7 +764,7 @@ class DocsEachUnitTest < Minitest::Spec
731
764
  #@ compile time
732
765
  #@ make sure we can find tasks/compile-time artifacts in Each by using their {compile_id}.
733
766
  assert_equal Trailblazer::Developer::Introspect.find_path(activity,
734
- ["Each/1", "Each.iterate.block", :compute_item])[0].task.inspect,
767
+ ["Each/1", "Each.iterate.block", "invoke_block_activity", :compute_item])[0].task.inspect,
735
768
  %{#<Trailblazer::Activity::TaskBuilder::Task user_proc=compute_item>}
736
769
  # puts Trailblazer::Developer::Render::TaskWrap.(activity, ["Each/1", "Each.iterate.block", "invoke_block_activity", :compute_item])
737
770
 
@@ -22,7 +22,7 @@ Gem::Specification.new do |spec|
22
22
  spec.add_development_dependency "trailblazer-developer"
23
23
 
24
24
  spec.add_dependency "trailblazer-activity-dsl-linear", ">= 1.1.0", "< 1.2.0"
25
- spec.add_dependency "trailblazer-operation", ">= 0.9.0" # TODO: this dependency will be removed. currently needed for tests?!
25
+ spec.add_dependency "trailblazer-operation", ">= 0.9.0" # TODO: this dependency will be removed. currently needed for tests?! and for Guard::Result
26
26
 
27
27
  spec.required_ruby_version = ">= 2.2.0"
28
28
  end
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.12
4
+ version: 2.1.13
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: 2022-12-14 00:00:00.000000000 Z
12
+ date: 2022-12-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: minitest