trailblazer-rails 2.1.0 → 2.1.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/.rubocop.yml +9 -0
- data/.rubocop_todo.yml +294 -0
- data/CHANGES.md +6 -0
- data/README.md +5 -0
- data/lib/trailblazer/rails/cell.rb +2 -2
- data/lib/trailblazer/rails/controller.rb +18 -3
- data/lib/trailblazer/rails/railtie.rb +5 -4
- data/lib/trailblazer/rails/test/integration.rb +1 -1
- data/lib/trailblazer/rails/version.rb +1 -1
- data/trailblazer-rails.gemspec +1 -1
- metadata +18 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 717fe6cda0f26fc905222fb717c55df70e2da904
|
|
4
|
+
data.tar.gz: 0f583866a2b10db4f33e29b57d6e37f1274c8a4a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0a960ad86eace338eea9218729a4d015b962215fd5d6734287da39aaf865f6fad5df69d8d056fe8af854a188621493e1575a46eb62ef2e356a505b07b514357b
|
|
7
|
+
data.tar.gz: e7c4c7a8dd737c6cff8b35cd81a4d6d3891d44d6fc75f9c9238b2ac3d6af0f91ace67f00c8f530ac4ef4e47263d261b01c929643d846cb83f0c751fc00985f87
|
data/.rubocop.yml
ADDED
data/.rubocop_todo.yml
ADDED
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
# This configuration was generated by
|
|
2
|
+
# `rubocop --auto-gen-config`
|
|
3
|
+
# on 2018-04-05 15:17:59 +0800 using RuboCop version 0.52.0.
|
|
4
|
+
# The point is for the user to remove these configuration records
|
|
5
|
+
# one by one as the offenses are removed from the code base.
|
|
6
|
+
# Note that changes in the inspected code, or installation of new
|
|
7
|
+
# versions of RuboCop, may require this file to be generated again.
|
|
8
|
+
|
|
9
|
+
# Offense count: 9
|
|
10
|
+
# Cop supports --auto-correct.
|
|
11
|
+
# Configuration parameters: Include, TreatCommentsAsGroupSeparators.
|
|
12
|
+
# Include: **/Gemfile, **/gems.rb
|
|
13
|
+
Bundler/OrderedGems:
|
|
14
|
+
Exclude:
|
|
15
|
+
- 'test/rails5.0/Gemfile'
|
|
16
|
+
- 'test/rails5.1/Gemfile'
|
|
17
|
+
- 'test/rails5.2/Gemfile'
|
|
18
|
+
|
|
19
|
+
# Offense count: 2
|
|
20
|
+
# Cop supports --auto-correct.
|
|
21
|
+
# Configuration parameters: Include, TreatCommentsAsGroupSeparators.
|
|
22
|
+
# Include: **/*.gemspec
|
|
23
|
+
Gemspec/OrderedDependencies:
|
|
24
|
+
Exclude:
|
|
25
|
+
- 'trailblazer-rails.gemspec'
|
|
26
|
+
|
|
27
|
+
# Offense count: 2
|
|
28
|
+
# Cop supports --auto-correct.
|
|
29
|
+
# Configuration parameters: EnforcedStyle, IndentationWidth.
|
|
30
|
+
# SupportedStyles: outdent, indent
|
|
31
|
+
Layout/AccessModifierIndentation:
|
|
32
|
+
Exclude:
|
|
33
|
+
- 'lib/trailblazer/rails/controller.rb'
|
|
34
|
+
- 'test/rails5.0/app/controllers/params_controller.rb'
|
|
35
|
+
|
|
36
|
+
# Offense count: 5
|
|
37
|
+
# Cop supports --auto-correct.
|
|
38
|
+
Layout/EmptyLines:
|
|
39
|
+
Exclude:
|
|
40
|
+
- 'test/rails5.2/Gemfile'
|
|
41
|
+
- 'test/test_helper.rb'
|
|
42
|
+
|
|
43
|
+
# Offense count: 4
|
|
44
|
+
# Cop supports --auto-correct.
|
|
45
|
+
Layout/EmptyLinesAroundAccessModifier:
|
|
46
|
+
Exclude:
|
|
47
|
+
- 'lib/trailblazer/rails/controller.rb'
|
|
48
|
+
- 'test/rails5.0/app/controllers/params_controller.rb'
|
|
49
|
+
- 'test/rails5.1/app/controllers/params_controller.rb'
|
|
50
|
+
- 'test/rails5.2/app/controllers/params_controller.rb'
|
|
51
|
+
|
|
52
|
+
# Offense count: 9
|
|
53
|
+
# Cop supports --auto-correct.
|
|
54
|
+
# Configuration parameters: EnforcedStyle.
|
|
55
|
+
# SupportedStyles: empty_lines, no_empty_lines
|
|
56
|
+
Layout/EmptyLinesAroundBlockBody:
|
|
57
|
+
Exclude:
|
|
58
|
+
- 'test/rails5.0/config/routes.rb'
|
|
59
|
+
- 'test/rails5.0/db/schema.rb'
|
|
60
|
+
- 'test/rails5.1/config/routes.rb'
|
|
61
|
+
- 'test/rails5.1/db/schema.rb'
|
|
62
|
+
- 'test/rails5.2/config/routes.rb'
|
|
63
|
+
- 'test/rails5.2/db/schema.rb'
|
|
64
|
+
|
|
65
|
+
# Offense count: 3
|
|
66
|
+
# Cop supports --auto-correct.
|
|
67
|
+
# Configuration parameters: AllowForAlignment, ForceEqualSignAlignment.
|
|
68
|
+
Layout/ExtraSpacing:
|
|
69
|
+
Exclude:
|
|
70
|
+
- 'test/rails5.0/bin/setup'
|
|
71
|
+
- 'test/rails5.1/bin/setup'
|
|
72
|
+
- 'test/rails5.2/bin/setup'
|
|
73
|
+
|
|
74
|
+
# Offense count: 2
|
|
75
|
+
# Cop supports --auto-correct.
|
|
76
|
+
# Configuration parameters: EnforcedStyle.
|
|
77
|
+
# SupportedStyles: normal, rails
|
|
78
|
+
Layout/IndentationConsistency:
|
|
79
|
+
Exclude:
|
|
80
|
+
- 'test/rails5.1/app/controllers/params_controller.rb'
|
|
81
|
+
- 'test/rails5.2/app/controllers/params_controller.rb'
|
|
82
|
+
|
|
83
|
+
# Offense count: 3
|
|
84
|
+
# Cop supports --auto-correct.
|
|
85
|
+
Layout/LeadingCommentSpace:
|
|
86
|
+
Exclude:
|
|
87
|
+
- 'test/rails5.0/Gemfile'
|
|
88
|
+
- 'test/rails5.1/Gemfile'
|
|
89
|
+
- 'test/rails5.2/Gemfile'
|
|
90
|
+
|
|
91
|
+
# Offense count: 2
|
|
92
|
+
# Cop supports --auto-correct.
|
|
93
|
+
Layout/SpaceAfterColon:
|
|
94
|
+
Exclude:
|
|
95
|
+
- 'test/rails5.1/app/controllers/args_controller.rb'
|
|
96
|
+
- 'test/rails5.2/app/controllers/args_controller.rb'
|
|
97
|
+
|
|
98
|
+
# Offense count: 3
|
|
99
|
+
# Cop supports --auto-correct.
|
|
100
|
+
Layout/SpaceBeforeComment:
|
|
101
|
+
Exclude:
|
|
102
|
+
- 'test/rails5.0/Gemfile'
|
|
103
|
+
- 'test/rails5.1/Gemfile'
|
|
104
|
+
- 'test/rails5.2/Gemfile'
|
|
105
|
+
|
|
106
|
+
# Offense count: 6
|
|
107
|
+
# Cop supports --auto-correct.
|
|
108
|
+
# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces, SpaceBeforeBlockParameters.
|
|
109
|
+
# SupportedStyles: space, no_space
|
|
110
|
+
# SupportedStylesForEmptyBraces: space, no_space
|
|
111
|
+
Layout/SpaceInsideBlockBraces:
|
|
112
|
+
Exclude:
|
|
113
|
+
- 'test/rails5.0/app/concepts/params/operation/with_args.rb'
|
|
114
|
+
- 'test/rails5.1/app/concepts/params/operation/with_args.rb'
|
|
115
|
+
- 'test/rails5.2/app/concepts/params/operation/with_args.rb'
|
|
116
|
+
|
|
117
|
+
# Offense count: 51
|
|
118
|
+
# Cop supports --auto-correct.
|
|
119
|
+
Layout/SpaceInsideParens:
|
|
120
|
+
Exclude:
|
|
121
|
+
- 'test/rails5.0/app/concepts/song/operation/create.rb'
|
|
122
|
+
- 'test/rails5.0/app/concepts/song/operation/show.rb'
|
|
123
|
+
- 'test/rails5.0/app/controllers/artists_controller.rb'
|
|
124
|
+
- 'test/rails5.0/app/controllers/params_controller.rb'
|
|
125
|
+
- 'test/rails5.1/app/concepts/song/operation/create.rb'
|
|
126
|
+
- 'test/rails5.1/app/concepts/song/operation/show.rb'
|
|
127
|
+
- 'test/rails5.1/app/controllers/artists_controller.rb'
|
|
128
|
+
- 'test/rails5.1/app/controllers/params_controller.rb'
|
|
129
|
+
- 'test/rails5.2/app/concepts/song/operation/create.rb'
|
|
130
|
+
- 'test/rails5.2/app/concepts/song/operation/show.rb'
|
|
131
|
+
- 'test/rails5.2/app/controllers/artists_controller.rb'
|
|
132
|
+
- 'test/rails5.2/app/controllers/params_controller.rb'
|
|
133
|
+
|
|
134
|
+
# Offense count: 3
|
|
135
|
+
# Cop supports --auto-correct.
|
|
136
|
+
# Configuration parameters: EnforcedStyle.
|
|
137
|
+
# SupportedStyles: space, no_space
|
|
138
|
+
Layout/SpaceInsideStringInterpolation:
|
|
139
|
+
Exclude:
|
|
140
|
+
- 'test/rails5.0/app/concepts/params/operation/with_args.rb'
|
|
141
|
+
- 'test/rails5.1/app/concepts/params/operation/with_args.rb'
|
|
142
|
+
- 'test/rails5.2/app/concepts/params/operation/with_args.rb'
|
|
143
|
+
|
|
144
|
+
# Offense count: 1
|
|
145
|
+
# Cop supports --auto-correct.
|
|
146
|
+
Lint/DeprecatedClassMethods:
|
|
147
|
+
Exclude:
|
|
148
|
+
- 'test/test_helper.rb'
|
|
149
|
+
|
|
150
|
+
# Offense count: 1
|
|
151
|
+
Lint/ParenthesesAsGroupedExpression:
|
|
152
|
+
Exclude:
|
|
153
|
+
- 'test/test_helper.rb'
|
|
154
|
+
|
|
155
|
+
# Offense count: 1
|
|
156
|
+
# Configuration parameters: ContextCreatingMethods, MethodCreatingMethods.
|
|
157
|
+
Lint/UselessAccessModifier:
|
|
158
|
+
Exclude:
|
|
159
|
+
- 'lib/trailblazer/rails/cell.rb'
|
|
160
|
+
|
|
161
|
+
# Offense count: 1
|
|
162
|
+
# Configuration parameters: ExpectMatchingDefinition, Regex, IgnoreExecutableScripts, AllowedAcronyms.
|
|
163
|
+
# AllowedAcronyms: CLI, DSL, ACL, API, ASCII, CPU, CSS, DNS, EOF, GUID, HTML, HTTP, HTTPS, ID, IP, JSON, LHS, QPS, RAM, RHS, RPC, SLA, SMTP, SQL, SSH, TCP, TLS, TTL, UDP, UI, UID, UUID, URI, URL, UTF8, VM, XML, XMPP, XSRF, XSS
|
|
164
|
+
Naming/FileName:
|
|
165
|
+
Exclude:
|
|
166
|
+
- 'lib/trailblazer-rails.rb'
|
|
167
|
+
|
|
168
|
+
# Offense count: 3
|
|
169
|
+
# Cop supports --auto-correct.
|
|
170
|
+
# Configuration parameters: EnforcedStyle.
|
|
171
|
+
# SupportedStyles: braces, no_braces, context_dependent
|
|
172
|
+
Style/BracesAroundHashParameters:
|
|
173
|
+
Exclude:
|
|
174
|
+
- 'test/rails5.0/app/controllers/args_controller.rb'
|
|
175
|
+
- 'test/rails5.1/app/controllers/args_controller.rb'
|
|
176
|
+
- 'test/rails5.2/app/controllers/args_controller.rb'
|
|
177
|
+
|
|
178
|
+
# Offense count: 23
|
|
179
|
+
# Configuration parameters: EnforcedStyle.
|
|
180
|
+
# SupportedStyles: nested, compact
|
|
181
|
+
Style/ClassAndModuleChildren:
|
|
182
|
+
Enabled: false
|
|
183
|
+
|
|
184
|
+
# Offense count: 1
|
|
185
|
+
# Cop supports --auto-correct.
|
|
186
|
+
Style/ColonMethodCall:
|
|
187
|
+
Exclude:
|
|
188
|
+
- 'test/test_helper.rb'
|
|
189
|
+
|
|
190
|
+
# Offense count: 10
|
|
191
|
+
Style/Documentation:
|
|
192
|
+
Exclude:
|
|
193
|
+
- 'spec/**/*'
|
|
194
|
+
- 'test/**/*'
|
|
195
|
+
- 'lib/trailblazer/operation/responder.rb'
|
|
196
|
+
- 'lib/trailblazer/rails.rb'
|
|
197
|
+
- 'lib/trailblazer/rails/cell.rb'
|
|
198
|
+
- 'lib/trailblazer/rails/controller.rb'
|
|
199
|
+
- 'lib/trailblazer/rails/form.rb'
|
|
200
|
+
- 'lib/trailblazer/rails/railtie.rb'
|
|
201
|
+
|
|
202
|
+
# Offense count: 134
|
|
203
|
+
# Cop supports --auto-correct.
|
|
204
|
+
# Configuration parameters: EnforcedStyle.
|
|
205
|
+
# SupportedStyles: when_needed, always, never
|
|
206
|
+
Style/FrozenStringLiteralComment:
|
|
207
|
+
Enabled: false
|
|
208
|
+
|
|
209
|
+
# Offense count: 7
|
|
210
|
+
# Cop supports --auto-correct.
|
|
211
|
+
# Configuration parameters: EnforcedStyle, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols.
|
|
212
|
+
# SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys
|
|
213
|
+
Style/HashSyntax:
|
|
214
|
+
Exclude:
|
|
215
|
+
- 'Rakefile'
|
|
216
|
+
- 'test/rails5.0/app/controllers/args_controller.rb'
|
|
217
|
+
- 'test/rails5.0/app/controllers/params_controller.rb'
|
|
218
|
+
- 'test/rails5.1/app/controllers/args_controller.rb'
|
|
219
|
+
- 'test/rails5.1/app/controllers/params_controller.rb'
|
|
220
|
+
- 'test/rails5.2/app/controllers/args_controller.rb'
|
|
221
|
+
- 'test/rails5.2/app/controllers/params_controller.rb'
|
|
222
|
+
|
|
223
|
+
# Offense count: 2
|
|
224
|
+
# Cop supports --auto-correct.
|
|
225
|
+
# Configuration parameters: EnforcedStyle.
|
|
226
|
+
# SupportedStyles: line_count_dependent, lambda, literal
|
|
227
|
+
Style/Lambda:
|
|
228
|
+
Exclude:
|
|
229
|
+
- 'lib/trailblazer/rails/railtie.rb'
|
|
230
|
+
|
|
231
|
+
# Offense count: 6
|
|
232
|
+
# Cop supports --auto-correct.
|
|
233
|
+
# Configuration parameters: .
|
|
234
|
+
# SupportedStyles: call, braces
|
|
235
|
+
Style/LambdaCall:
|
|
236
|
+
EnforcedStyle: braces
|
|
237
|
+
|
|
238
|
+
# Offense count: 1
|
|
239
|
+
# Cop supports --auto-correct.
|
|
240
|
+
Style/MutableConstant:
|
|
241
|
+
Exclude:
|
|
242
|
+
- 'lib/trailblazer/rails/version.rb'
|
|
243
|
+
|
|
244
|
+
# Offense count: 3
|
|
245
|
+
# Cop supports --auto-correct.
|
|
246
|
+
# Configuration parameters: Strict.
|
|
247
|
+
Style/NumericLiterals:
|
|
248
|
+
MinDigits: 15
|
|
249
|
+
|
|
250
|
+
# Offense count: 10
|
|
251
|
+
# Cop supports --auto-correct.
|
|
252
|
+
# Configuration parameters: PreferredDelimiters.
|
|
253
|
+
Style/PercentLiteralDelimiters:
|
|
254
|
+
Exclude:
|
|
255
|
+
- 'test/rails5.0/app/concepts/params/operation/with_args.rb'
|
|
256
|
+
- 'test/rails5.0/test/integration/artists_controller_test.rb'
|
|
257
|
+
- 'test/rails5.1/app/concepts/params/operation/with_args.rb'
|
|
258
|
+
- 'test/rails5.1/test/integration/artists_controller_test.rb'
|
|
259
|
+
- 'test/rails5.2/app/concepts/params/operation/with_args.rb'
|
|
260
|
+
- 'test/rails5.2/test/integration/artists_controller_test.rb'
|
|
261
|
+
- 'trailblazer-rails.gemspec'
|
|
262
|
+
|
|
263
|
+
# Offense count: 2
|
|
264
|
+
# Cop supports --auto-correct.
|
|
265
|
+
Style/RedundantSelf:
|
|
266
|
+
Exclude:
|
|
267
|
+
- 'lib/trailblazer/rails/controller.rb'
|
|
268
|
+
|
|
269
|
+
# Offense count: 279
|
|
270
|
+
# Cop supports --auto-correct.
|
|
271
|
+
# Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
|
|
272
|
+
# SupportedStyles: single_quotes, double_quotes
|
|
273
|
+
Style/StringLiterals:
|
|
274
|
+
Enabled: false
|
|
275
|
+
|
|
276
|
+
# Offense count: 1
|
|
277
|
+
# Cop supports --auto-correct.
|
|
278
|
+
# Configuration parameters: IgnoredMethods.
|
|
279
|
+
# IgnoredMethods: respond_to, define_method
|
|
280
|
+
Style/SymbolProc:
|
|
281
|
+
Exclude:
|
|
282
|
+
- 'lib/trailblazer/rails/railtie.rb'
|
|
283
|
+
|
|
284
|
+
# Offense count: 1
|
|
285
|
+
# Cop supports --auto-correct.
|
|
286
|
+
Style/UnneededPercentQ:
|
|
287
|
+
Exclude:
|
|
288
|
+
- 'trailblazer-rails.gemspec'
|
|
289
|
+
|
|
290
|
+
# Offense count: 66
|
|
291
|
+
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
|
|
292
|
+
# URISchemes: http, https
|
|
293
|
+
Metrics/LineLength:
|
|
294
|
+
Max: 127
|
data/CHANGES.md
CHANGED
data/README.md
CHANGED
|
@@ -28,6 +28,11 @@ gem 'trailblazer-rails'
|
|
|
28
28
|
|
|
29
29
|
Note that the 2.x version only runs with TRB >= 2.1.0.
|
|
30
30
|
|
|
31
|
+
## Setting flags
|
|
32
|
+
|
|
33
|
+
* `config.trailblazer.use_loader = false` to disable Trailblazer loader (default TRUE)
|
|
34
|
+
* `config.trailblazer.enable_tracing = true` to enable tracing when using `run` (default FALSE)
|
|
35
|
+
|
|
31
36
|
## License
|
|
32
37
|
|
|
33
38
|
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
|
@@ -2,7 +2,7 @@ module Trailblazer::Rails::Controller::Cell
|
|
|
2
2
|
private
|
|
3
3
|
|
|
4
4
|
module Render
|
|
5
|
-
def render(cell=nil, options={}, *, &block)
|
|
5
|
+
def render(cell = nil, options = {}, *, &block)
|
|
6
6
|
return super unless cell.kind_of?(::Cell::ViewModel)
|
|
7
7
|
render_cell(cell, options)
|
|
8
8
|
end
|
|
@@ -13,7 +13,7 @@ module Trailblazer::Rails::Controller::Cell
|
|
|
13
13
|
# render the cell.
|
|
14
14
|
content = cell.()
|
|
15
15
|
|
|
16
|
-
render(
|
|
16
|
+
render({ html: content }.merge(options))
|
|
17
17
|
end
|
|
18
18
|
end
|
|
19
19
|
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
module Trailblazer::Rails
|
|
2
2
|
module Controller
|
|
3
3
|
def run(operation, *dependencies)
|
|
4
|
-
result =
|
|
4
|
+
result = if Rails.application.config.trailblazer.enable_tracing
|
|
5
|
+
_run_operation(operation, :trace, *dependencies).tap { |r| _operation_trace(r) }
|
|
6
|
+
else
|
|
7
|
+
_run_operation(operation, :call, *dependencies)
|
|
8
|
+
end
|
|
5
9
|
|
|
6
10
|
@model = result[:model]
|
|
7
|
-
@form = Trailblazer::Rails::Form.new(
|
|
11
|
+
@form = Trailblazer::Rails::Form.new(result["contract.default"], @model.class)
|
|
8
12
|
|
|
9
13
|
yield(result) if result.success? && block_given?
|
|
10
14
|
|
|
@@ -19,7 +23,7 @@ module Trailblazer::Rails
|
|
|
19
23
|
end
|
|
20
24
|
|
|
21
25
|
# This is where we can inject Dry.RB containers and the like via dependencies.
|
|
22
|
-
def _run_runtime_options(ctx={}, *dependencies)
|
|
26
|
+
def _run_runtime_options(ctx = {}, *dependencies)
|
|
23
27
|
[_run_options(ctx), *dependencies]
|
|
24
28
|
end
|
|
25
29
|
|
|
@@ -29,6 +33,17 @@ module Trailblazer::Rails
|
|
|
29
33
|
ctx
|
|
30
34
|
end
|
|
31
35
|
|
|
36
|
+
def _run_operation(operation, call_method, *dependencies)
|
|
37
|
+
operation.send(
|
|
38
|
+
call_method,
|
|
39
|
+
{ params: _run_params(self.params) }.merge(*_run_runtime_options(*dependencies))
|
|
40
|
+
)
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def _operation_trace(result)
|
|
44
|
+
puts result.wtf?
|
|
45
|
+
end
|
|
46
|
+
|
|
32
47
|
module Result
|
|
33
48
|
def result
|
|
34
49
|
@_result
|
|
@@ -7,6 +7,7 @@ module Trailblazer
|
|
|
7
7
|
## Accept also an Array of controllers
|
|
8
8
|
config.trailblazer.application_controller ||= 'ActionController::Base'
|
|
9
9
|
config.trailblazer.use_loader ||= true
|
|
10
|
+
config.trailblazer.enable_tracing ||= false
|
|
10
11
|
|
|
11
12
|
def self.load_concepts(app)
|
|
12
13
|
# Loader.new.(insert: [ModelFile, before: Loader::AddConceptFiles]) { |file| require_dependency("#{app.root}/#{file}") }
|
|
@@ -42,7 +43,7 @@ module Trailblazer
|
|
|
42
43
|
end
|
|
43
44
|
end
|
|
44
45
|
|
|
45
|
-
initializer "trailblazer.application_controller", before: "finisher_hook" do
|
|
46
|
+
initializer "trailblazer.application_controller", before: "finisher_hook" do
|
|
46
47
|
reloader_class.to_prepare do
|
|
47
48
|
ActiveSupport.on_load(:action_controller) do |app|
|
|
48
49
|
Trailblazer::Railtie.extend_application_controller!(app)
|
|
@@ -53,12 +54,12 @@ module Trailblazer
|
|
|
53
54
|
# Prepend model file, before the concept files like operation.rb get loaded.
|
|
54
55
|
ModelFile = ->(input, options) do
|
|
55
56
|
model = "app/models/#{options[:name]}.rb"
|
|
56
|
-
File.exist?(model) ? [model]+input : input
|
|
57
|
+
File.exist?(model) ? [model] + input : input
|
|
57
58
|
end
|
|
58
59
|
|
|
59
60
|
# Load all model files before any TRB files.
|
|
60
61
|
AllModelFiles = ->(input, options) do
|
|
61
|
-
Dir.glob("#{options[:root]}/app/models/**/*.rb") + input
|
|
62
|
+
Dir.glob("#{options[:root]}/app/models/**/*.rb").sort + input
|
|
62
63
|
end
|
|
63
64
|
|
|
64
65
|
private
|
|
@@ -76,7 +77,7 @@ module Trailblazer
|
|
|
76
77
|
|
|
77
78
|
module ExtendApplicationController
|
|
78
79
|
def extend_application_controller!(app)
|
|
79
|
-
controllers = Array(::Rails.application.config.trailblazer.application_controller).map{ |x| x.to_s }
|
|
80
|
+
controllers = Array(::Rails.application.config.trailblazer.application_controller).map { |x| x.to_s }
|
|
80
81
|
if controllers.include? app.to_s
|
|
81
82
|
app.send :include, Trailblazer::Rails::Controller
|
|
82
83
|
app.send :include, Trailblazer::Rails::Controller::Cell if defined?(::Cell)
|
data/trailblazer-rails.gemspec
CHANGED
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.1.
|
|
4
|
+
version: 2.1.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-
|
|
11
|
+
date: 2018-04-05 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: trailblazer
|
|
@@ -106,6 +106,20 @@ dependencies:
|
|
|
106
106
|
- - ">="
|
|
107
107
|
- !ruby/object:Gem::Version
|
|
108
108
|
version: '0'
|
|
109
|
+
- !ruby/object:Gem::Dependency
|
|
110
|
+
name: rubocop
|
|
111
|
+
requirement: !ruby/object:Gem::Requirement
|
|
112
|
+
requirements:
|
|
113
|
+
- - ">="
|
|
114
|
+
- !ruby/object:Gem::Version
|
|
115
|
+
version: '0'
|
|
116
|
+
type: :development
|
|
117
|
+
prerelease: false
|
|
118
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
119
|
+
requirements:
|
|
120
|
+
- - ">="
|
|
121
|
+
- !ruby/object:Gem::Version
|
|
122
|
+
version: '0'
|
|
109
123
|
description:
|
|
110
124
|
email:
|
|
111
125
|
- apotonick@gmail.com
|
|
@@ -114,6 +128,8 @@ extensions: []
|
|
|
114
128
|
extra_rdoc_files: []
|
|
115
129
|
files:
|
|
116
130
|
- ".gitignore"
|
|
131
|
+
- ".rubocop.yml"
|
|
132
|
+
- ".rubocop_todo.yml"
|
|
117
133
|
- ".ruby-version"
|
|
118
134
|
- ".travis.yml"
|
|
119
135
|
- CHANGES.md
|