trailblazer-macro 2.1.0.rc13 → 2.1.0.rc14

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: f650f559c9413f94e4ab3b847052cb86f8893f8e76621ca4f871378ba5459fcc
4
- data.tar.gz: 81cd6d65a460a7e5117591a7512490d031fff59fe3599830013fe846dc56104a
3
+ metadata.gz: 257d35af044c9e6d7f243f1435d2f6caaf0a2c6fbc4099b6417c8c0f7c44bf39
4
+ data.tar.gz: 07e52e6cc9a2b94b686ddf12462deb2076df5b3e189ff5207fe4f2a0dbdafb48
5
5
  SHA512:
6
- metadata.gz: '02853f1b5e504e22ab3ff29506b93b9e02db9834894b8ff6c80dcf35467e5ff6e2f549dc604ba1f18e52a549dd4e7d22d4e229fc09b52f2187bd4859b303257d'
7
- data.tar.gz: b3458af49de52c383ad41108989109174d15dbccdea39d4f6a59fde42eb01b29003883022f6e2785fd0d606be1ef90f32780e77498ddd03aa66fc929bbb3574e
6
+ metadata.gz: be1d7c595f022b2d8df45e630b2d72082a3625fa0b685462ae86c5ada6adf428927373c82cc05b39bcbb24c2c098e48506cf071ea06483b21fb5625343e81f0d
7
+ data.tar.gz: 30ed38e17b3a5edfcecbfc831a668bf348c0ab1edff3684ae48d499e457ed73790f1205bf0e18a24f217d7e2fe92560beef20c0c332bae4d3253b5b949d9878d
data/CHANGES.md CHANGED
@@ -1,3 +1,7 @@
1
+ # 2.1.0.rc14
2
+
3
+ * Remove the explicit `dsl-linear` dependency.
4
+
1
5
  # 2.1.0.rc13
2
6
 
3
7
  * Use symbol keys on `ctx`, only.
data/LICENSE ADDED
@@ -0,0 +1,9 @@
1
+ Copyright (c) 2018 Trailblazer GmbH
2
+
3
+ Trailblazer is an Open Source project licensed under the terms of
4
+ the LGPLv3 license. Please see <http://www.gnu.org/licenses/lgpl-3.0.html>
5
+ for license text.
6
+
7
+ Trailblazer PRO has a commercial-friendly license allowing private forks
8
+ and modifications of Trailblazer. Please see http://trailblazer.to/pro for
9
+ more detail.
@@ -1,7 +1,7 @@
1
1
  module Trailblazer
2
2
  module Version
3
3
  module Macro
4
- VERSION = "2.1.0.rc13".freeze
4
+ VERSION = "2.1.0.rc14".freeze
5
5
  end
6
6
  end
7
7
  end
@@ -6,13 +6,13 @@ class DocsGuardProcTest < Minitest::Spec
6
6
  #:proc
7
7
  class Create < Trailblazer::Operation
8
8
  step Policy::Guard(->(options, pass:, **) { pass })
9
- #~pipeonly
9
+ #:pipeonly
10
10
  step :process
11
11
 
12
12
  def process(options, **)
13
13
  options[:x] = true
14
14
  end
15
- #~pipeonly end
15
+ #:pipeonly end
16
16
  end
17
17
  #:proc end
18
18
 
@@ -46,13 +46,15 @@ class DocsGuardTest < Minitest::Spec
46
46
  #:callable-op
47
47
  class Create < Trailblazer::Operation
48
48
  step Policy::Guard( MyGuard.new )
49
- #~pipe-only
49
+ #:pipe-only
50
50
  step :process
51
51
 
52
+ #~methods
52
53
  def process(options, **)
53
54
  options[:x] = true
54
55
  end
55
- #~pipe-only end
56
+ #~methods end
57
+ #:pipe-only end
56
58
  end
57
59
  #:callable-op end
58
60
 
@@ -72,10 +74,11 @@ class DocsGuardMethodTest < Minitest::Spec
72
74
  end
73
75
  #~pipe-onlyy
74
76
  step :process
75
-
77
+ #~methods
76
78
  def process(options, **)
77
79
  options[:x] = true
78
80
  end
81
+ #~methods end
79
82
  #~pipe-onlyy end
80
83
  end
81
84
  #:method end
@@ -16,22 +16,33 @@ class NestedInput < Minitest::Spec
16
16
  end
17
17
  end
18
18
 
19
- it "Nested(Edit), without any options" do
20
- edit = self.edit
21
-
22
- create = Class.new(Trailblazer::Operation) do
23
- step :a
24
- step Nested( edit )
25
- step :b
26
-
27
- include T.def_steps(:a, :b)
28
- end
19
+ class Validate < Trailblazer::Operation
20
+ step :validate
21
+ # ... more steps ...
22
+ include T.def_steps(:validate)
23
+ end
29
24
 
30
- # this will print a DEPRECATION warning.
31
- # success
32
- create.(seq: []).inspect(:seq).must_equal %{<Result:true [[:a, :c, :b]] >}
33
- # failure in Nested
34
- create.(seq: [], c: false).inspect(:seq).must_equal %{<Result:false [[:a, :c]] >}
25
+ it "Nested(Edit), without any options" do
26
+ module A
27
+
28
+ create =
29
+ #:nested
30
+ class Create < Trailblazer::Operation
31
+ step :create
32
+ step Nested(Validate)
33
+ step :save
34
+ #~meths
35
+ include T.def_steps(:create, :save)
36
+ #~meths end
37
+ end
38
+ #:nested end
39
+
40
+ # this will print a DEPRECATION warning.
41
+ # success
42
+ create.(seq: []).inspect(:seq).must_equal %{<Result:true [[:create, :validate, :save]] >}
43
+ # failure in Nested
44
+ create.(seq: [], validate: false).inspect(:seq).must_equal %{<Result:false [[:create, :validate]] >}
45
+ end
35
46
  end
36
47
 
37
48
  it "Nested(Edit), with Output rewiring" do
@@ -52,32 +63,72 @@ class NestedInput < Minitest::Spec
52
63
  end
53
64
 
54
65
  it "Nested(:method)" do
55
- create = Class.new(Trailblazer::Operation) do
56
- step :a
57
- step Nested(:compute_edit)
58
- step :b
59
-
60
- def compute_edit(ctx, what:, **)
61
- what
66
+ module B
67
+ create =
68
+ #:nested-dynamic
69
+ class Create < Trailblazer::Operation
70
+ step :create
71
+ step Nested(:compute_nested)
72
+ step :save
73
+
74
+ def compute_nested(ctx, params:, **)
75
+ params.is_a?(Hash) ? Validate : JsonValidate
76
+ end
77
+ #~meths
78
+ include T.def_steps(:create, :save)
79
+ #~meths end
62
80
  end
81
+ #:nested-dynamic end
63
82
 
64
- include T.def_steps(:a, :b)
65
- end
66
-
83
+ class JsonValidate < Validate
84
+ step :json
85
+ include T.def_steps(:json)
86
+ end
67
87
  # `edit` and `update` can be called from Nested()
68
88
 
69
89
  # edit/success
70
- create.(seq: [], what: edit).inspect(:seq).must_equal %{<Result:true [[:a, :c, :b]] >}
90
+ create.(seq: [], params: {}).inspect(:seq).must_equal %{<Result:true [[:create, :validate, :save]] >}
71
91
 
72
92
  # update/success
73
- create.(seq: [], what: update).inspect(:seq).must_equal %{<Result:true [[:a, :d, :b]] >}
93
+ create.(seq: [], params: nil).inspect(:seq).must_equal %{<Result:true [[:create, :validate, :json, :save]] >}
74
94
 
75
95
 
76
96
  # wiring of fail:
77
97
  # edit/failure
78
- create.(seq: [], what: edit, c: false).inspect(:seq).must_equal %{<Result:false [[:a, :c]] >}
98
+ create.(seq: [], params: {}, validate: false).inspect(:seq).must_equal %{<Result:false [[:create, :validate]] >}
79
99
  # update/failure
80
- create.(seq: [], what: update, d: false).inspect(:seq).must_equal %{<Result:false [[:a, :d]] >}
100
+ create.(seq: [], params: nil, json: false).inspect(:seq).must_equal %{<Result:false [[:create, :validate, :json]] >}
101
+ end
102
+ end
103
+
104
+ it "Nested(:method), input: :my_input" do
105
+ module C
106
+ #:nested-dynamic
107
+ class Create < Trailblazer::Operation
108
+ step :create
109
+ step Nested(:compute_nested), input: ->(ctx, *) {{foo: :bar, seq: ctx[:seq]}}
110
+ step :save
111
+
112
+ def compute_nested(ctx, params:, **)
113
+ params.is_a?(Hash) ? Validate : JsonValidate
114
+ end
115
+
116
+ #~meths
117
+ include T.def_steps(:create, :save)
118
+ #~meths end
119
+ end
120
+ #:nested-dynamic end
121
+
122
+ class JsonValidate < Validate
123
+ step :json
124
+ include T.def_steps(:json)
125
+ end
126
+
127
+ # `edit` and `update` can be called from Nested()
128
+ end
129
+
130
+ C::Create.(seq: [], params: {}).inspect(:seq).must_equal %{<Result:true [[:create, :validate, :save]] >}
131
+ C::Create.(seq: [], params: nil).inspect(:seq).must_equal %{<Result:true [[:create, :validate, :json, :save]] >}
81
132
  end
82
133
 
83
134
  let(:compute_edit) {
@@ -174,10 +174,12 @@ When raise: return {Railway.fail!} or {Railway.pass!}
174
174
  #:transaction
175
175
  class Memo::Create < Trailblazer::Operation
176
176
  step :find_model
177
+ #:wrap-only
177
178
  step Wrap( MyTransaction ) {
178
179
  step :update
179
180
  step :rehash
180
181
  }
182
+ #:wrap-only end
181
183
  step :notify
182
184
  fail :log_error
183
185
  #~methods
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
10
10
  spec.description = "Macros for Trailblazer's operation"
11
11
  spec.summary = "Macros for Trailblazer's operation: Policy, Wrap, Rescue and more."
12
12
  spec.homepage = "http://trailblazer.to"
13
- spec.license = "MIT"
13
+ spec.license = "LGPL-3.0"
14
14
 
15
15
  spec.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
16
16
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
@@ -18,9 +18,6 @@ Gem::Specification.new do |spec|
18
18
  spec.require_paths = ["lib"]
19
19
 
20
20
  spec.add_development_dependency "bundler"
21
-
22
- # spec.add_development_dependency "trailblazer-operation", ">= 0.4.1", "< 0.5.0"
23
-
24
21
  spec.add_development_dependency "minitest"
25
22
  spec.add_development_dependency "rake"
26
23
 
@@ -28,7 +25,6 @@ Gem::Specification.new do |spec|
28
25
  spec.add_development_dependency "roar"
29
26
  spec.add_development_dependency "trailblazer-developer"
30
27
 
31
- spec.add_dependency "trailblazer-activity-dsl-linear", ">= 0.1.6", "< 0.2.0" # TODO: this dependency will be removed.
32
28
  spec.add_dependency "trailblazer-operation", ">= 0.5.2" # TODO: this dependency will be removed.
33
29
 
34
30
  spec.required_ruby_version = ">= 2.0.0"
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.0.rc13
4
+ version: 2.1.0.rc14
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: 2019-07-24 00:00:00.000000000 Z
12
+ date: 2019-09-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -95,26 +95,6 @@ dependencies:
95
95
  - - ">="
96
96
  - !ruby/object:Gem::Version
97
97
  version: '0'
98
- - !ruby/object:Gem::Dependency
99
- name: trailblazer-activity-dsl-linear
100
- requirement: !ruby/object:Gem::Requirement
101
- requirements:
102
- - - ">="
103
- - !ruby/object:Gem::Version
104
- version: 0.1.6
105
- - - "<"
106
- - !ruby/object:Gem::Version
107
- version: 0.2.0
108
- type: :runtime
109
- prerelease: false
110
- version_requirements: !ruby/object:Gem::Requirement
111
- requirements:
112
- - - ">="
113
- - !ruby/object:Gem::Version
114
- version: 0.1.6
115
- - - "<"
116
- - !ruby/object:Gem::Version
117
- version: 0.2.0
118
98
  - !ruby/object:Gem::Dependency
119
99
  name: trailblazer-operation
120
100
  requirement: !ruby/object:Gem::Requirement
@@ -143,7 +123,7 @@ files:
143
123
  - ".travis.yml"
144
124
  - CHANGES.md
145
125
  - Gemfile
146
- - LICENSE.txt
126
+ - LICENSE
147
127
  - README.md
148
128
  - Rakefile
149
129
  - lib/trailblazer-macro.rb
@@ -170,7 +150,7 @@ files:
170
150
  - trailblazer-macro.gemspec
171
151
  homepage: http://trailblazer.to
172
152
  licenses:
173
- - MIT
153
+ - LGPL-3.0
174
154
  metadata: {}
175
155
  post_install_message:
176
156
  rdoc_options: []
data/LICENSE.txt DELETED
@@ -1,27 +0,0 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2018 Trailblazer GmbH
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in
13
- all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- THE SOFTWARE.
22
-
23
- ---------
24
-
25
- Trailblazer Enterprise has a commercial-friendly license allowing private forks
26
- and modifications of Trailblazer. Please see http://trailblazer.to/enterprise/ for
27
- more detail.