trailblazer-operation 0.10.0 → 0.11.0

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.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +2 -2
  3. data/CHANGES.md +15 -0
  4. data/lib/trailblazer/operation/class_dependencies.rb +1 -1
  5. data/lib/trailblazer/operation/public_call.rb +24 -14
  6. data/lib/trailblazer/operation/railway.rb +13 -7
  7. data/lib/trailblazer/operation/version.rb +1 -1
  8. data/lib/trailblazer/operation/wtf.rb +11 -0
  9. data/lib/trailblazer/operation.rb +2 -2
  10. data/test/call_test.rb +32 -10
  11. data/test/class_dependencies_test.rb +8 -4
  12. data/test/docs/autogenerated/activity_basics_test.rb +72 -0
  13. data/test/docs/autogenerated/composable_variable_mapping_test.rb +880 -0
  14. data/test/docs/autogenerated/fast_track_layout_test.rb +76 -0
  15. data/test/docs/autogenerated/mechanics_test.rb +382 -0
  16. data/test/docs/autogenerated/sequence_options_test.rb +202 -0
  17. data/test/docs/autogenerated/subprocess_test.rb +257 -0
  18. data/test/docs/autogenerated/wiring_api_test.rb +435 -0
  19. data/test/docs/developer_test.rb +27 -0
  20. data/test/docs/public_call_monkeypatching_test.rb +96 -0
  21. data/test/docs/result_test.rb +38 -0
  22. data/test/docs/step_dsl_test.rb +93 -0
  23. data/test/operation_test.rb +53 -13
  24. data/test/result_test.rb +1 -1
  25. data/test/test_helper.rb +17 -5
  26. data/test/trace_test.rb +3 -19
  27. data/trailblazer-operation.gemspec +3 -2
  28. metadata +50 -25
  29. data/lib/trailblazer/operation/trace.rb +0 -53
  30. data/test/callable_test.rb +0 -147
  31. data/test/docs/doormat_test.rb +0 -190
  32. data/test/docs/macaroni_test.rb +0 -31
  33. data/test/skill_test.rb +0 -66
  34. data/test/wire_test.rb +0 -113
  35. data/test/wiring/defaults_test.rb +0 -193
  36. data/test/wiring/subprocess_test.rb +0 -70
@@ -0,0 +1,27 @@
1
+ require "test_helper"
2
+
3
+ class Wtf_DeveloperDocsTest < Minitest::Spec
4
+ Memo = Class.new
5
+ module Memo::Operation
6
+ class Create < Trailblazer::Operation
7
+ step :validate
8
+ step :save
9
+ left :handle_errors
10
+ step :notify
11
+ #~meths
12
+ include T.def_steps(:validate, :save, :handle_errors, :notify)
13
+ #~meths end
14
+ end
15
+ end
16
+
17
+ it "what" do
18
+ #:wtf
19
+ result = Memo::Operation::Create.wtf?(
20
+ #~meths
21
+ seq: [],
22
+ #~meths end
23
+ params: {memo: "remember me!"}
24
+ )
25
+ #:wtf end
26
+ end
27
+ end
@@ -0,0 +1,96 @@
1
+ require "test_helper"
2
+
3
+ class PublicCallMonkeypatchingTest < Minitest::Spec
4
+ #@ test overriding {Operation.call_with_public_interface}
5
+ #@
6
+ module AfterCall
7
+ def self.add_task_name(wrap_ctx, original_args)
8
+ (ctx, _flow_options), circuit_options = original_args
9
+
10
+ activity = circuit_options[:activity] # currently running Activity.
11
+ task = wrap_ctx[:task] # the current "step".
12
+ task_id = Trailblazer::Activity::Introspect.Nodes(activity, task: task).id
13
+
14
+ ctx[:seq] << task_id
15
+
16
+ return wrap_ctx, original_args # yay to mutable state. not.
17
+ end
18
+ end
19
+
20
+ it "overrides {call_with_public_interface} and allows injecting {circuit_options} and {flow_options} from the override" do
21
+ TaskWrapExtension = Trailblazer::Activity::TaskWrap::Extension(
22
+ [AfterCall.method(:add_task_name), id: "my.add_1", append: "task_wrap.call_task"]
23
+ )
24
+
25
+ module OperationExtensions
26
+ def call_with_public_interface(ctx, flow_options, **circuit_options)
27
+ super(
28
+ ctx,
29
+ flow_options.merge({}),
30
+ **circuit_options.merge(
31
+ wrap_runtime: Hash.new(TaskWrapExtension),
32
+ runner: Trailblazer::Activity::TaskWrap::Runner
33
+ )
34
+ )
35
+ end
36
+ end
37
+
38
+ operation = Class.new(Trailblazer::Operation) do
39
+ step :a
40
+
41
+ include Trailblazer::Activity::Testing.def_steps(:a)
42
+ end
43
+ operation.extend OperationExtensions # monkey-patch the "global" Operation.
44
+
45
+
46
+ # circuit interface invocation using call
47
+ result = operation.call(
48
+ seq: []
49
+ )
50
+
51
+ assert_equal result.success?, true
52
+ assert_equal result[:seq], ["Start.default", :a, :a, "End.success", nil] # {nil} because we don't have an ID for the actual operation.
53
+ end
54
+ end
55
+
56
+ class FlowOptionsMonkeypatching < Minitest::Spec
57
+ module App
58
+ FLOW_OPTIONS = {
59
+ context_options: {
60
+ aliases: { "contract.default": :contract },
61
+ container_class: Trailblazer::Context::Container::WithAliases,
62
+ }
63
+ }
64
+
65
+ module OperationExtensions
66
+ def call_with_public_interface(ctx, flow_options, **circuit_options)
67
+ super(
68
+ ctx,
69
+ flow_options.merge(App::FLOW_OPTIONS),
70
+ **circuit_options
71
+ )
72
+ end
73
+ end
74
+ end
75
+
76
+ it "inject aliases for the global run via {flow_options}" do
77
+ operation = Class.new(Trailblazer::Operation) do
78
+ step :a
79
+
80
+ def a(ctx, contract:, **)
81
+ ctx[:seq] << contract
82
+ end
83
+ end
84
+ operation.extend App::OperationExtensions # monkey-patch the "global" Operation.
85
+
86
+
87
+ # circuit interface invocation using call
88
+ result = operation.call(
89
+ seq: [],
90
+ :"contract.default" => Object,
91
+ )
92
+
93
+ assert_equal result.success?, true
94
+ assert_equal result[:seq].inspect, %([Object])
95
+ end
96
+ end
@@ -0,0 +1,38 @@
1
+ require "test_helper"
2
+
3
+ module A
4
+ class DocsResultTest < Minitest::Spec
5
+ Memo = Class.new
6
+ module Memo::Operation
7
+ class Create < Trailblazer::Operation
8
+ step :validate, Output(:failure) => End(:validation_error)
9
+ step :save
10
+ include T.def_steps(:validate, :save)
11
+ end
12
+ end
13
+
14
+ it "exposes {#terminus}" do
15
+ result = Memo::Operation::Create.(seq: [])
16
+ assert_equal CU.inspect(result.terminus.to_h), %({:semantic=>:success})
17
+
18
+ result = Memo::Operation::Create.(validate: false, seq: [])
19
+ assert_equal CU.inspect(result.terminus.to_h), %({:semantic=>:validation_error})
20
+
21
+ result = Memo::Operation::Create.(save: false, seq: [])
22
+ assert_equal CU.inspect(result.terminus.to_h), %({:semantic=>:failure})
23
+ end
24
+
25
+ it "deprecates Result#event" do
26
+ result = Memo::Operation::Create.(seq: [])
27
+ terminus = nil
28
+
29
+ _, warning = capture_io do
30
+ terminus = result.event
31
+ end
32
+ line_no = __LINE__ - 2
33
+
34
+ assert_equal warning, %{[Trailblazer] #{File.realpath(__FILE__)}:#{line_no} Using `Result#event` is deprecated, please use `Result#terminus`\n}
35
+ assert_equal CU.inspect(terminus.to_h), %({:semantic=>:success})
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,93 @@
1
+ require "test_helper"
2
+
3
+ module A
4
+ class DocsStepTest < Minitest::Spec
5
+ Memo = Module.new
6
+
7
+ #:railway
8
+ module Memo::Operation
9
+ class Create < Trailblazer::Operation
10
+ step :validate
11
+ step :save
12
+ #~step
13
+ left :handle_errors
14
+ #~left
15
+ step :notify
16
+ #~meths
17
+ # fail :log_error
18
+ # step :save
19
+ def validate(ctx, params:, **)
20
+ ctx[:input] = Form.validate(params) # true/false
21
+ end
22
+
23
+ # def create(ctx, input:, create:, **)
24
+ # create
25
+ # end
26
+
27
+ # def log_error(ctx, logger:, params:, **)
28
+ # logger.error("wrong params: #{params.inspect}")
29
+ # end
30
+ #~meths end
31
+ end
32
+ end
33
+ #~step end
34
+ #~left end
35
+ #:railway end
36
+
37
+ # it "what" do
38
+ # ctx = {params: {text: "Hydrate!"}, create: true}
39
+ # signal, (ctx, _flow_options) = D::Create.([ctx, {}])
40
+ # end
41
+ end
42
+ end
43
+
44
+
45
+ module B
46
+ class Fail_DocsStepTest < Minitest::Spec
47
+ Memo = Module.new
48
+
49
+ #:fail
50
+ module Memo::Operation
51
+ class Create < Trailblazer::Operation
52
+ step :validate
53
+ step :save
54
+ fail :handle_errors # just like {#left}
55
+ #~meths
56
+ step :notify
57
+ include T.def_steps(:validate, :save, :handle_errors, :notify)
58
+ #~meths end
59
+ end
60
+ end
61
+ #:fail end
62
+
63
+ it "what" do
64
+ assert_invoke Memo::Operation::Create, seq: "[:validate, :save, :notify]"
65
+ assert_invoke Memo::Operation::Create, validate: false, terminus: :failure, seq: "[:validate, :handle_errors]"
66
+ end
67
+ end
68
+ end
69
+
70
+ module A
71
+ class Pass_DocsStepTest < Minitest::Spec
72
+ Memo = Module.new
73
+
74
+ #:pass
75
+ module Memo::Operation
76
+ class Create < Trailblazer::Operation
77
+ step :validate
78
+ pass :save # no output goes to the failure track here.
79
+ left :handle_errors
80
+ #~meths
81
+ step :notify
82
+ include T.def_steps(:validate, :save, :handle_errors, :notify)
83
+ #~meths end
84
+ end
85
+ end
86
+ #:pass end
87
+
88
+ it "what" do
89
+ assert_invoke Memo::Operation::Create, seq: "[:validate, :save, :notify]"
90
+ assert_invoke Memo::Operation::Create, validate: false, terminus: :failure, seq: "[:validate, :handle_errors]"
91
+ end
92
+ end
93
+ end
@@ -1,5 +1,55 @@
1
1
  require "test_helper"
2
2
 
3
+ # Tests around {Operation.call}.
4
+ class OperationTest < Minitest::Spec
5
+ class Noop < Trailblazer::Operation
6
+ def self.capture_circuit_options((ctx, flow_options), **circuit_options)
7
+ ctx[:capture_circuit_options] = circuit_options.keys.inspect
8
+
9
+ return Trailblazer::Activity::Right, [ctx, flow_options]
10
+ end
11
+
12
+ step task: method(:capture_circuit_options)
13
+ end
14
+
15
+ # Mixing keywords and string keys in {Operation.call}.
16
+ # Test that {.(params: {}, "current_user" => user)} is processed properly
17
+
18
+ it "doesn't mistake circuit options as ctx variables when using circuit-interface" do
19
+ signal, (ctx, _) = Noop.call(
20
+ [{params: {}}, {}],
21
+ # real circuit_options
22
+ variable_for_circuit_options: true
23
+ ) # call_with_public_interface
24
+ #@ {:variable_for_circuit_options} is not supposed to be in {ctx}.
25
+ assert_equal CU.inspect(ctx), %({:params=>{}, :capture_circuit_options=>"[:variable_for_circuit_options, :exec_context, :activity, :runner]"})
26
+ end
27
+
28
+ it "doesn't mistake circuit options as ctx variables when using the call interface" do
29
+ result = Noop.call(
30
+ params: {},
31
+ model: true,
32
+ "current_user" => Object
33
+ ) # call with public interface.
34
+ #@ {:variable_for_circuit_options} is not supposed to be in {ctx}.
35
+ assert_result result, {params: {}, model: true, current_user: Object, capture_circuit_options: "[:wrap_runtime, :activity, :exec_context, :runner]"}
36
+ end
37
+
38
+ #@ {#call_with_public_interface}
39
+ it "doesn't mistake circuit options as ctx variables when using circuit-interface" do
40
+ result = Noop.call_with_public_interface(
41
+ {params: {}},
42
+ {},
43
+ variable_for_circuit_options: true
44
+ ) # call_with_public_interface has two positional args, and kwargs for {circuit_options}.
45
+
46
+ assert_result result, {params: {}, capture_circuit_options: "[:variable_for_circuit_options, :wrap_runtime, :activity, :exec_context, :runner]"}
47
+ # assert_equal result.inspect, %(<Result:true #<Trailblazer::Context::Container wrapped_options={:params=>{}} mutable_options={:capture_circuit_options=>\"[:variable_for_circuit_options, :wrap_runtime, :activity, :exec_context, :runner]\"}> >)
48
+ end
49
+ end
50
+
51
+ # TODO: remove this test as many cases are covered via autogenerated activity tests.
52
+
3
53
  class DeclarativeApiTest < Minitest::Spec
4
54
  it "doesn't invoke {call} twice when using public interface" do
5
55
  class MyOp < Trailblazer::Operation
@@ -33,7 +83,7 @@ class DeclarativeApiTest < Minitest::Spec
33
83
  pass :wasnt_ok!
34
84
  pass :was_ok!
35
85
  fail :return_true!
36
- fail :return_false!
86
+ left :return_false!
37
87
 
38
88
  step :bla, input: ->(ctx, *) { {id: ctx.inspect} }, output: ->(scope, ctx) { ctx["hello"] = scope["1"]; ctx }
39
89
 
@@ -117,17 +167,6 @@ class DeclarativeApiTest < Minitest::Spec
117
167
  Unset. ("params" => {decide: true}).inspect("a", "b", "c", "d", "e").must_equal %{<Result:true [false, true, nil, 1, 2] >}
118
168
  end
119
169
 
120
- # Mixing keywords and string keys in {Operation.call}.
121
- # Test that {.(params: {}, "current_user" => user)} is processed properly
122
- class Collect < Trailblazer::Operation
123
- # step ->(ctx, **) { ctx[:keys] }
124
- end
125
-
126
- it "contains all keys from {call}" do
127
- result = Collect.(params: {}, "current_user" => Module)
128
- _(result.inspect).must_equal %{<Result:true #<Trailblazer::Context::Container wrapped_options={:params=>{}, \"current_user\"=>Module} mutable_options={}> >}
129
- end
130
-
131
170
  #---
132
171
  #- ctx container
133
172
  it do
@@ -141,9 +180,10 @@ class DeclarativeApiTest < Minitest::Spec
141
180
  signal, (ctx, _) = Update.([Update.options_for_public_call(options), {}], **{})
142
181
 
143
182
  signal.inspect.must_equal %{#<Trailblazer::Activity::Railway::End::Success semantic=:success>}
144
- ctx.inspect.must_equal %{#<Trailblazer::Context::Container wrapped_options={\"params\"=>{:decide=>true}} mutable_options={\"a\"=>false, \"b\"=>true}>}
183
+ assert_equal ctx.inspect, %(#<Trailblazer::Context::Container wrapped_options=#{{"params" => {:decide=>true}}} mutable_options=#{{"a" => false, "b" => true}}>)
145
184
 
146
185
  # Call by passing aliases as an argument.
186
+ # This uses {#call}'s second positional argument.
147
187
  if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.0.0")
148
188
  result = Update.(
149
189
  options,
data/test/result_test.rb CHANGED
@@ -19,7 +19,7 @@ class RailwayResultTest < Minitest::Spec
19
19
 
20
20
  #---
21
21
  # inspect
22
- it { success.inspect.must_equal %{<Result:true {\"x\"=>String} >} }
22
+ it { assert_equal success.inspect, %(<Result:true #{{"x" => String}} >) }
23
23
  it { Result.new(true, {"x" => true, "y" => 1, "z" => 2}, event).inspect("z", "y").must_equal %{<Result:true [2, 1] >} }
24
24
 
25
25
  class Create < Trailblazer::Operation
data/test/test_helper.rb CHANGED
@@ -1,15 +1,27 @@
1
- $LOAD_PATH.unshift File.expand_path("../lib", __dir__)
2
- require "trailblazer/operation"
1
+ require "minitest/autorun"
3
2
 
4
3
  require "pp"
4
+ require "trailblazer/operation"
5
5
 
6
- require "minitest/autorun"
7
6
  require "trailblazer/activity/testing"
8
7
  require "trailblazer/developer/render/linear"
8
+ require "trailblazer/core"
9
9
 
10
10
  Minitest::Spec.class_eval do
11
- Activity = Trailblazer::Activity
12
- T = Activity::Testing
11
+ T = Trailblazer::Activity::Testing
12
+ include Trailblazer::Activity::Testing::Assertions
13
+ CU = Trailblazer::Core::Utils
14
+
15
+ def assert_equal(asserted, expected, *args)
16
+ super(expected, asserted, *args)
17
+ end
18
+
19
+ def assert_result(result, variables, outcome: true)
20
+ assert_equal result.success?, outcome
21
+
22
+ # assert_equal result.send(:data).sort_by { |key, _| key.to_s }.to_h.inspect, variables.sort_by { |key, _| key.to_s }.to_h.inspect
23
+ assert_equal result.send(:data).to_h, variables
24
+ end
13
25
  end
14
26
 
15
27
  # TODO: replace all this with {Activity::Testing.def_steps}
data/test/trace_test.rb CHANGED
@@ -12,15 +12,14 @@ class TraceTest < Minitest::Spec
12
12
  step ->(options, **) { options[:c] = true }, id: "Create.task.c"
13
13
  step ->(_options, params:, **) { params.any? }, id: "Create.task.params"
14
14
  end
15
- # raise Create["__task_wraps__"].inspect
16
15
 
17
16
  it "allows using low-level Operation::Trace" do
18
- result = Trailblazer::Operation::Trace.(
17
+ stack, result = Trailblazer::Developer::Trace.(
19
18
  Create,
20
19
  { a_return: true, params: {} },
21
20
  )
22
21
 
23
- output = result.wtf
22
+ output = Trailblazer::Developer::Trace::Present.(stack)
24
23
 
25
24
  assert_equal output.gsub(/0x\w+/, "").gsub(/@.+_test/, ""), %{TraceTest::Create
26
25
  |-- Start.default
@@ -35,21 +34,6 @@ class TraceTest < Minitest::Spec
35
34
  `-- End.failure}
36
35
  end
37
36
 
38
- it "Operation::trace" do
39
- result = Create.trace(params: {x: 1}, a_return: true)
40
- assert_equal result.wtf.gsub(/0x\w+/, "").gsub(/@.+_test/, ""), %{TraceTest::Create
41
- |-- Start.default
42
- |-- Create.task.a
43
- |-- MyNested
44
- | |-- Start.default
45
- | |-- B.task.b
46
- | |-- B.task.e
47
- | `-- End.success
48
- |-- Create.task.c
49
- |-- Create.task.params
50
- `-- End.success}
51
- end
52
-
53
37
  it "Operation.wtf?" do
54
38
  result = nil
55
39
  output, = capture_io do
@@ -71,6 +55,6 @@ class TraceTest < Minitest::Spec
71
55
 
72
56
  result.success?.must_equal true
73
57
  result[:a_return].must_equal true
74
- result[:params].inspect.must_equal %{{:x=>1}}
58
+ assert_equal CU.inspect(result[:params]), %({:x=>1})
75
59
  end
76
60
  end
@@ -17,13 +17,14 @@ Gem::Specification.new do |spec|
17
17
  spec.test_files = spec.files.grep(%r{^(test)/})
18
18
  spec.require_paths = ["lib"]
19
19
 
20
- spec.add_dependency "trailblazer-activity-dsl-linear", ">= 1.2.0", "< 1.4.0"
21
- spec.add_dependency "trailblazer-developer"
20
+ spec.add_dependency "trailblazer-activity-dsl-linear", ">= 1.2.3", "< 1.4.0"
21
+ spec.add_dependency "trailblazer-developer", ">= 0.1.0", "< 0.2.0"
22
22
 
23
23
  spec.add_development_dependency "bundler"
24
24
  spec.add_development_dependency "minitest"
25
25
  spec.add_development_dependency "minitest-line"
26
26
  spec.add_development_dependency "rake"
27
+ spec.add_development_dependency "trailblazer-core-utils"
27
28
 
28
29
  spec.required_ruby_version = ">= 2.5.0"
29
30
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trailblazer-operation
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0
4
+ version: 0.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick Sutterer
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2023-03-02 00:00:00.000000000 Z
10
+ date: 2024-11-15 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: trailblazer-activity-dsl-linear
@@ -16,7 +15,7 @@ dependencies:
16
15
  requirements:
17
16
  - - ">="
18
17
  - !ruby/object:Gem::Version
19
- version: 1.2.0
18
+ version: 1.2.3
20
19
  - - "<"
21
20
  - !ruby/object:Gem::Version
22
21
  version: 1.4.0
@@ -26,7 +25,7 @@ dependencies:
26
25
  requirements:
27
26
  - - ">="
28
27
  - !ruby/object:Gem::Version
29
- version: 1.2.0
28
+ version: 1.2.3
30
29
  - - "<"
31
30
  - !ruby/object:Gem::Version
32
31
  version: 1.4.0
@@ -36,14 +35,20 @@ dependencies:
36
35
  requirements:
37
36
  - - ">="
38
37
  - !ruby/object:Gem::Version
39
- version: '0'
38
+ version: 0.1.0
39
+ - - "<"
40
+ - !ruby/object:Gem::Version
41
+ version: 0.2.0
40
42
  type: :runtime
41
43
  prerelease: false
42
44
  version_requirements: !ruby/object:Gem::Requirement
43
45
  requirements:
44
46
  - - ">="
45
47
  - !ruby/object:Gem::Version
46
- version: '0'
48
+ version: 0.1.0
49
+ - - "<"
50
+ - !ruby/object:Gem::Version
51
+ version: 0.2.0
47
52
  - !ruby/object:Gem::Dependency
48
53
  name: bundler
49
54
  requirement: !ruby/object:Gem::Requirement
@@ -100,6 +105,20 @@ dependencies:
100
105
  - - ">="
101
106
  - !ruby/object:Gem::Version
102
107
  version: '0'
108
+ - !ruby/object:Gem::Dependency
109
+ name: trailblazer-core-utils
110
+ requirement: !ruby/object:Gem::Requirement
111
+ requirements:
112
+ - - ">="
113
+ - !ruby/object:Gem::Version
114
+ version: '0'
115
+ type: :development
116
+ prerelease: false
117
+ version_requirements: !ruby/object:Gem::Requirement
118
+ requirements:
119
+ - - ">="
120
+ - !ruby/object:Gem::Version
121
+ version: '0'
103
122
  description: Trailblazer's operation object.
104
123
  email:
105
124
  - apotonick@gmail.com
@@ -119,16 +138,24 @@ files:
119
138
  - lib/trailblazer/operation/public_call.rb
120
139
  - lib/trailblazer/operation/railway.rb
121
140
  - lib/trailblazer/operation/result.rb
122
- - lib/trailblazer/operation/trace.rb
123
141
  - lib/trailblazer/operation/version.rb
142
+ - lib/trailblazer/operation/wtf.rb
124
143
  - test/benchmark/skill_resolver_benchmark.rb
125
144
  - test/call_test.rb
126
- - test/callable_test.rb
127
145
  - test/class_dependencies_test.rb
146
+ - test/docs/autogenerated/activity_basics_test.rb
147
+ - test/docs/autogenerated/composable_variable_mapping_test.rb
148
+ - test/docs/autogenerated/fast_track_layout_test.rb
149
+ - test/docs/autogenerated/mechanics_test.rb
150
+ - test/docs/autogenerated/sequence_options_test.rb
151
+ - test/docs/autogenerated/subprocess_test.rb
152
+ - test/docs/autogenerated/wiring_api_test.rb
128
153
  - test/docs/class_dependencies_test.rb
129
- - test/docs/doormat_test.rb
130
- - test/docs/macaroni_test.rb
154
+ - test/docs/developer_test.rb
131
155
  - test/docs/operation_test.rb
156
+ - test/docs/public_call_monkeypatching_test.rb
157
+ - test/docs/result_test.rb
158
+ - test/docs/step_dsl_test.rb
132
159
  - test/docs/wiring_test.rb
133
160
  - test/fast_track_test.rb
134
161
  - test/gemfiles/Gemfile.ruby-1.9
@@ -139,19 +166,14 @@ files:
139
166
  - test/introspect_test.rb
140
167
  - test/operation_test.rb
141
168
  - test/result_test.rb
142
- - test/skill_test.rb
143
169
  - test/step_test.rb
144
170
  - test/test_helper.rb
145
171
  - test/trace_test.rb
146
- - test/wire_test.rb
147
- - test/wiring/defaults_test.rb
148
- - test/wiring/subprocess_test.rb
149
172
  - trailblazer-operation.gemspec
150
173
  homepage: https://trailblazer.to/2.1/docs/operation.html
151
174
  licenses:
152
175
  - MIT
153
176
  metadata: {}
154
- post_install_message:
155
177
  rdoc_options: []
156
178
  require_paths:
157
179
  - lib
@@ -166,19 +188,26 @@ required_rubygems_version: !ruby/object:Gem::Requirement
166
188
  - !ruby/object:Gem::Version
167
189
  version: '0'
168
190
  requirements: []
169
- rubygems_version: 3.2.3
170
- signing_key:
191
+ rubygems_version: 3.6.0.dev
171
192
  specification_version: 4
172
193
  summary: Trailblazer's operation object with railway flow and integrated error handling.
173
194
  test_files:
174
195
  - test/benchmark/skill_resolver_benchmark.rb
175
196
  - test/call_test.rb
176
- - test/callable_test.rb
177
197
  - test/class_dependencies_test.rb
198
+ - test/docs/autogenerated/activity_basics_test.rb
199
+ - test/docs/autogenerated/composable_variable_mapping_test.rb
200
+ - test/docs/autogenerated/fast_track_layout_test.rb
201
+ - test/docs/autogenerated/mechanics_test.rb
202
+ - test/docs/autogenerated/sequence_options_test.rb
203
+ - test/docs/autogenerated/subprocess_test.rb
204
+ - test/docs/autogenerated/wiring_api_test.rb
178
205
  - test/docs/class_dependencies_test.rb
179
- - test/docs/doormat_test.rb
180
- - test/docs/macaroni_test.rb
206
+ - test/docs/developer_test.rb
181
207
  - test/docs/operation_test.rb
208
+ - test/docs/public_call_monkeypatching_test.rb
209
+ - test/docs/result_test.rb
210
+ - test/docs/step_dsl_test.rb
182
211
  - test/docs/wiring_test.rb
183
212
  - test/fast_track_test.rb
184
213
  - test/gemfiles/Gemfile.ruby-1.9
@@ -189,10 +218,6 @@ test_files:
189
218
  - test/introspect_test.rb
190
219
  - test/operation_test.rb
191
220
  - test/result_test.rb
192
- - test/skill_test.rb
193
221
  - test/step_test.rb
194
222
  - test/test_helper.rb
195
223
  - test/trace_test.rb
196
- - test/wire_test.rb
197
- - test/wiring/defaults_test.rb
198
- - test/wiring/subprocess_test.rb
@@ -1,53 +0,0 @@
1
- require 'delegate'
2
- require "trailblazer/developer"
3
-
4
- module Trailblazer
5
- class Operation
6
- module Trace
7
- # @note The problem in this method is, we have redundancy with Operation::PublicCall
8
- def self.call(operation, options)
9
- # warn %{Trailblazer: `Operation.trace` is deprecated. Please use `Operation.wtf?`.} # DISCUSS: should this be deprecated?
10
- ctx = PublicCall.options_for_public_call(options) # redundant with PublicCall::call.
11
-
12
- stack, signal, (ctx, _flow_options) = Developer::Trace.(operation, [ctx, {}])
13
-
14
- result = Railway::Result(signal, ctx) # redundant with PublicCall::call.
15
-
16
- Result.new(result, stack.to_a)
17
- end
18
-
19
- # `Operation::trace` is included for simple tracing of the flow.
20
- # It simply forwards all arguments to `Trace.call`.
21
- #
22
- # @public
23
- #
24
- # Operation.trace(params, current_user: current_user).wtf
25
- def trace(options)
26
- Trace.(self, options)
27
- end
28
-
29
- def wtf?(options)
30
- call_with_public_interface(options, {}, invoke_class: Developer::Wtf)
31
- end
32
-
33
- # Presentation of the traced stack via the returned result object.
34
- # This object is wrapped around the original result in {Trace.call}.
35
- class Result < ::SimpleDelegator
36
- def initialize(result, stack)
37
- super(result)
38
- @stack = stack
39
- end
40
-
41
- # TODO: deprecate!
42
- def wtf
43
- Developer::Trace::Present.(@stack)
44
- end
45
-
46
- # TODO: deprecate!
47
- def wtf?
48
- puts wtf
49
- end
50
- end
51
- end
52
- end
53
- end