trailblazer-operation 0.2.0 → 0.2.1
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/CHANGES.md +4 -0
- data/Gemfile +1 -2
- data/lib/trailblazer/operation.rb +6 -6
- data/lib/trailblazer/operation/inspect.rb +1 -1
- data/lib/trailblazer/operation/version.rb +1 -1
- data/test/docs/wiring_test.rb +3 -3
- data/test/fast_track_test.rb +1 -1
- data/test/operation_test.rb +4 -4
- data/test/trace_test.rb +8 -8
- data/trailblazer-operation.gemspec +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1aaec42d2ea06131740ff22250ee9ab31c62b7143e9f4675058821119c672582
|
4
|
+
data.tar.gz: 37d5d3fdf3b649d01aaf4d78e5c16a32c4c86cd426df5da267d6a4bdf0a82793
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 553cf60a9e3087d0c18872bd1e7e5562e8f52f96e6c36867a4d3c5147706954655a4af37efca40a998006b23073561ded931ab9ab4899791b77cec21672bcfc2
|
7
|
+
data.tar.gz: 2e8807d6a9ee02029b6b4114018425efa37186f8872bd951cb27bfb03296494c3a08bcb8e9b318cea17532dcfc0a4eb48cef976d6a74e8f21c2c091010e0ebc3
|
data/CHANGES.md
CHANGED
@@ -14,6 +14,10 @@ lots of work on the DSL specific parts.
|
|
14
14
|
|
15
15
|
params:, rest: ..
|
16
16
|
|
17
|
+
## 0.2.1
|
18
|
+
|
19
|
+
* Use `activity-0.4.1`.
|
20
|
+
|
17
21
|
## 0.2.0
|
18
22
|
|
19
23
|
* Cleanly separate `Activity` and `Operation` responsibilities. An operation is nothing more but a class around an activity, hosting instance methods and implementing inheritance.
|
data/Gemfile
CHANGED
@@ -20,5 +20,4 @@ gem "benchmark-ips"
|
|
20
20
|
|
21
21
|
# gem "declarative", path: "../declarative"
|
22
22
|
|
23
|
-
|
24
|
-
# gem "trailblazer-activity", git: "https://github.com/trailblazer/trailblazer-activity"
|
23
|
+
gem "trailblazer-activity"#, path: "../trailblazer-circuit"
|
@@ -31,10 +31,10 @@ module Trailblazer
|
|
31
31
|
|
32
32
|
module FastTrackActivity
|
33
33
|
builder_options = {
|
34
|
-
track_end: Railway::End::Success.new(:success
|
35
|
-
failure_end: Railway::End::Failure.new(:failure
|
36
|
-
pass_fast_end: Railway::End::PassFast.new(:pass_fast
|
37
|
-
fail_fast_end: Railway::End::FailFast.new(:fail_fast
|
34
|
+
track_end: Railway::End::Success.new(:success),
|
35
|
+
failure_end: Railway::End::Failure.new(:failure),
|
36
|
+
pass_fast_end: Railway::End::PassFast.new(:pass_fast),
|
37
|
+
fail_fast_end: Railway::End::FailFast.new(:fail_fast),
|
38
38
|
}
|
39
39
|
|
40
40
|
extend Activity::FastTrack( pipeline: Railway::Normalizer::Pipeline, builder_options: builder_options )
|
@@ -67,8 +67,8 @@ module Trailblazer
|
|
67
67
|
)
|
68
68
|
end
|
69
69
|
|
70
|
-
def
|
71
|
-
@activity.
|
70
|
+
def to_h
|
71
|
+
@activity.to_h.merge( activity: @activity )
|
72
72
|
end
|
73
73
|
end
|
74
74
|
|
@@ -17,7 +17,7 @@ module Trailblazer
|
|
17
17
|
def call(operation, options={ style: :line })
|
18
18
|
# TODO: better introspection API.
|
19
19
|
|
20
|
-
alterations = Activity::Magnetic::Builder::Finalizer.adds_to_alterations(operation.
|
20
|
+
alterations = Activity::Magnetic::Builder::Finalizer.adds_to_alterations(operation.to_h[:adds])
|
21
21
|
# DISCUSS: any other way to retrieve the Alterations?
|
22
22
|
|
23
23
|
# pp alterations
|
data/test/docs/wiring_test.rb
CHANGED
@@ -516,7 +516,7 @@ class WiringsDocEndTest < Minitest::Spec
|
|
516
516
|
|
517
517
|
#:end
|
518
518
|
class Memo::Update < Trailblazer::Operation
|
519
|
-
step :find_model, Output(:failure) => End(
|
519
|
+
step :find_model, Output(:failure) => End(:model_not_found)
|
520
520
|
step :update
|
521
521
|
fail :db_error
|
522
522
|
step :save
|
@@ -548,12 +548,12 @@ class WiringsDocEndTest < Minitest::Spec
|
|
548
548
|
it "errors out on End.model_not_found" do
|
549
549
|
result = Memo::Update.( id: false )
|
550
550
|
result.inspect(:find_model, :update, :save, :db_error).must_equal %{<Result:false [false, nil, nil, nil] >}
|
551
|
-
result.event.
|
551
|
+
result.event.to_h.must_equal(semantic: :model_not_found)
|
552
552
|
end
|
553
553
|
|
554
554
|
it "takes normal error track" do
|
555
555
|
result = Memo::Update.( id: true, update: false )
|
556
556
|
result.inspect(:find_model, :update, :save, :db_error).must_equal %{<Result:false [true, false, nil, 1] >}
|
557
|
-
result.event.
|
557
|
+
result.event.to_h.must_equal(semantic: :failure)
|
558
558
|
end
|
559
559
|
end
|
data/test/fast_track_test.rb
CHANGED
@@ -183,7 +183,7 @@ class NestedFastTrackTest < Minitest::Spec
|
|
183
183
|
end
|
184
184
|
|
185
185
|
# it { puts Trailblazer::Activity::Introspect.Cct(update.instance_variable_get(:@process)) }
|
186
|
-
it { update.
|
186
|
+
it { update.to_h }
|
187
187
|
# Edit returns End.success
|
188
188
|
it { update.(edit_return: true).inspect("a", "b", "f").must_equal %{<Result:true [1, 2, nil] >} }
|
189
189
|
# Edit returns End.failure
|
data/test/operation_test.rb
CHANGED
@@ -81,10 +81,10 @@ class DeclarativeApiTest < Minitest::Spec
|
|
81
81
|
end
|
82
82
|
|
83
83
|
it "provides #outputs" do
|
84
|
-
Activity::Introspect.Outputs(Edit.outputs).must_equal %{success=> (#<Trailblazer::Operation::Railway::End::Success
|
85
|
-
failure=> (#<Trailblazer::Operation::Railway::End::Failure
|
86
|
-
pass_fast=> (#<Trailblazer::Operation::Railway::End::PassFast
|
87
|
-
fail_fast=> (#<Trailblazer::Operation::Railway::End::FailFast
|
84
|
+
Activity::Introspect.Outputs(Edit.outputs).must_equal %{success=> (#<struct Trailblazer::Operation::Railway::End::Success semantic=:success>, success)
|
85
|
+
failure=> (#<struct Trailblazer::Operation::Railway::End::Failure semantic=:failure>, failure)
|
86
|
+
pass_fast=> (#<struct Trailblazer::Operation::Railway::End::PassFast semantic=:pass_fast>, pass_fast)
|
87
|
+
fail_fast=> (#<struct Trailblazer::Operation::Railway::End::FailFast semantic=:fail_fast>, fail_fast)}
|
88
88
|
end
|
89
89
|
|
90
90
|
it "is an Interface" do
|
data/test/trace_test.rb
CHANGED
@@ -35,29 +35,29 @@ class TraceTest < Minitest::Spec
|
|
35
35
|
|
36
36
|
puts output = Trailblazer::Activity::Trace::Present.tree(stack)
|
37
37
|
|
38
|
-
output.gsub(/0x\w+/, "").gsub(/@.+_test/, "").must_equal %{|-- #<Trailblazer::Activity::Start
|
38
|
+
output.gsub(/0x\w+/, "").gsub(/@.+_test/, "").must_equal %{|-- #<struct Trailblazer::Activity::Start semantic=:default>
|
39
39
|
|-- Create.task.a
|
40
40
|
|-- MyNested
|
41
|
-
| |-- #<Trailblazer::Activity::Start
|
41
|
+
| |-- #<struct Trailblazer::Activity::Start semantic=:default>
|
42
42
|
| |-- B.task.b
|
43
43
|
| |-- B.task.e
|
44
|
-
| `-- #<Trailblazer::Operation::Railway::End::Success
|
44
|
+
| `-- #<struct Trailblazer::Operation::Railway::End::Success semantic=:success>
|
45
45
|
|-- Create.task.c
|
46
46
|
|-- Create.task.params
|
47
|
-
`-- #<Trailblazer::Operation::Railway::End::Failure
|
47
|
+
`-- #<struct Trailblazer::Operation::Railway::End::Failure semantic=:failure>}
|
48
48
|
end
|
49
49
|
|
50
50
|
it "Operation::trace" do
|
51
51
|
result = Create.trace({ params: { x: 1 }, a_return: true })
|
52
|
-
result.wtf.gsub(/0x\w+/, "").gsub(/@.+_test/, "").must_equal %{|-- #<Trailblazer::Activity::Start
|
52
|
+
result.wtf.gsub(/0x\w+/, "").gsub(/@.+_test/, "").must_equal %{|-- #<struct Trailblazer::Activity::Start semantic=:default>
|
53
53
|
|-- Create.task.a
|
54
54
|
|-- MyNested
|
55
|
-
| |-- #<Trailblazer::Activity::Start
|
55
|
+
| |-- #<struct Trailblazer::Activity::Start semantic=:default>
|
56
56
|
| |-- B.task.b
|
57
57
|
| |-- B.task.e
|
58
|
-
| `-- #<Trailblazer::Operation::Railway::End::Success
|
58
|
+
| `-- #<struct Trailblazer::Operation::Railway::End::Success semantic=:success>
|
59
59
|
|-- Create.task.c
|
60
60
|
|-- Create.task.params
|
61
|
-
`-- #<Trailblazer::Operation::Railway::End::Success
|
61
|
+
`-- #<struct Trailblazer::Operation::Railway::End::Success semantic=:success>}
|
62
62
|
end
|
63
63
|
end
|
@@ -17,7 +17,7 @@ Gem::Specification.new do |spec|
|
|
17
17
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
18
18
|
spec.require_paths = ["lib"]
|
19
19
|
|
20
|
-
spec.add_dependency "trailblazer-activity", ">= 0.4.
|
20
|
+
spec.add_dependency "trailblazer-activity", ">= 0.4.1", "< 0.5.0"
|
21
21
|
spec.add_dependency "trailblazer-context", ">= 0.1.1", "< 0.3.0"
|
22
22
|
|
23
23
|
spec.add_development_dependency "bundler"
|
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.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nick Sutterer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-01-
|
11
|
+
date: 2018-01-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: trailblazer-activity
|
@@ -16,7 +16,7 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.4.
|
19
|
+
version: 0.4.1
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
22
|
version: 0.5.0
|
@@ -26,7 +26,7 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: 0.4.
|
29
|
+
version: 0.4.1
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: 0.5.0
|