trailblazer-operation 0.6.3 → 0.6.4
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/.travis.yml +10 -13
- data/CHANGES.md +4 -0
- data/lib/trailblazer/operation.rb +1 -15
- data/lib/trailblazer/operation/railway.rb +4 -0
- data/lib/trailblazer/operation/trace.rb +1 -0
- data/lib/trailblazer/operation/version.rb +4 -2
- data/test/docs/wiring_test.rb +5 -8
- data/trailblazer-operation.gemspec +2 -2
- metadata +3 -6
- data/lib/trailblazer/operation/container.rb +0 -14
- data/test/dry_container_test.rb +0 -25
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 981ec0cea83a33e099bbc95c7bbde70e0ce158830d8347e28c5584b1ea27ce7a
|
4
|
+
data.tar.gz: 3b9b123a954f8f7269e1af69f4f60f84fdeebf238319d9243743d27f371e35f9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e7d149855f102a46264bdeb9a9dfaaaff4e42d85849e1220ae16b2aadb4cf712b1e3326c654127683bf4a33d56c73e83792e33770b70d4615dc26bd651060586
|
7
|
+
data.tar.gz: 32e58914330e1d5dfd0c63938497daffe280ca3da41ae34c9620de6833dfdd1d2d29cd9186219cc7b731ab80266032e85f945e2ed49ec54db72610183d2c0000
|
data/.travis.yml
CHANGED
@@ -1,16 +1,13 @@
|
|
1
1
|
language: ruby
|
2
2
|
before_install:
|
3
3
|
- gem install bundler -v 1.17.3
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
- rvm:
|
13
|
-
|
14
|
-
- rvm: 2.5.0
|
15
|
-
gemfile: Gemfile
|
16
|
-
script: bundle exec rake test
|
4
|
+
rvm:
|
5
|
+
- ruby-head
|
6
|
+
- 2.7
|
7
|
+
- 2.6
|
8
|
+
- 2.5
|
9
|
+
- 2.4
|
10
|
+
jobs:
|
11
|
+
allow_failures:
|
12
|
+
- rvm: ruby-head
|
13
|
+
- rvm: 2.7
|
data/CHANGES.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'forwardable'
|
2
|
+
require 'trailblazer/operation/version'
|
2
3
|
require "trailblazer/option"
|
3
4
|
require "trailblazer/context"
|
4
|
-
require "trailblazer/container_chain"
|
5
5
|
|
6
6
|
require "trailblazer/activity/dsl/linear"
|
7
7
|
|
@@ -51,27 +51,13 @@ module Trailblazer
|
|
51
51
|
|
52
52
|
require "trailblazer/operation/trace"
|
53
53
|
extend Trace # ::trace
|
54
|
-
|
55
|
-
module Railway
|
56
|
-
def self.fail! ; Activity::Left end
|
57
|
-
def self.pass! ; Activity::Right end
|
58
|
-
def self.fail_fast!; Activity::FastTrack::FailFast end
|
59
|
-
def self.pass_fast!; Activity::FastTrack::PassFast end
|
60
|
-
end
|
61
54
|
end
|
62
55
|
end
|
63
56
|
|
64
|
-
require 'trailblazer/operation/version'
|
65
|
-
|
66
57
|
require "trailblazer/operation/class_dependencies"
|
67
58
|
require "trailblazer/operation/deprecated_macro" # TODO: remove in 2.2.
|
68
59
|
|
69
60
|
require "trailblazer/operation/result"
|
70
61
|
require "trailblazer/operation/railway"
|
71
62
|
|
72
|
-
require "trailblazer/developer"
|
73
|
-
require "trailblazer/operation/trace"
|
74
|
-
|
75
63
|
require "trailblazer/operation/railway/macaroni"
|
76
|
-
|
77
|
-
require "trailblazer/operation/container"
|
@@ -5,6 +5,10 @@ module Trailblazer
|
|
5
5
|
class Operation
|
6
6
|
# End event: All subclasses of End:::Success are interpreted as "success".
|
7
7
|
module Railway
|
8
|
+
def self.fail! ; Activity::Left end
|
9
|
+
def self.pass! ; Activity::Right end
|
10
|
+
def self.fail_fast!; Activity::FastTrack::FailFast end
|
11
|
+
def self.pass_fast!; Activity::FastTrack::PassFast end
|
8
12
|
# @param options Context
|
9
13
|
# @param end_event The last emitted signal in a circuit is usually the end event.
|
10
14
|
def self.Result(end_event, options, *)
|
data/test/docs/wiring_test.rb
CHANGED
@@ -245,9 +245,8 @@ describe all options :pass_fast, :fast_track and emiting signals directly, like
|
|
245
245
|
end
|
246
246
|
|
247
247
|
it "runs #create_model, only" do
|
248
|
-
Memo = FastTrack::Memo
|
249
248
|
#:ft-call
|
250
|
-
result = Memo::Create.(create_empty_model: true)
|
249
|
+
result = FastTrack::Memo::Create.(create_empty_model: true)
|
251
250
|
puts result.success? #=> true
|
252
251
|
puts result[:model].inspect #=> #<Memo text=nil>
|
253
252
|
#:ft-call end
|
@@ -257,9 +256,8 @@ describe all options :pass_fast, :fast_track and emiting signals directly, like
|
|
257
256
|
end
|
258
257
|
|
259
258
|
it "fast-tracks in #assign_errors" do
|
260
|
-
Memo = FastTrack::Memo
|
261
259
|
#:ft-call-err
|
262
|
-
result = Memo::Create.({})
|
260
|
+
result = FastTrack::Memo::Create.({})
|
263
261
|
puts result.success? #=> false
|
264
262
|
puts result[:model].inspect #=> #<Memo text=nil>
|
265
263
|
puts result[:errors].inspect #=> "Something went wrong!"
|
@@ -271,16 +269,15 @@ describe all options :pass_fast, :fast_track and emiting signals directly, like
|
|
271
269
|
end
|
272
270
|
|
273
271
|
it "goes till #save by emitting signals directly" do
|
274
|
-
|
275
|
-
result = Memo::Create.(params: {text: "Punk is not dead!"})
|
272
|
+
result = FastTrack::Memo::Create.(params: {text: "Punk is not dead!"})
|
276
273
|
result.success?.must_equal true
|
277
274
|
result[:model].id.must_equal 1
|
278
275
|
result[:errors].must_be_nil
|
279
276
|
end
|
280
277
|
|
278
|
+
|
281
279
|
it "goes till #save by using signal helper" do
|
282
|
-
|
283
|
-
result = Memo::Create2.(params: {text: "Punk is not dead!"})
|
280
|
+
result = FastTrack::Memo::Create2.(params: {text: "Punk is not dead!"})
|
284
281
|
result.success?.must_equal true
|
285
282
|
result[:model].id.must_equal 1
|
286
283
|
result[:errors].must_be_nil
|
@@ -4,7 +4,7 @@ require 'trailblazer/operation/version'
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = "trailblazer-operation"
|
7
|
-
spec.version = Trailblazer::Operation::VERSION
|
7
|
+
spec.version = Trailblazer::Version::Operation::VERSION
|
8
8
|
spec.authors = ["Nick Sutterer"]
|
9
9
|
spec.email = ["apotonick@gmail.com"]
|
10
10
|
spec.description = %q(Trailblazer's operation object.)
|
@@ -17,7 +17,7 @@ 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", ">= 0.
|
20
|
+
spec.add_dependency "trailblazer-activity-dsl-linear", ">= 0.3.1", "< 1.0.0"
|
21
21
|
spec.add_dependency "trailblazer-activity", ">= 0.10.0", "< 1.0.0"
|
22
22
|
spec.add_dependency "trailblazer-developer", ">= 0.0.8"
|
23
23
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: trailblazer-operation
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nick Sutterer
|
@@ -16,7 +16,7 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: 0.3.1
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
22
|
version: 1.0.0
|
@@ -26,7 +26,7 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: 0.
|
29
|
+
version: 0.3.1
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: 1.0.0
|
@@ -138,7 +138,6 @@ files:
|
|
138
138
|
- lib/trailblazer/operation.rb
|
139
139
|
- lib/trailblazer/operation/callable.rb
|
140
140
|
- lib/trailblazer/operation/class_dependencies.rb
|
141
|
-
- lib/trailblazer/operation/container.rb
|
142
141
|
- lib/trailblazer/operation/deprecated_macro.rb
|
143
142
|
- lib/trailblazer/operation/public_call.rb
|
144
143
|
- lib/trailblazer/operation/railway.rb
|
@@ -155,7 +154,6 @@ files:
|
|
155
154
|
- test/docs/macaroni_test.rb
|
156
155
|
- test/docs/operation_test.rb
|
157
156
|
- test/docs/wiring_test.rb
|
158
|
-
- test/dry_container_test.rb
|
159
157
|
- test/fast_track_test.rb
|
160
158
|
- test/gemfiles/Gemfile.ruby-1.9
|
161
159
|
- test/gemfiles/Gemfile.ruby-2.0
|
@@ -208,7 +206,6 @@ test_files:
|
|
208
206
|
- test/docs/macaroni_test.rb
|
209
207
|
- test/docs/operation_test.rb
|
210
208
|
- test/docs/wiring_test.rb
|
211
|
-
- test/dry_container_test.rb
|
212
209
|
- test/fast_track_test.rb
|
213
210
|
- test/gemfiles/Gemfile.ruby-1.9
|
214
211
|
- test/gemfiles/Gemfile.ruby-2.0
|
@@ -1,14 +0,0 @@
|
|
1
|
-
module Trailblazer
|
2
|
-
module Operation::Container
|
3
|
-
def options_for_public_call(options={}, *containers)
|
4
|
-
# generate the skill hash that embraces runtime options plus potential containers, the so called Runtime options.
|
5
|
-
# This wrapping is supposed to happen once in the entire system.
|
6
|
-
|
7
|
-
hash_transformer = ->(containers) { containers[0].to_hash } # FIXME: don't transform any containers into kw args.
|
8
|
-
|
9
|
-
immutable_options = Trailblazer::Context::ContainerChain.new([options, *containers], to_hash: hash_transformer)
|
10
|
-
|
11
|
-
Trailblazer::Context(immutable_options)
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
data/test/dry_container_test.rb
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
require "test_helper"
|
2
|
-
require "dry/container"
|
3
|
-
|
4
|
-
class DryContainerTest < Minitest::Spec
|
5
|
-
my_container = Dry::Container.new
|
6
|
-
my_container.register("user_repository", -> { Object })
|
7
|
-
my_container.namespace("contract") do
|
8
|
-
register("create") { Array }
|
9
|
-
end
|
10
|
-
|
11
|
-
class Create < Trailblazer::Operation
|
12
|
-
extend Trailblazer::Operation::Container
|
13
|
-
end
|
14
|
-
|
15
|
-
it "allows 2.2 call style" do
|
16
|
-
Create.({}, my_container)["user_repository"].must_equal Object
|
17
|
-
end
|
18
|
-
|
19
|
-
it { Create.({}, {}, my_container)["user_repository"].must_equal Object }
|
20
|
-
it { Create.({}, {}, my_container)["contract.create"].must_equal Array }
|
21
|
-
# also allows our own options PLUS containers.
|
22
|
-
it { Create.({}, {"model" => String}, my_container)["model"].must_equal String }
|
23
|
-
it { Create.({}, {"model" => String}, my_container)["user_repository"].must_equal Object }
|
24
|
-
it { Create.({}, {"user_repository" => Integer}, my_container)["user_repository"].must_equal Integer }
|
25
|
-
end
|