trailblazer-rails 2.2.0 → 2.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Appraisals +3 -2
- data/CHANGES.md +11 -0
- data/README.md +2 -3
- data/Rakefile +5 -4
- data/TESTING.md +9 -0
- data/gemfiles/rails_5.2.gemfile.lock +6 -2
- data/gemfiles/rails_6.0.gemfile.lock +6 -2
- data/gemfiles/rails_6.1.gemfile.lock +6 -2
- data/gemfiles/rails_7.0.gemfile +3 -3
- data/gemfiles/rails_7.0.gemfile.lock +42 -39
- data/lib/trailblazer/rails/cell.rb +0 -2
- data/lib/trailblazer/rails/controller.rb +9 -3
- data/lib/trailblazer/rails/railtie.rb +15 -7
- data/lib/trailblazer/rails/version.rb +1 -1
- data/trailblazer-rails.gemspec +0 -1
- metadata +4 -20
- data/lib/trailblazer/operation/responder.rb +0 -18
- data/lib/trailblazer/rails/railtie/extend_application_controller.rb +0 -28
- data/lib/trailblazer/rails/railtie/loader.rb +0 -58
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1ac9dffebfdbbac3059ac33b30b6b3fc58958d10af2de83c0113c634e4def667
|
4
|
+
data.tar.gz: 74a09ebe5100532430d532c83c69ab5e7dccfe21bf0fdfbbf407af6268652cef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dfd30ba60691fa98acd40e32498dd75a768a23783fd6f62dbf5fce4cfd67684b35bbf2b6ae384112a1acbad1ac65eb60d1c21d305c24c6c0f98fbefb6ae36a33
|
7
|
+
data.tar.gz: e95e9d4e38226bba64a06fb9483e815373ac5ed58ff41d8e5ae279042d5db3feac18e1cec4e06ea1784488d9e01ff044049a3b4472cd0b24f40d84e3a1f4d460
|
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
|
11
|
-
gem "activerecord", "~> 7.0.0
|
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,14 @@
|
|
1
|
+
# 2.4.1
|
2
|
+
|
3
|
+
* Pass keyword arguments to the success result block
|
4
|
+
|
5
|
+
# 2.4.0
|
6
|
+
* Remove legacy code belonging to the old `trailblazer-loader` gem.
|
7
|
+
* Use ActionController::API in addition to ActionController::Base to add the `run` method.
|
8
|
+
|
9
|
+
# 2.3.0
|
10
|
+
* Remove loader support (no longer needed as zeitwerk is now a better alternative)
|
11
|
+
|
1
12
|
# 2.2.0
|
2
13
|
|
3
14
|
* Allow passing ctx variables to `Controller#run`.
|
data/README.md
CHANGED
@@ -2,10 +2,9 @@
|
|
2
2
|
|
3
3
|
*Trailblazer in your Rails controllers.*
|
4
4
|
|
5
|
-
[![Gitter Chat](https://badges.gitter.im/trailblazer/chat.svg)](https://gitter.im/trailblazer/chat)
|
6
5
|
[![TRB Newsletter](https://img.shields.io/badge/TRB-newsletter-lightgrey.svg)](http://trailblazer.to/newsletter/)
|
7
|
-
|
8
|
-
Status](https://
|
6
|
+
![Build
|
7
|
+
Status](https://github.com/trailblazer/trailblazer-rails/actions/workflows/ci.yml/badge.svg?branch=master)
|
9
8
|
[![Gem Version](https://badge.fury.io/rb/trailblazer-rails.svg)](http://badge.fury.io/rb/trailblazer-rails)
|
10
9
|
|
11
10
|
## Endpoint
|
data/Rakefile
CHANGED
@@ -8,10 +8,11 @@ Rake::TestTask.new(:test) do |t|
|
|
8
8
|
t.test_files = FileList["test/**/*_test.rb"]
|
9
9
|
end
|
10
10
|
|
11
|
-
|
12
|
-
require File.expand_path("test/dummy/config/application", __dir__)
|
13
|
-
|
14
|
-
|
11
|
+
begin
|
12
|
+
require File.expand_path("test/dummy/config/application", __dir__)
|
13
|
+
Rails.application.load_tasks
|
14
|
+
rescue LoadError
|
15
|
+
end
|
15
16
|
|
16
17
|
desc "Running Tests"
|
17
18
|
task default: :test
|
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.
|
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.
|
187
|
+
2.3.11
|
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ..
|
3
3
|
specs:
|
4
|
-
trailblazer-rails (2.
|
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.
|
187
|
+
2.3.11
|
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ..
|
3
3
|
specs:
|
4
|
-
trailblazer-rails (2.
|
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.
|
186
|
+
2.3.11
|
data/gemfiles/rails_7.0.gemfile
CHANGED
@@ -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
|
15
|
-
gem "activerecord", "~> 7.0.0
|
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.
|
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.
|
12
|
-
actionview (= 7.0.
|
13
|
-
activesupport (= 7.0.
|
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.
|
19
|
-
activesupport (= 7.0.
|
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.
|
25
|
-
activesupport (= 7.0.
|
26
|
-
activerecord (7.0.
|
27
|
-
activemodel (= 7.0.
|
28
|
-
activesupport (= 7.0.
|
29
|
-
activesupport (7.0.
|
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.
|
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.
|
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.
|
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.
|
75
|
+
i18n (1.10.0)
|
76
76
|
concurrent-ruby (~> 1.0)
|
77
|
-
loofah (2.
|
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.
|
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.
|
88
|
+
nokogiri (1.13.6-x86_64-darwin)
|
89
89
|
racc (~> 1.4)
|
90
|
-
|
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.
|
101
|
-
actionpack (= 7.0.
|
102
|
-
activesupport (= 7.0.
|
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.
|
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
|
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.
|
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.
|
132
|
-
trailblazer-activity (>= 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.
|
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.
|
144
|
-
trailblazer-activity-dsl-linear (>= 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.
|
147
|
+
trailblazer-macro-contract (2.1.2)
|
147
148
|
reform (>= 2.2.0, < 3.0.0)
|
148
|
-
trailblazer-activity-dsl-linear (>= 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.
|
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
|
166
|
-
activerecord (~> 7.0.0
|
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.
|
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,15 @@ 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 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
|
16
22
|
end
|
17
23
|
|
18
24
|
alias run run_v21 unless method_defined?(:run)
|
@@ -1,17 +1,25 @@
|
|
1
1
|
require "rails/railtie"
|
2
|
-
require "trailblazer/loader"
|
3
|
-
require "trailblazer/rails/railtie/extend_application_controller"
|
4
|
-
require "trailblazer/rails/railtie/loader"
|
5
2
|
|
6
3
|
module Trailblazer
|
7
4
|
class Railtie < ::Rails::Railtie
|
8
5
|
config.trailblazer = ActiveSupport::OrderedOptions.new
|
9
6
|
## Accept also an Array of controllers
|
10
|
-
config.trailblazer.application_controller ||=
|
11
|
-
config.trailblazer.enable_loader ||= true
|
7
|
+
config.trailblazer.application_controller ||= %w[ActionController::Base ActionController::API]
|
12
8
|
config.trailblazer.enable_tracing ||= false
|
13
9
|
|
14
|
-
|
15
|
-
|
10
|
+
initializer "trailblazer.application_controller", before: "finisher_hook" do
|
11
|
+
ActiveSupport.on_load(:action_controller) do |app|
|
12
|
+
Trailblazer::Railtie.extend_application_controller!(app)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def extend_application_controller!(app)
|
17
|
+
controllers = Array(::Rails.application.config.trailblazer.application_controller).map(&:to_s)
|
18
|
+
if controllers.include? app.to_s
|
19
|
+
app.send :include, Trailblazer::Rails::Controller
|
20
|
+
app.send :include, Trailblazer::Rails::Controller::Cell if defined?(::Cell)
|
21
|
+
end
|
22
|
+
app
|
23
|
+
end
|
16
24
|
end
|
17
25
|
end
|
data/trailblazer-rails.gemspec
CHANGED
@@ -18,7 +18,6 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.add_dependency "railties", ">= 5.2.0"
|
19
19
|
spec.add_dependency "trailblazer", ">= 2.1.0", "< 2.2.0"
|
20
20
|
|
21
|
-
spec.add_development_dependency "trailblazer-loader", ">= 0.1.0"
|
22
21
|
spec.add_development_dependency "bundler"
|
23
22
|
spec.add_development_dependency "minitest"
|
24
23
|
spec.add_development_dependency "rake"
|
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.
|
4
|
+
version: 2.4.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:
|
11
|
+
date: 2022-06-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
@@ -44,20 +44,6 @@ dependencies:
|
|
44
44
|
- - "<"
|
45
45
|
- !ruby/object:Gem::Version
|
46
46
|
version: 2.2.0
|
47
|
-
- !ruby/object:Gem::Dependency
|
48
|
-
name: trailblazer-loader
|
49
|
-
requirement: !ruby/object:Gem::Requirement
|
50
|
-
requirements:
|
51
|
-
- - ">="
|
52
|
-
- !ruby/object:Gem::Version
|
53
|
-
version: 0.1.0
|
54
|
-
type: :development
|
55
|
-
prerelease: false
|
56
|
-
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
requirements:
|
58
|
-
- - ">="
|
59
|
-
- !ruby/object:Gem::Version
|
60
|
-
version: 0.1.0
|
61
47
|
- !ruby/object:Gem::Dependency
|
62
48
|
name: bundler
|
63
49
|
requirement: !ruby/object:Gem::Requirement
|
@@ -115,6 +101,7 @@ files:
|
|
115
101
|
- LICENSE.txt
|
116
102
|
- README.md
|
117
103
|
- Rakefile
|
104
|
+
- TESTING.md
|
118
105
|
- gemfiles/rails_5.2.gemfile
|
119
106
|
- gemfiles/rails_5.2.gemfile.lock
|
120
107
|
- gemfiles/rails_6.0.gemfile
|
@@ -124,14 +111,11 @@ files:
|
|
124
111
|
- gemfiles/rails_7.0.gemfile
|
125
112
|
- gemfiles/rails_7.0.gemfile.lock
|
126
113
|
- lib/trailblazer-rails.rb
|
127
|
-
- lib/trailblazer/operation/responder.rb
|
128
114
|
- lib/trailblazer/rails.rb
|
129
115
|
- lib/trailblazer/rails/cell.rb
|
130
116
|
- lib/trailblazer/rails/controller.rb
|
131
117
|
- lib/trailblazer/rails/form.rb
|
132
118
|
- lib/trailblazer/rails/railtie.rb
|
133
|
-
- lib/trailblazer/rails/railtie/extend_application_controller.rb
|
134
|
-
- lib/trailblazer/rails/railtie/loader.rb
|
135
119
|
- lib/trailblazer/rails/version.rb
|
136
120
|
- trailblazer-rails.gemspec
|
137
121
|
homepage: https://trailblazer.to/2.1/docs/trailblazer.html#trailblazer-rails
|
@@ -153,7 +137,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
153
137
|
- !ruby/object:Gem::Version
|
154
138
|
version: '0'
|
155
139
|
requirements: []
|
156
|
-
rubygems_version: 3.
|
140
|
+
rubygems_version: 3.1.6
|
157
141
|
signing_key:
|
158
142
|
specification_version: 4
|
159
143
|
summary: Convenient Rails support for Trailblazer.
|
@@ -1,18 +0,0 @@
|
|
1
|
-
module Trailblazer::Operation::Responder
|
2
|
-
def self.included(base)
|
3
|
-
base.extend ClassMethods
|
4
|
-
end
|
5
|
-
|
6
|
-
module ClassMethods
|
7
|
-
def model_name
|
8
|
-
model_class.model_name
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
extend Forwardable
|
13
|
-
def_delegators :@model, :to_param, :destroyed?, :persisted?
|
14
|
-
|
15
|
-
def to_model
|
16
|
-
@model
|
17
|
-
end
|
18
|
-
end
|
@@ -1,28 +0,0 @@
|
|
1
|
-
require "active_support/concern"
|
2
|
-
|
3
|
-
module Trailblazer
|
4
|
-
class Railtie < ::Rails::Railtie
|
5
|
-
module ExtendApplicationController
|
6
|
-
extend ActiveSupport::Concern
|
7
|
-
|
8
|
-
included do
|
9
|
-
initializer "trailblazer.application_controller", before: "finisher_hook" do
|
10
|
-
ActiveSupport::Reloader.to_prepare do
|
11
|
-
ActiveSupport.on_load(:action_controller) do |app|
|
12
|
-
Trailblazer::Railtie.extend_application_controller!(app)
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
def extend_application_controller!(app)
|
18
|
-
controllers = Array(::Rails.application.config.trailblazer.application_controller).map(&:to_s)
|
19
|
-
if controllers.include? app.to_s
|
20
|
-
app.send :include, Trailblazer::Rails::Controller
|
21
|
-
app.send :include, Trailblazer::Rails::Controller::Cell if defined?(::Cell)
|
22
|
-
end
|
23
|
-
app
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
@@ -1,58 +0,0 @@
|
|
1
|
-
require "active_support/concern"
|
2
|
-
|
3
|
-
module Trailblazer
|
4
|
-
class Railtie < ::Rails::Railtie
|
5
|
-
module Loader
|
6
|
-
extend ActiveSupport::Concern
|
7
|
-
|
8
|
-
included do
|
9
|
-
def self.load_concepts(app)
|
10
|
-
load_for(app)
|
11
|
-
|
12
|
-
engines.each { |engine| load_for(engine) }
|
13
|
-
end
|
14
|
-
|
15
|
-
def self.engines
|
16
|
-
::Rails.application.railties.select { |tie| tie.is_a?(::Rails::Engine) }
|
17
|
-
end
|
18
|
-
|
19
|
-
def self.load_for(app)
|
20
|
-
Trailblazer::Loader.new.(prepend: AllModelFiles, root: app.root) { |file| require_dependency(file) }
|
21
|
-
end
|
22
|
-
|
23
|
-
# Prepend model file, before the concept files like operation.rb get loaded.
|
24
|
-
ModelFile = ->(input, options) do
|
25
|
-
model = "app/models/#{options[:name]}.rb"
|
26
|
-
File.exist?(model) ? [model] + input : input
|
27
|
-
end
|
28
|
-
|
29
|
-
# Load all model files before any TRB files.
|
30
|
-
AllModelFiles = ->(input, options) do
|
31
|
-
Dir.glob("#{options[:root]}/app/models/**/*.rb").sort + input
|
32
|
-
end
|
33
|
-
|
34
|
-
# This is to autoload Operation::Dispatch, etc. I'm simply assuming people find this helpful in Rails.
|
35
|
-
initializer "trailblazer.library_autoloading" do
|
36
|
-
end
|
37
|
-
|
38
|
-
# thank you, http://stackoverflow.com/a/17573888/465070
|
39
|
-
initializer "trailblazer.install", after: "reform.form_extensions" do |app|
|
40
|
-
# the trb autoloading has to be run after initializers have been loaded, so we can tweak inclusion of features in
|
41
|
-
# initializers.
|
42
|
-
|
43
|
-
# TODO: remove me in v2.2.0
|
44
|
-
if config.trailblazer.use_loader.to_s.present?
|
45
|
-
warn "DEPRECATION WARNING [trailblazer-rails]: please use config.trailblazer.enable_loader" \
|
46
|
-
" to enable/disable the loader, config.trailblazer.use_loader will be removed from version 2.2.0"
|
47
|
-
end
|
48
|
-
|
49
|
-
if config.trailblazer.enable_loader || config.trailblazer.use_loader
|
50
|
-
ActiveSupport::Reloader.to_prepare do
|
51
|
-
Trailblazer::Railtie.load_concepts(app)
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|