trailblazer-rails 2.3.0 → 2.4.2

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: e43931b1874b64a31a8a64c738d6568a213c3fa4d796f4dd28d93b894f3c928a
4
- data.tar.gz: d51bde81af75fcd5fead6b78a2e27b1caddbd1e0b86bf575a139784fd92bd306
3
+ metadata.gz: 9faf7799e32876341a5879295f057abdfd07e604d6514dffea13ae45e32a927e
4
+ data.tar.gz: c2798545a46b91da97399c51d1958f425c3d14aaf5c76f996fba153be18cd486
5
5
  SHA512:
6
- metadata.gz: 430cc9f51fe61f924a9d82581ddbcd00343a7b70956e85f82da8cd4a31577e95533f887ab13889a947982957ccebdcca31e1402414886dcb1c5e775ab0fe8421
7
- data.tar.gz: 65c5490e4030fb7638e3cab85d3d7e1a1f7a320e85f5f84cf884f622ce945b86738e34819b835bf883801afe09bb7773aa33d4a399d0a9e5db62d6cd6addb700
6
+ metadata.gz: 3b2b1685d78a0b221fb6631187bbf07723d03716202dffebf0d4affeb9b753bdb133f506280c9294143eec94d028045985a7ed395d5b1c2d530ea64a0648abed
7
+ data.tar.gz: 20ac39cc9d69742d70590b201ce2d66a11d40fcbe2ad68f11aa9b297fa9fc5b5ed995761b00d6f5c0b1d2ca0618089c7721ade8de6cab4c8a9942d602be8cbfb
data/Appraisals CHANGED
@@ -7,8 +7,9 @@ appraise "rails-6.1" do
7
7
  gem "activerecord", "~> 6.1.0"
8
8
  end
9
9
  appraise "rails-7.0" do
10
- gem "actionpack", "~> 7.0.0.rc1"
11
- gem "activerecord", "~> 7.0.0.rc1"
10
+ gem "actionpack", "~> 7.0.0"
11
+ gem "activerecord", "~> 7.0.0"
12
+ gem "sqlite3", "~> 1.4.0"
12
13
  end
13
14
 
14
15
  appraise "rails-5.2" do
data/CHANGES.md CHANGED
@@ -1,3 +1,15 @@
1
+ # 2.4.2
2
+
3
+ * Fix a bug where `Controller#run` wouldn't return the ctx.
4
+
5
+ # 2.4.1
6
+
7
+ * Pass keyword arguments to the success result block.
8
+
9
+ # 2.4.0
10
+ * Remove legacy code belonging to the old `trailblazer-loader` gem.
11
+ * Use ActionController::API in addition to ActionController::Base to add the `run` method.
12
+
1
13
  # 2.3.0
2
14
  * Remove loader support (no longer needed as zeitwerk is now a better alternative)
3
15
 
data/README.md CHANGED
@@ -36,6 +36,16 @@ Note that the 2.x version only runs with TRB >= 2.1.0.
36
36
  * `config.trailblazer.enable_loader = false` to disable Trailblazer loader (default TRUE)
37
37
  * `config.trailblazer.enable_tracing = true` to enable tracing when using `run` (default FALSE)
38
38
 
39
+ ## Testing
40
+
41
+ If you feel like contributing, you can run the test suite per Rails version as follows.
42
+
43
+ ```
44
+ $ BUNDLE_GEMFILE=gemfiles/rails_7.0.gemfile bundle exec rake db:create db:schema:load test
45
+ ```
46
+
47
+ Successful merges will be rewarded with at least one beer!
48
+
39
49
  ## License
40
50
 
41
51
  The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
data/TESTING.md ADDED
@@ -0,0 +1,9 @@
1
+ Trailblazer-Rails supports rails 5.2.0 and up.
2
+
3
+ To run the tests, you need to have the run the following command:
4
+ ```
5
+ bundle install
6
+ bundle exec appraisal install # This will install the different version of rails
7
+ bundle exec appraisal rake db:create db:schema:load test # Run tests in all versions
8
+ bundle exec appraisal rails-7.0 rake db:create db:schema:load test # Run tests in rails 7.0 only
9
+ ```
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- trailblazer-rails (2.3.0)
4
+ trailblazer-rails (2.4.1)
5
5
  railties (>= 5.2.0)
6
6
  trailblazer (>= 2.1.0, < 2.2.0)
7
7
 
@@ -87,6 +87,8 @@ GEM
87
87
  capybara
88
88
  minitest (~> 5.0)
89
89
  rake
90
+ nokogiri (1.12.5-x86_64-darwin)
91
+ racc (~> 1.4)
90
92
  nokogiri (1.12.5-x86_64-linux)
91
93
  racc (~> 1.4)
92
94
  public_suffix (4.0.6)
@@ -160,6 +162,8 @@ GEM
160
162
  nokogiri (~> 1.8)
161
163
 
162
164
  PLATFORMS
165
+ x86_64-darwin-19
166
+ x86_64-darwin-21
163
167
  x86_64-linux
164
168
 
165
169
  DEPENDENCIES
@@ -180,4 +184,4 @@ DEPENDENCIES
180
184
  trailblazer-rails!
181
185
 
182
186
  BUNDLED WITH
183
- 2.2.22
187
+ 2.3.11
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- trailblazer-rails (2.3.0)
4
+ trailblazer-rails (2.4.1)
5
5
  railties (>= 5.2.0)
6
6
  trailblazer (>= 2.1.0, < 2.2.0)
7
7
 
@@ -86,6 +86,8 @@ GEM
86
86
  capybara
87
87
  minitest (~> 5.0)
88
88
  rake
89
+ nokogiri (1.12.5-x86_64-darwin)
90
+ racc (~> 1.4)
89
91
  nokogiri (1.12.5-x86_64-linux)
90
92
  racc (~> 1.4)
91
93
  public_suffix (4.0.6)
@@ -160,6 +162,8 @@ GEM
160
162
  zeitwerk (2.5.1)
161
163
 
162
164
  PLATFORMS
165
+ x86_64-darwin-19
166
+ x86_64-darwin-21
163
167
  x86_64-linux
164
168
 
165
169
  DEPENDENCIES
@@ -180,4 +184,4 @@ DEPENDENCIES
180
184
  trailblazer-rails!
181
185
 
182
186
  BUNDLED WITH
183
- 2.2.22
187
+ 2.3.11
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- trailblazer-rails (2.3.0)
4
+ trailblazer-rails (2.4.1)
5
5
  railties (>= 5.2.0)
6
6
  trailblazer (>= 2.1.0, < 2.2.0)
7
7
 
@@ -86,6 +86,8 @@ GEM
86
86
  capybara
87
87
  minitest (~> 5.0)
88
88
  rake
89
+ nokogiri (1.12.5-x86_64-darwin)
90
+ racc (~> 1.4)
89
91
  nokogiri (1.12.5-x86_64-linux)
90
92
  racc (~> 1.4)
91
93
  public_suffix (4.0.6)
@@ -159,6 +161,8 @@ GEM
159
161
  zeitwerk (2.5.1)
160
162
 
161
163
  PLATFORMS
164
+ x86_64-darwin-19
165
+ x86_64-darwin-21
162
166
  x86_64-linux
163
167
 
164
168
  DEPENDENCIES
@@ -179,4 +183,4 @@ DEPENDENCIES
179
183
  trailblazer-rails!
180
184
 
181
185
  BUNDLED WITH
182
- 2.2.22
186
+ 2.3.11
@@ -8,10 +8,10 @@ gem "reform-rails"
8
8
  gem "trailblazer"
9
9
  gem "trailblazer-cells"
10
10
  gem "trailblazer-loader"
11
- gem "sqlite3"
11
+ gem "sqlite3", "~> 1.4.0"
12
12
  gem "minitest-capybara"
13
13
  gem "appraisal"
14
- gem "actionpack", "~> 7.0.0.rc1"
15
- gem "activerecord", "~> 7.0.0.rc1"
14
+ gem "actionpack", "~> 7.0.0"
15
+ gem "activerecord", "~> 7.0.0"
16
16
 
17
17
  gemspec path: "../"
@@ -1,32 +1,32 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- trailblazer-rails (2.3.0)
4
+ trailblazer-rails (2.4.1)
5
5
  railties (>= 5.2.0)
6
6
  trailblazer (>= 2.1.0, < 2.2.0)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- actionpack (7.0.0.rc1)
12
- actionview (= 7.0.0.rc1)
13
- activesupport (= 7.0.0.rc1)
11
+ actionpack (7.0.3)
12
+ actionview (= 7.0.3)
13
+ activesupport (= 7.0.3)
14
14
  rack (~> 2.0, >= 2.2.0)
15
15
  rack-test (>= 0.6.3)
16
16
  rails-dom-testing (~> 2.0)
17
17
  rails-html-sanitizer (~> 1.0, >= 1.2.0)
18
- actionview (7.0.0.rc1)
19
- activesupport (= 7.0.0.rc1)
18
+ actionview (7.0.3)
19
+ activesupport (= 7.0.3)
20
20
  builder (~> 3.1)
21
21
  erubi (~> 1.4)
22
22
  rails-dom-testing (~> 2.0)
23
23
  rails-html-sanitizer (~> 1.1, >= 1.2.0)
24
- activemodel (7.0.0.rc1)
25
- activesupport (= 7.0.0.rc1)
26
- activerecord (7.0.0.rc1)
27
- activemodel (= 7.0.0.rc1)
28
- activesupport (= 7.0.0.rc1)
29
- activesupport (7.0.0.rc1)
24
+ activemodel (7.0.3)
25
+ activesupport (= 7.0.3)
26
+ activerecord (7.0.3)
27
+ activemodel (= 7.0.3)
28
+ activesupport (= 7.0.3)
29
+ activesupport (7.0.3)
30
30
  concurrent-ruby (~> 1.0, >= 1.0.2)
31
31
  i18n (>= 1.6, < 2)
32
32
  minitest (>= 5.1)
@@ -38,7 +38,7 @@ GEM
38
38
  rake
39
39
  thor (>= 0.14.0)
40
40
  builder (3.2.4)
41
- capybara (3.36.0)
41
+ capybara (3.37.1)
42
42
  addressable
43
43
  matrix
44
44
  mini_mime (>= 0.1.3)
@@ -55,10 +55,10 @@ GEM
55
55
  cells-erb (0.1.0)
56
56
  cells (~> 4.0)
57
57
  erbse (>= 0.1.1)
58
- cells-rails (0.1.4)
58
+ cells-rails (0.1.5)
59
59
  actionpack (>= 5.0)
60
60
  cells (>= 4.1.6, < 5.0.0)
61
- concurrent-ruby (1.1.9)
61
+ concurrent-ruby (1.1.10)
62
62
  crass (1.0.6)
63
63
  declarative (0.0.20)
64
64
  declarative-builder (0.1.0)
@@ -72,22 +72,24 @@ GEM
72
72
  erubi (1.10.0)
73
73
  hashie (5.0.0)
74
74
  hirb (0.7.3)
75
- i18n (1.8.11)
75
+ i18n (1.10.0)
76
76
  concurrent-ruby (~> 1.0)
77
- loofah (2.12.0)
77
+ loofah (2.18.0)
78
78
  crass (~> 1.0.2)
79
79
  nokogiri (>= 1.5.9)
80
80
  matrix (0.4.2)
81
81
  method_source (1.0.0)
82
82
  mini_mime (1.1.2)
83
- minitest (5.14.4)
83
+ minitest (5.15.0)
84
84
  minitest-capybara (0.9.0)
85
85
  capybara
86
86
  minitest (~> 5.0)
87
87
  rake
88
- nokogiri (1.12.5-x86_64-linux)
88
+ nokogiri (1.13.6-x86_64-darwin)
89
89
  racc (~> 1.4)
90
- public_suffix (4.0.6)
90
+ nokogiri (1.13.6-x86_64-linux)
91
+ racc (~> 1.4)
92
+ public_suffix (4.0.7)
91
93
  racc (1.6.0)
92
94
  rack (2.2.3)
93
95
  rack-test (1.1.0)
@@ -97,9 +99,9 @@ GEM
97
99
  nokogiri (>= 1.6)
98
100
  rails-html-sanitizer (1.4.2)
99
101
  loofah (~> 2.3)
100
- railties (7.0.0.rc1)
101
- actionpack (= 7.0.0.rc1)
102
- activesupport (= 7.0.0.rc1)
102
+ railties (7.0.3)
103
+ actionpack (= 7.0.3)
104
+ activesupport (= 7.0.3)
103
105
  method_source
104
106
  rake (>= 12.2)
105
107
  thor (~> 1.0)
@@ -112,40 +114,39 @@ GEM
112
114
  reform-rails (0.2.3)
113
115
  activemodel (>= 5.0)
114
116
  reform (>= 2.3.1, < 3.0.0)
115
- regexp_parser (2.2.0)
117
+ regexp_parser (2.4.0)
116
118
  representable (3.1.1)
117
119
  declarative (< 0.1.0)
118
120
  trailblazer-option (>= 0.1.1, < 0.2.0)
119
121
  uber (< 0.2.0)
120
122
  sqlite3 (1.4.2)
121
123
  temple (0.8.2)
122
- thor (1.1.0)
124
+ thor (1.2.1)
123
125
  tilt (2.0.10)
124
126
  trailblazer (2.1.0)
125
127
  trailblazer-macro (>= 2.1.0, < 2.2.0)
126
128
  trailblazer-macro-contract (>= 2.1.0, < 2.2.0)
127
129
  trailblazer-operation
128
- trailblazer-activity (0.12.2)
130
+ trailblazer-activity (0.13.0)
129
131
  trailblazer-context (~> 0.5.0)
130
132
  trailblazer-option (~> 0.1.0)
131
- trailblazer-activity-dsl-linear (0.4.3)
132
- trailblazer-activity (>= 0.12.2, < 0.13.0)
133
+ trailblazer-activity-dsl-linear (0.5.0)
134
+ trailblazer-activity (>= 0.13.0, < 1.0.0)
133
135
  trailblazer-cells (0.0.3)
134
136
  cells (>= 4.1.0.rc1, < 5.0.0)
135
137
  trailblazer-context (0.5.0)
136
138
  hashie (>= 3.0.0)
137
- trailblazer-developer (0.0.22)
139
+ trailblazer-developer (0.0.23)
138
140
  hirb
139
- representable (>= 3.1.1, < 4.0.0)
140
141
  trailblazer-activity (>= 0.12.2, < 1.0.0)
141
142
  trailblazer-activity-dsl-linear (>= 0.4.1, < 1.0.0)
142
143
  trailblazer-loader (0.1.2)
143
- trailblazer-macro (2.1.7)
144
- trailblazer-activity-dsl-linear (>= 0.4.0, < 0.5.0)
144
+ trailblazer-macro (2.1.9)
145
+ trailblazer-activity-dsl-linear (>= 0.5.0, < 0.6.0)
145
146
  trailblazer-operation (>= 0.7.0)
146
- trailblazer-macro-contract (2.1.1)
147
+ trailblazer-macro-contract (2.1.2)
147
148
  reform (>= 2.2.0, < 3.0.0)
148
- trailblazer-activity-dsl-linear (>= 0.4.0, < 0.5.0)
149
+ trailblazer-activity-dsl-linear (>= 0.5.0, < 0.6.0)
149
150
  trailblazer-operation (0.7.5)
150
151
  trailblazer-activity (>= 0.12.2, < 1.0.0)
151
152
  trailblazer-activity-dsl-linear (>= 0.4.1, < 1.0.0)
@@ -156,14 +157,16 @@ GEM
156
157
  uber (0.1.0)
157
158
  xpath (3.2.0)
158
159
  nokogiri (~> 1.8)
159
- zeitwerk (2.5.1)
160
+ zeitwerk (2.6.0)
160
161
 
161
162
  PLATFORMS
163
+ x86_64-darwin-19
164
+ x86_64-darwin-21
162
165
  x86_64-linux
163
166
 
164
167
  DEPENDENCIES
165
- actionpack (~> 7.0.0.rc1)
166
- activerecord (~> 7.0.0.rc1)
168
+ actionpack (~> 7.0.0)
169
+ activerecord (~> 7.0.0)
167
170
  appraisal
168
171
  bundler
169
172
  cells-erb
@@ -172,11 +175,11 @@ DEPENDENCIES
172
175
  minitest-capybara
173
176
  rake
174
177
  reform-rails
175
- sqlite3
178
+ sqlite3 (~> 1.4.0)
176
179
  trailblazer
177
180
  trailblazer-cells
178
181
  trailblazer-loader
179
182
  trailblazer-rails!
180
183
 
181
184
  BUNDLED WITH
182
- 2.2.22
185
+ 2.3.11
@@ -1,7 +1,7 @@
1
1
  module Trailblazer::Rails
2
2
  module Controller
3
3
  # TODO: deprecate {*dependencies}.
4
- def run_v21(operation, *dependencies, **variables)
4
+ def run_v21(operation, *dependencies, **variables, &block)
5
5
  result = if Rails.application.config.trailblazer.enable_tracing
6
6
  _run_operation_v21(operation, :trace, *dependencies, **variables).tap { |r| _operation_trace(r) }
7
7
  else
@@ -10,9 +10,17 @@ module Trailblazer::Rails
10
10
 
11
11
  _assign_trb_ivars(result)
12
12
 
13
- yield(result) if result.success? && block_given?
14
-
15
13
  @_result = result
14
+
15
+ return result if result.failure? || block.nil?
16
+
17
+ if block.arity.eql?(1)
18
+ yield(result)
19
+ else
20
+ yield(result, **result.to_hash)
21
+ end
22
+
23
+ result
16
24
  end
17
25
 
18
26
  alias run run_v21 unless method_defined?(:run)
@@ -4,14 +4,12 @@ module Trailblazer
4
4
  class Railtie < ::Rails::Railtie
5
5
  config.trailblazer = ActiveSupport::OrderedOptions.new
6
6
  ## Accept also an Array of controllers
7
- config.trailblazer.application_controller ||= "ActionController::Base"
7
+ config.trailblazer.application_controller ||= %w[ActionController::Base ActionController::API]
8
8
  config.trailblazer.enable_tracing ||= false
9
9
 
10
10
  initializer "trailblazer.application_controller", before: "finisher_hook" do
11
- ActiveSupport::Reloader.to_prepare do
12
- ActiveSupport.on_load(:action_controller) do |app|
13
- Trailblazer::Railtie.extend_application_controller!(app)
14
- end
11
+ ActiveSupport.on_load(:action_controller) do |app|
12
+ Trailblazer::Railtie.extend_application_controller!(app)
15
13
  end
16
14
  end
17
15
 
@@ -1,5 +1,5 @@
1
1
  module Trailblazer
2
2
  module Rails
3
- VERSION = "2.3.0".freeze
3
+ VERSION = "2.4.2".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trailblazer-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.0
4
+ version: 2.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick Sutterer
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-12-13 00:00:00.000000000 Z
11
+ date: 2022-07-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -86,7 +86,7 @@ dependencies:
86
86
  - - ">="
87
87
  - !ruby/object:Gem::Version
88
88
  version: '0'
89
- description:
89
+ description:
90
90
  email:
91
91
  - apotonick@gmail.com
92
92
  executables: []
@@ -101,6 +101,7 @@ files:
101
101
  - LICENSE.txt
102
102
  - README.md
103
103
  - Rakefile
104
+ - TESTING.md
104
105
  - gemfiles/rails_5.2.gemfile
105
106
  - gemfiles/rails_5.2.gemfile.lock
106
107
  - gemfiles/rails_6.0.gemfile
@@ -121,7 +122,7 @@ homepage: https://trailblazer.to/2.1/docs/trailblazer.html#trailblazer-rails
121
122
  licenses:
122
123
  - MIT
123
124
  metadata: {}
124
- post_install_message:
125
+ post_install_message:
125
126
  rdoc_options: []
126
127
  require_paths:
127
128
  - lib
@@ -136,8 +137,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
136
137
  - !ruby/object:Gem::Version
137
138
  version: '0'
138
139
  requirements: []
139
- rubygems_version: 3.2.22
140
- signing_key:
140
+ rubygems_version: 3.2.3
141
+ signing_key:
141
142
  specification_version: 4
142
143
  summary: Convenient Rails support for Trailblazer.
143
144
  test_files: []