trailblazer-operation 0.8.0 → 0.10.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 +3 -4
- data/CHANGES.md +13 -0
- data/Gemfile +5 -17
- data/lib/trailblazer/operation/class_dependencies.rb +1 -1
- data/lib/trailblazer/operation/public_call.rb +11 -6
- data/lib/trailblazer/operation/version.rb +1 -1
- data/lib/trailblazer/operation.rb +3 -2
- data/test/operation_test.rb +1 -1
- data/test/step_test.rb +14 -25
- data/test/trace_test.rb +34 -34
- data/trailblazer-operation.gemspec +5 -5
- metadata +12 -16
- data/.rubocop.yml +0 -8
- data/.rubocop_todo.yml +0 -223
- data/lib/trailblazer/operation/callable.rb +0 -42
- data/lib/trailblazer/operation/railway/macaroni.rb +0 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 055b4f6ef1ce80319468ccbb1299dadf1ff82429179381904780a1d04bcda48f
|
4
|
+
data.tar.gz: c3d25c70992d811625a162c5dce4bc5751df2665034b80d6739b4153860914ca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4e1450dc8761312a31ebb9113a1086e4f51f501a8fbc178f597b9720b14a767e7cd4b42a833b42b2ed065b7c41cd8f9bb19c81ddd808020c4ab9f5643c0375c0
|
7
|
+
data.tar.gz: 7ee732afe996545413207ea93ece417b1d5ccb74b51820048957f73c22d8ea53eb61a01c1d96531056e8bbd407e5d1c004382e36132e5dfa435468b24192981c
|
data/.github/workflows/ci.yml
CHANGED
@@ -5,13 +5,12 @@ jobs:
|
|
5
5
|
strategy:
|
6
6
|
fail-fast: false
|
7
7
|
matrix:
|
8
|
-
|
9
|
-
ruby: [2.5, 2.6, 2.7, '3.0', '3.1', head, jruby]
|
8
|
+
ruby: [2.5, 2.6, 2.7, '3.0', '3.1', '3.2', 'jruby']
|
10
9
|
runs-on: ubuntu-latest
|
11
10
|
steps:
|
12
|
-
- uses: actions/checkout@
|
11
|
+
- uses: actions/checkout@v3
|
13
12
|
- uses: ruby/setup-ruby@v1
|
14
13
|
with:
|
15
14
|
ruby-version: ${{ matrix.ruby }}
|
16
|
-
bundler-cache: true
|
15
|
+
bundler-cache: true
|
17
16
|
- run: bundle exec rake
|
data/CHANGES.md
CHANGED
@@ -1,3 +1,16 @@
|
|
1
|
+
## 0.10.0
|
2
|
+
|
3
|
+
* Require `trailblazer-activity-dsl-linear-1.2.0`.
|
4
|
+
* Remove `Railway::Macaroni`.
|
5
|
+
* Remove `Operation::Callable`.
|
6
|
+
* Introduce `Operation::INITIAL_WRAP_STATIC` that is computed once at compile-time, not
|
7
|
+
with every `#call`.
|
8
|
+
|
9
|
+
## 0.9.0
|
10
|
+
|
11
|
+
* Use `trailblazer-activity-dsl-linear` 1.1.0.
|
12
|
+
* Pass `:container_activity` to `TaskWrap.invoke` instead of the superseded `:static_wrap` option.
|
13
|
+
|
1
14
|
## 0.8.0
|
2
15
|
|
3
16
|
* Use `trailblazer-activity-dsl-linear` 1.0.0.
|
data/Gemfile
CHANGED
@@ -3,21 +3,9 @@ source 'https://rubygems.org'
|
|
3
3
|
# Specify your gem's dependencies in trailblazer.gemspec
|
4
4
|
gemspec
|
5
5
|
|
6
|
-
gem "
|
6
|
+
# gem "trailblazer-developer", path: "../trailblazer-developer"
|
7
|
+
# gem "trailblazer-activity", path: "../trailblazer-activity"
|
8
|
+
# gem "trailblazer-activity-dsl-linear", path: "../trailblazer-activity-dsl-linear"
|
7
9
|
|
8
|
-
gem "
|
9
|
-
|
10
|
-
gem "benchmark-ips"
|
11
|
-
gem "minitest-line"
|
12
|
-
|
13
|
-
# gem "trailblazer-developer", path: "../trailblazer-developer"
|
14
|
-
# gem "trailblazer-developer", git: "https://github.com/trailblazer/trailblazer-developer"
|
15
|
-
# gem "trailblazer-activity", path: "../trailblazer-activity"
|
16
|
-
# gem "trailblazer-context", path: "../trailblazer-context"
|
17
|
-
# gem "trailblazer-activity-dsl-linear", path: "../trailblazer-activity-dsl-linear"
|
18
|
-
# gem "trailblazer-activity", github: "trailblazer/trailblazer-activity"
|
19
|
-
|
20
|
-
# gem "trailblazer-macro", path: "../trailblazer-macro"
|
21
|
-
# gem "trailblazer-activity", path: "../trailblazer-activity"
|
22
|
-
# gem "trailblazer-activity-dsl-linear", path: "../trailblazer-activity-dsl-linear"
|
23
|
-
# gem "trailblazer-declarative"
|
10
|
+
# gem "trailblazer-activity", github: "trailblazer/trailblazer-activity"
|
11
|
+
# gem "trailblazer-developer", github: "trailblazer/trailblazer-developer"
|
@@ -25,7 +25,7 @@ class Trailblazer::Operation
|
|
25
25
|
end
|
26
26
|
|
27
27
|
private def context_for_fields(fields, (ctx, flow_options), **)
|
28
|
-
ctx_with_fields = Trailblazer::Context(fields, ctx, flow_options[:context_options]) # TODO: redundant to
|
28
|
+
ctx_with_fields = Trailblazer::Context(fields, ctx, flow_options[:context_options]) # TODO: redundant to options_for_public_call.
|
29
29
|
end
|
30
30
|
|
31
31
|
def call_with_circuit_interface((ctx, flow_options), **circuit_options)
|
@@ -41,7 +41,8 @@ module Trailblazer
|
|
41
41
|
self,
|
42
42
|
[ctx, flow_options],
|
43
43
|
exec_context: new,
|
44
|
-
wrap_static: initial_wrap_static,
|
44
|
+
# wrap_static: initial_wrap_static,
|
45
|
+
container_activity: Activity::TaskWrap.container_activity_for(self, wrap_static: initial_wrap_static)
|
45
46
|
)
|
46
47
|
|
47
48
|
# Result is successful if the activity ended with an End event derived from Railway::End::Success.
|
@@ -76,16 +77,14 @@ module Trailblazer
|
|
76
77
|
end
|
77
78
|
|
78
79
|
# TODO: remove when we stop supporting < 3.0.
|
80
|
+
# alternatively, ctx aliasing is only available for Ruby > 2.7.
|
79
81
|
def call_with_flow_options(options, flow_options)
|
80
82
|
raise "[Trailblazer] `Operation.call_with_flow_options is deprecated in Ruby 3.0. Use `Operation.(options, flow_options)`" if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.0.0")
|
81
83
|
call_with_public_interface(options, flow_options, {invoke_class: Activity::TaskWrap})
|
82
84
|
end
|
83
85
|
|
84
|
-
|
85
|
-
|
86
|
-
end
|
87
|
-
|
88
|
-
def call_task(wrap_ctx, original_args) # DISCUSS: copied from {TaskWrap.call_task}.
|
86
|
+
# @private
|
87
|
+
def self.call_task(wrap_ctx, original_args) # DISCUSS: copied from {TaskWrap.call_task}.
|
89
88
|
op = wrap_ctx[:task]
|
90
89
|
|
91
90
|
original_arguments, original_circuit_options = original_args
|
@@ -99,5 +98,11 @@ module Trailblazer
|
|
99
98
|
|
100
99
|
return wrap_ctx, original_args
|
101
100
|
end
|
101
|
+
|
102
|
+
INITIAL_WRAP_STATIC = Activity::TaskWrap::Pipeline.new([Activity::TaskWrap::Pipeline.Row("task_wrap.call_task", method(:call_task))])
|
103
|
+
|
104
|
+
def initial_wrap_static
|
105
|
+
INITIAL_WRAP_STATIC
|
106
|
+
end
|
102
107
|
end
|
103
108
|
end
|
@@ -2,6 +2,9 @@ require "trailblazer/activity/dsl/linear"
|
|
2
2
|
require 'forwardable'
|
3
3
|
require 'trailblazer/operation/version'
|
4
4
|
|
5
|
+
#
|
6
|
+
# Developer's docs: https://trailblazer.to/2.1/docs/internals.html#internals-operation
|
7
|
+
#
|
5
8
|
module Trailblazer
|
6
9
|
# As opposed to {Activity::Railway} and {Activity::FastTrack} an operation
|
7
10
|
# maintains different terminus subclasses.
|
@@ -57,5 +60,3 @@ require "trailblazer/operation/deprecated_macro" # TODO: remove in 2.2.
|
|
57
60
|
|
58
61
|
require "trailblazer/operation/result"
|
59
62
|
require "trailblazer/operation/railway"
|
60
|
-
|
61
|
-
require "trailblazer/operation/railway/macaroni"
|
data/test/operation_test.rb
CHANGED
data/test/step_test.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
require "test_helper"
|
2
2
|
|
3
|
+
# TODO: throw away this test, most of it is tested in {dsl}.
|
4
|
+
|
3
5
|
# Tests
|
4
6
|
# --- step ->(*) { snippet }
|
5
7
|
# --- step Callable
|
@@ -40,10 +42,18 @@ class StepTest < Minitest::Spec
|
|
40
42
|
|
41
43
|
it { Create.(a: 1, b: 2, c: 3, d: 4, e: 5).inspect("a", "b", "c", "d", "e").must_equal "<Result:true [1, 2, 3, 4, 5] >" }
|
42
44
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
45
|
+
it "allows {Developer.railway}" do
|
46
|
+
output = Trailblazer::Developer.railway(Create)
|
47
|
+
.gsub(/0x.+?step_test.rb/, "")
|
48
|
+
.gsub(/\)\s.+?step_test.rb/, ") test/step_test.rb")
|
49
|
+
|
50
|
+
if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.2.0")
|
51
|
+
assert_equal output, %([>#<Proc::32 (lambda)>,>StepTest::Callable,>#<Method: StepTest::Implementation.c(options, c: ...) test/step_test.rb:20>,>d,>MyMacro])
|
52
|
+
elsif Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("2.7.0")
|
53
|
+
assert_equal output, %([>#<Proc::32 (lambda)>,>StepTest::Callable,>#<Method: StepTest::Implementation.c(options, c: ..., **) test/step_test.rb:20>,>d,>MyMacro])
|
54
|
+
else
|
55
|
+
assert_equal output, %([>#<Proc::32 (lambda)>,>StepTest::Callable,>#<Method: StepTest::Implementation.c>,>d,>MyMacro])
|
56
|
+
end
|
47
57
|
end
|
48
58
|
|
49
59
|
#---
|
@@ -173,27 +183,6 @@ class StepTest < Minitest::Spec
|
|
173
183
|
# FIXME: we have all fast track ends here.
|
174
184
|
it { skip; Ii["__activity__"].circuit.instance_variable_get(:@map).size.must_equal 6 }
|
175
185
|
|
176
|
-
#---
|
177
|
-
#-
|
178
|
-
# not existent :name
|
179
|
-
it do
|
180
|
-
op = assert_raises Trailblazer::Activity::Adds::IndexError do
|
181
|
-
class InvalidStep < Trailblazer::Operation
|
182
|
-
step :a, before: "I don't exist!"
|
183
|
-
end
|
184
|
-
end
|
185
|
-
|
186
|
-
error_message = %{#<Trailblazer::Activity::Adds::IndexError: StepTest::InvalidStep:
|
187
|
-
\e[31m\"I don't exist!\" is not a valid step ID. Did you mean any of these ?\e[0m
|
188
|
-
\e[32m\"Start.default\"
|
189
|
-
\"End.success\"
|
190
|
-
\"End.pass_fast\"
|
191
|
-
\"End.fail_fast\"
|
192
|
-
\"End.failure\"\e[0m>}
|
193
|
-
|
194
|
-
assert_match error_message, op.inspect
|
195
|
-
end
|
196
|
-
|
197
186
|
#---
|
198
187
|
#- :name
|
199
188
|
#- step :whatever, id: :validate
|
data/test/trace_test.rb
CHANGED
@@ -8,7 +8,7 @@ class TraceTest < Minitest::Spec
|
|
8
8
|
|
9
9
|
class Create < Trailblazer::Operation
|
10
10
|
step ->(options, a_return:, **) { options[:a] = a_return }, id: "Create.task.a"
|
11
|
-
step(
|
11
|
+
step Subprocess(B), id: "MyNested"
|
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
|
@@ -22,32 +22,32 @@ class TraceTest < Minitest::Spec
|
|
22
22
|
|
23
23
|
output = result.wtf
|
24
24
|
|
25
|
-
output.gsub(/0x\w+/, "").gsub(/@.+_test/, "")
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
25
|
+
assert_equal output.gsub(/0x\w+/, "").gsub(/@.+_test/, ""), %{TraceTest::Create
|
26
|
+
|-- Start.default
|
27
|
+
|-- Create.task.a
|
28
|
+
|-- MyNested
|
29
|
+
| |-- Start.default
|
30
|
+
| |-- B.task.b
|
31
|
+
| |-- B.task.e
|
32
|
+
| `-- End.success
|
33
|
+
|-- Create.task.c
|
34
|
+
|-- Create.task.params
|
35
|
+
`-- End.failure}
|
36
36
|
end
|
37
37
|
|
38
38
|
it "Operation::trace" do
|
39
39
|
result = Create.trace(params: {x: 1}, a_return: true)
|
40
|
-
result.wtf.gsub(/0x\w+/, "").gsub(/@.+_test/, "")
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
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
51
|
end
|
52
52
|
|
53
53
|
it "Operation.wtf?" do
|
@@ -56,17 +56,17 @@ class TraceTest < Minitest::Spec
|
|
56
56
|
result = Create.wtf?(params: {x: 1}, a_return: true)
|
57
57
|
end
|
58
58
|
|
59
|
-
output.gsub(/0x\w+/, "").gsub(/@.+_test/, "")
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
59
|
+
assert_equal output.gsub(/0x\w+/, "").gsub(/@.+_test/, ""), %{TraceTest::Create
|
60
|
+
|-- \e[32mStart.default\e[0m
|
61
|
+
|-- \e[32mCreate.task.a\e[0m
|
62
|
+
|-- MyNested
|
63
|
+
| |-- \e[32mStart.default\e[0m
|
64
|
+
| |-- \e[32mB.task.b\e[0m
|
65
|
+
| |-- \e[32mB.task.e\e[0m
|
66
|
+
| `-- End.success
|
67
|
+
|-- \e[32mCreate.task.c\e[0m
|
68
|
+
|-- \e[32mCreate.task.params\e[0m
|
69
|
+
`-- End.success
|
70
70
|
}
|
71
71
|
|
72
72
|
result.success?.must_equal true
|
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.email = ["apotonick@gmail.com"]
|
10
10
|
spec.description = %q(Trailblazer's operation object.)
|
11
11
|
spec.summary = %q(Trailblazer's operation object with railway flow and integrated error handling.)
|
12
|
-
spec.homepage = "
|
12
|
+
spec.homepage = "https://trailblazer.to/2.1/docs/operation.html"
|
13
13
|
spec.license = "MIT"
|
14
14
|
|
15
15
|
spec.files = `git ls-files`.split($/)
|
@@ -17,13 +17,13 @@ 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.
|
21
|
-
spec.add_dependency "trailblazer-developer"
|
20
|
+
spec.add_dependency "trailblazer-activity-dsl-linear", ">= 1.2.0", "< 1.4.0"
|
21
|
+
spec.add_dependency "trailblazer-developer"
|
22
22
|
|
23
23
|
spec.add_development_dependency "bundler"
|
24
24
|
spec.add_development_dependency "minitest"
|
25
|
+
spec.add_development_dependency "minitest-line"
|
25
26
|
spec.add_development_dependency "rake"
|
26
|
-
spec.add_development_dependency "rubocop"
|
27
27
|
|
28
|
-
spec.required_ruby_version = ">= 2.
|
28
|
+
spec.required_ruby_version = ">= 2.5.0"
|
29
29
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: trailblazer-operation
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.10.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:
|
11
|
+
date: 2023-03-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: trailblazer-activity-dsl-linear
|
@@ -16,34 +16,34 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.
|
19
|
+
version: 1.2.0
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: 1.
|
22
|
+
version: 1.4.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: 1.
|
29
|
+
version: 1.2.0
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: 1.
|
32
|
+
version: 1.4.0
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: trailblazer-developer
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
37
|
- - ">="
|
38
38
|
- !ruby/object:Gem::Version
|
39
|
-
version: 0
|
39
|
+
version: '0'
|
40
40
|
type: :runtime
|
41
41
|
prerelease: false
|
42
42
|
version_requirements: !ruby/object:Gem::Requirement
|
43
43
|
requirements:
|
44
44
|
- - ">="
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version: 0
|
46
|
+
version: '0'
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: bundler
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
@@ -73,7 +73,7 @@ dependencies:
|
|
73
73
|
- !ruby/object:Gem::Version
|
74
74
|
version: '0'
|
75
75
|
- !ruby/object:Gem::Dependency
|
76
|
-
name:
|
76
|
+
name: minitest-line
|
77
77
|
requirement: !ruby/object:Gem::Requirement
|
78
78
|
requirements:
|
79
79
|
- - ">="
|
@@ -87,7 +87,7 @@ dependencies:
|
|
87
87
|
- !ruby/object:Gem::Version
|
88
88
|
version: '0'
|
89
89
|
- !ruby/object:Gem::Dependency
|
90
|
-
name:
|
90
|
+
name: rake
|
91
91
|
requirement: !ruby/object:Gem::Requirement
|
92
92
|
requirements:
|
93
93
|
- - ">="
|
@@ -109,19 +109,15 @@ extra_rdoc_files: []
|
|
109
109
|
files:
|
110
110
|
- ".github/workflows/ci.yml"
|
111
111
|
- ".gitignore"
|
112
|
-
- ".rubocop.yml"
|
113
|
-
- ".rubocop_todo.yml"
|
114
112
|
- CHANGES.md
|
115
113
|
- Gemfile
|
116
114
|
- README.md
|
117
115
|
- Rakefile
|
118
116
|
- lib/trailblazer/operation.rb
|
119
|
-
- lib/trailblazer/operation/callable.rb
|
120
117
|
- lib/trailblazer/operation/class_dependencies.rb
|
121
118
|
- lib/trailblazer/operation/deprecated_macro.rb
|
122
119
|
- lib/trailblazer/operation/public_call.rb
|
123
120
|
- lib/trailblazer/operation/railway.rb
|
124
|
-
- lib/trailblazer/operation/railway/macaroni.rb
|
125
121
|
- lib/trailblazer/operation/result.rb
|
126
122
|
- lib/trailblazer/operation/trace.rb
|
127
123
|
- lib/trailblazer/operation/version.rb
|
@@ -151,7 +147,7 @@ files:
|
|
151
147
|
- test/wiring/defaults_test.rb
|
152
148
|
- test/wiring/subprocess_test.rb
|
153
149
|
- trailblazer-operation.gemspec
|
154
|
-
homepage:
|
150
|
+
homepage: https://trailblazer.to/2.1/docs/operation.html
|
155
151
|
licenses:
|
156
152
|
- MIT
|
157
153
|
metadata: {}
|
@@ -163,7 +159,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
163
159
|
requirements:
|
164
160
|
- - ">="
|
165
161
|
- !ruby/object:Gem::Version
|
166
|
-
version: 2.
|
162
|
+
version: 2.5.0
|
167
163
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
168
164
|
requirements:
|
169
165
|
- - ">="
|
data/.rubocop.yml
DELETED
data/.rubocop_todo.yml
DELETED
@@ -1,223 +0,0 @@
|
|
1
|
-
# This configuration was generated by
|
2
|
-
# `rubocop --auto-gen-config`
|
3
|
-
# on 2019-04-05 17:28:56 +1100 using RuboCop version 0.58.1.
|
4
|
-
# The point is for the user to remove these configuration records
|
5
|
-
# one by one as the offenses are removed from the code base.
|
6
|
-
# Note that changes in the inspected code, or installation of new
|
7
|
-
# versions of RuboCop, may require this file to be generated again.
|
8
|
-
|
9
|
-
# Offense count: 1
|
10
|
-
# Configuration parameters: Include.
|
11
|
-
# Include: **/*.gemspec
|
12
|
-
Gemspec/RequiredRubyVersion:
|
13
|
-
Exclude:
|
14
|
-
- 'trailblazer-operation.gemspec'
|
15
|
-
|
16
|
-
# Offense count: 5
|
17
|
-
# Cop supports --auto-correct.
|
18
|
-
Layout/CommentIndentation:
|
19
|
-
Exclude:
|
20
|
-
- 'lib/trailblazer/operation/version.rb'
|
21
|
-
- 'test/wiring/defaults_test.rb'
|
22
|
-
|
23
|
-
# Offense count: 3
|
24
|
-
# Cop supports --auto-correct.
|
25
|
-
# Configuration parameters: AllowAdjacentOneLineDefs, NumberOfEmptyLines.
|
26
|
-
Layout/EmptyLineBetweenDefs:
|
27
|
-
Exclude:
|
28
|
-
- 'lib/trailblazer/operation.rb'
|
29
|
-
|
30
|
-
# Offense count: 1
|
31
|
-
# Cop supports --auto-correct.
|
32
|
-
Layout/EmptyLines:
|
33
|
-
Exclude:
|
34
|
-
- 'lib/trailblazer/operation.rb'
|
35
|
-
|
36
|
-
# Offense count: 1
|
37
|
-
# Cop supports --auto-correct.
|
38
|
-
# Configuration parameters: AllowForAlignment, ForceEqualSignAlignment.
|
39
|
-
Layout/ExtraSpacing:
|
40
|
-
Exclude:
|
41
|
-
- 'lib/trailblazer/operation.rb'
|
42
|
-
|
43
|
-
# Offense count: 2
|
44
|
-
# Cop supports --auto-correct.
|
45
|
-
Layout/SpaceBeforeSemicolon:
|
46
|
-
Exclude:
|
47
|
-
- 'lib/trailblazer/operation.rb'
|
48
|
-
|
49
|
-
# Offense count: 2
|
50
|
-
# Cop supports --auto-correct.
|
51
|
-
# Configuration parameters: EnforcedStyle.
|
52
|
-
# SupportedStyles: space, no_space
|
53
|
-
Layout/SpaceInsideParens:
|
54
|
-
Exclude:
|
55
|
-
- 'lib/trailblazer/operation.rb'
|
56
|
-
|
57
|
-
# Offense count: 2
|
58
|
-
Lint/ShadowingOuterLocalVariable:
|
59
|
-
Exclude:
|
60
|
-
- 'lib/trailblazer/operation/deprecated_macro.rb'
|
61
|
-
- 'lib/trailblazer/operation/public_call.rb'
|
62
|
-
|
63
|
-
# Offense count: 1
|
64
|
-
# Cop supports --auto-correct.
|
65
|
-
# Configuration parameters: IgnoreEmptyBlocks, AllowUnusedKeywordArguments.
|
66
|
-
Lint/UnusedBlockArgument:
|
67
|
-
Exclude:
|
68
|
-
- 'lib/trailblazer/operation/inspect.rb'
|
69
|
-
|
70
|
-
# Offense count: 2
|
71
|
-
Lint/UselessAssignment:
|
72
|
-
Exclude:
|
73
|
-
- 'lib/trailblazer/operation/public_call.rb'
|
74
|
-
- 'lib/trailblazer/operation/trace.rb'
|
75
|
-
|
76
|
-
# Offense count: 46
|
77
|
-
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
|
78
|
-
# URISchemes: http, https
|
79
|
-
Metrics/LineLength:
|
80
|
-
Max: 255
|
81
|
-
|
82
|
-
# Offense count: 2
|
83
|
-
Naming/ConstantName:
|
84
|
-
Exclude:
|
85
|
-
- 'lib/trailblazer/operation/inspect.rb'
|
86
|
-
- 'lib/trailblazer/operation/version.rb'
|
87
|
-
|
88
|
-
# Offense count: 1
|
89
|
-
# Cop supports --auto-correct.
|
90
|
-
Performance/StringReplacement:
|
91
|
-
Exclude:
|
92
|
-
- 'lib/trailblazer/operation/inspect.rb'
|
93
|
-
|
94
|
-
# Offense count: 2
|
95
|
-
# Cop supports --auto-correct.
|
96
|
-
Style/BlockComments:
|
97
|
-
Exclude:
|
98
|
-
- 'test/docs/wiring_test.rb'
|
99
|
-
|
100
|
-
# Offense count: 3
|
101
|
-
# Cop supports --auto-correct.
|
102
|
-
# Configuration parameters: EnforcedStyle, ProceduralMethods, FunctionalMethods, IgnoredMethods.
|
103
|
-
# SupportedStyles: line_count_based, semantic, braces_for_chaining
|
104
|
-
# ProceduralMethods: benchmark, bm, bmbm, create, each_with_object, measure, new, realtime, tap, with_object
|
105
|
-
# FunctionalMethods: let, let!, subject, watch
|
106
|
-
# IgnoredMethods: lambda, proc, it
|
107
|
-
Style/BlockDelimiters:
|
108
|
-
Exclude:
|
109
|
-
- 'lib/trailblazer/operation/inspect.rb'
|
110
|
-
- 'test/step_test.rb'
|
111
|
-
|
112
|
-
# Offense count: 1
|
113
|
-
# Cop supports --auto-correct.
|
114
|
-
# Configuration parameters: EnforcedStyle.
|
115
|
-
# SupportedStyles: braces, no_braces, context_dependent
|
116
|
-
Style/BracesAroundHashParameters:
|
117
|
-
Exclude:
|
118
|
-
- 'lib/trailblazer/operation/public_call.rb'
|
119
|
-
|
120
|
-
# Offense count: 1
|
121
|
-
# Cop supports --auto-correct.
|
122
|
-
# Configuration parameters: EnforcedStyle.
|
123
|
-
# SupportedStyles: is_a?, kind_of?
|
124
|
-
Style/ClassCheck:
|
125
|
-
Exclude:
|
126
|
-
- 'lib/trailblazer/operation/railway.rb'
|
127
|
-
|
128
|
-
# Offense count: 2
|
129
|
-
Style/CommentedKeyword:
|
130
|
-
Exclude:
|
131
|
-
- 'lib/trailblazer/operation/railway.rb'
|
132
|
-
|
133
|
-
# Offense count: 1
|
134
|
-
# Cop supports --auto-correct.
|
135
|
-
Style/DefWithParentheses:
|
136
|
-
Exclude:
|
137
|
-
- 'lib/trailblazer/operation.rb'
|
138
|
-
|
139
|
-
# Offense count: 1
|
140
|
-
# Cop supports --auto-correct.
|
141
|
-
Style/ExpandPathArguments:
|
142
|
-
Exclude:
|
143
|
-
- 'trailblazer-operation.gemspec'
|
144
|
-
|
145
|
-
# Offense count: 3
|
146
|
-
# Cop supports --auto-correct.
|
147
|
-
# Configuration parameters: EnforcedStyle.
|
148
|
-
# SupportedStyles: format, sprintf, percent
|
149
|
-
Style/FormatString:
|
150
|
-
Exclude:
|
151
|
-
- 'lib/trailblazer/operation/inspect.rb'
|
152
|
-
|
153
|
-
# Offense count: 1
|
154
|
-
# Configuration parameters: .
|
155
|
-
# SupportedStyles: annotated, template, unannotated
|
156
|
-
Style/FormatStringToken:
|
157
|
-
EnforcedStyle: unannotated
|
158
|
-
|
159
|
-
# Offense count: 3
|
160
|
-
Style/MethodCalledOnDoEndBlock:
|
161
|
-
Exclude:
|
162
|
-
- 'lib/trailblazer/operation/inspect.rb'
|
163
|
-
- 'test/step_test.rb'
|
164
|
-
|
165
|
-
# Offense count: 2
|
166
|
-
# Cop supports --auto-correct.
|
167
|
-
Style/MutableConstant:
|
168
|
-
Exclude:
|
169
|
-
- 'lib/trailblazer/operation/inspect.rb'
|
170
|
-
- 'lib/trailblazer/operation/version.rb'
|
171
|
-
|
172
|
-
# Offense count: 1
|
173
|
-
# Cop supports --auto-correct.
|
174
|
-
Style/ParallelAssignment:
|
175
|
-
Exclude:
|
176
|
-
- 'lib/trailblazer/operation/result.rb'
|
177
|
-
|
178
|
-
# Offense count: 4
|
179
|
-
# Cop supports --auto-correct.
|
180
|
-
# Configuration parameters: PreferredDelimiters.
|
181
|
-
Style/PercentLiteralDelimiters:
|
182
|
-
Exclude:
|
183
|
-
- 'Rakefile'
|
184
|
-
|
185
|
-
# Offense count: 4
|
186
|
-
# Cop supports --auto-correct.
|
187
|
-
# Configuration parameters: EnforcedStyle.
|
188
|
-
# SupportedStyles: only_raise, only_fail, semantic
|
189
|
-
Style/SignalException:
|
190
|
-
Exclude:
|
191
|
-
- 'test/operation_test.rb'
|
192
|
-
- 'test/ruby-2.0.0/operation_test.rb'
|
193
|
-
|
194
|
-
# Offense count: 1
|
195
|
-
# Cop supports --auto-correct.
|
196
|
-
# Configuration parameters: EnforcedStyle.
|
197
|
-
# SupportedStyles: use_perl_names, use_english_names
|
198
|
-
Style/SpecialGlobalVars:
|
199
|
-
Exclude:
|
200
|
-
- 'trailblazer-operation.gemspec'
|
201
|
-
|
202
|
-
# Offense count: 3
|
203
|
-
# Cop supports --auto-correct.
|
204
|
-
# Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
|
205
|
-
# SupportedStyles: single_quotes, double_quotes
|
206
|
-
Style/StringLiterals:
|
207
|
-
Exclude:
|
208
|
-
- 'Gemfile'
|
209
|
-
- 'trailblazer-operation.gemspec'
|
210
|
-
|
211
|
-
# Offense count: 1
|
212
|
-
# Cop supports --auto-correct.
|
213
|
-
# Configuration parameters: EnforcedStyleForMultiline.
|
214
|
-
# SupportedStylesForMultiline: comma, consistent_comma, no_comma
|
215
|
-
Style/TrailingCommaInHashLiteral:
|
216
|
-
Exclude:
|
217
|
-
- 'lib/trailblazer/operation.rb'
|
218
|
-
|
219
|
-
# Offense count: 2
|
220
|
-
# Cop supports --auto-correct.
|
221
|
-
Style/UnneededPercentQ:
|
222
|
-
Exclude:
|
223
|
-
- 'trailblazer-operation.gemspec'
|
@@ -1,42 +0,0 @@
|
|
1
|
-
module Trailblazer
|
2
|
-
class Operation
|
3
|
-
# Use {Callable} if you have an operation or any other callable object that does
|
4
|
-
# _not_ expose an {Activity interface}. For example, {Operation.call} isn't compatible
|
5
|
-
# with activities, hence you need to decorate it using {Callable}. The returned object
|
6
|
-
# exposes an {Activity interface}.
|
7
|
-
#
|
8
|
-
# @param :call [Symbol] Method name to call
|
9
|
-
# @param options [Hash] Hash to merge into {circuit_options}, e.g. {:start_task}.
|
10
|
-
#
|
11
|
-
# @example Create and use a Callable instance.
|
12
|
-
# callable = Trailblazer::Operation::Callable( Memo::Create, call: :__call__ )
|
13
|
-
# callable.( [ctx, {}] ) #=> Activity interface, ::call will invoke Memo::Create.__call__.
|
14
|
-
def self.Callable(*args)
|
15
|
-
Callable.new(*args)
|
16
|
-
end
|
17
|
-
|
18
|
-
# Subprocess allows to have tasks with a different call interface and start event.
|
19
|
-
# @param activity any object with an {Activity interface}
|
20
|
-
class Callable
|
21
|
-
include Activity::Interface
|
22
|
-
|
23
|
-
def initialize(activity, call: :call, **options)
|
24
|
-
@activity = activity
|
25
|
-
@options = options
|
26
|
-
@call = call
|
27
|
-
end
|
28
|
-
|
29
|
-
def call(args, **circuit_options)
|
30
|
-
@activity.public_send(@call, args, circuit_options.merge(@options))
|
31
|
-
end
|
32
|
-
|
33
|
-
extend Forwardable
|
34
|
-
# @private
|
35
|
-
def_delegators :@activity, :to_h, :debug
|
36
|
-
|
37
|
-
def to_s
|
38
|
-
%{#<Trailblazer::Activity::Callable activity=#{@activity}>}
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
@@ -1,23 +0,0 @@
|
|
1
|
-
module Trailblazer
|
2
|
-
module Operation::Railway
|
3
|
-
# Call the user's steps with a differing API (inspired by Maciej Mensfeld) that
|
4
|
-
# only receives keyword args. The `options` keyword is the stateful context object
|
5
|
-
#
|
6
|
-
# def my_step( params:, ** )
|
7
|
-
# def my_step( params:, options:, ** )
|
8
|
-
module Macaroni
|
9
|
-
def self.call(user_proc)
|
10
|
-
Activity::TaskBuilder::Task.new(Trailblazer::Option.build(Macaroni::Option, user_proc), user_proc)
|
11
|
-
end
|
12
|
-
|
13
|
-
class Option < Trailblazer::Option
|
14
|
-
# The Option#call! method prepares the arguments.
|
15
|
-
def self.call!(proc, options, *)
|
16
|
-
proc.(**options.to_hash.merge(options: options))
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
KwSignature = Macaroni
|
22
|
-
end
|
23
|
-
end
|