trailblazer-rails 2.1.4 → 2.2.0
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 +5 -5
- data/.github/workflows/ci.yml +32 -0
- data/.gitignore +16 -15
- data/Appraisals +18 -0
- data/CHANGES.md +166 -141
- data/Gemfile +11 -5
- data/LICENSE.txt +21 -21
- data/README.md +43 -39
- data/Rakefile +9 -2
- data/gemfiles/rails_5.2.gemfile +17 -0
- data/gemfiles/rails_5.2.gemfile.lock +183 -0
- data/gemfiles/rails_6.0.gemfile +17 -0
- data/gemfiles/rails_6.0.gemfile.lock +183 -0
- data/gemfiles/rails_6.1.gemfile +17 -0
- data/gemfiles/rails_6.1.gemfile.lock +182 -0
- data/gemfiles/rails_7.0.gemfile +17 -0
- data/gemfiles/rails_7.0.gemfile.lock +182 -0
- data/lib/trailblazer/rails/cell.rb +34 -21
- data/lib/trailblazer/rails/controller.rb +69 -55
- data/lib/trailblazer/rails/railtie/extend_application_controller.rb +28 -28
- data/lib/trailblazer/rails/railtie/loader.rb +58 -56
- data/lib/trailblazer/rails/railtie.rb +17 -30
- data/lib/trailblazer/rails/version.rb +5 -5
- data/lib/trailblazer/rails.rb +0 -2
- data/lib/trailblazer-rails.rb +1 -1
- data/trailblazer-rails.gemspec +25 -27
- metadata +37 -53
- data/.rubocop.yml +0 -9
- data/.rubocop_todo.yml +0 -294
- data/.ruby-version +0 -1
- data/.travis.yml +0 -16
- data/lib/trailblazer/rails/test/integration.rb +0 -6
@@ -0,0 +1,182 @@
|
|
1
|
+
PATH
|
2
|
+
remote: ..
|
3
|
+
specs:
|
4
|
+
trailblazer-rails (2.2.0)
|
5
|
+
railties (>= 5.2.0)
|
6
|
+
trailblazer (>= 2.1.0, < 2.2.0)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
actionpack (7.0.0.rc1)
|
12
|
+
actionview (= 7.0.0.rc1)
|
13
|
+
activesupport (= 7.0.0.rc1)
|
14
|
+
rack (~> 2.0, >= 2.2.0)
|
15
|
+
rack-test (>= 0.6.3)
|
16
|
+
rails-dom-testing (~> 2.0)
|
17
|
+
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
18
|
+
actionview (7.0.0.rc1)
|
19
|
+
activesupport (= 7.0.0.rc1)
|
20
|
+
builder (~> 3.1)
|
21
|
+
erubi (~> 1.4)
|
22
|
+
rails-dom-testing (~> 2.0)
|
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)
|
30
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
31
|
+
i18n (>= 1.6, < 2)
|
32
|
+
minitest (>= 5.1)
|
33
|
+
tzinfo (~> 2.0)
|
34
|
+
addressable (2.8.0)
|
35
|
+
public_suffix (>= 2.0.2, < 5.0)
|
36
|
+
appraisal (2.4.1)
|
37
|
+
bundler
|
38
|
+
rake
|
39
|
+
thor (>= 0.14.0)
|
40
|
+
builder (3.2.4)
|
41
|
+
capybara (3.36.0)
|
42
|
+
addressable
|
43
|
+
matrix
|
44
|
+
mini_mime (>= 0.1.3)
|
45
|
+
nokogiri (~> 1.8)
|
46
|
+
rack (>= 1.6.0)
|
47
|
+
rack-test (>= 0.6.3)
|
48
|
+
regexp_parser (>= 1.5, < 3.0)
|
49
|
+
xpath (~> 3.2)
|
50
|
+
cells (4.1.7)
|
51
|
+
declarative-builder (< 0.2.0)
|
52
|
+
declarative-option (< 0.2.0)
|
53
|
+
tilt (>= 1.4, < 3)
|
54
|
+
uber (< 0.2.0)
|
55
|
+
cells-erb (0.1.0)
|
56
|
+
cells (~> 4.0)
|
57
|
+
erbse (>= 0.1.1)
|
58
|
+
cells-rails (0.1.4)
|
59
|
+
actionpack (>= 5.0)
|
60
|
+
cells (>= 4.1.6, < 5.0.0)
|
61
|
+
concurrent-ruby (1.1.9)
|
62
|
+
crass (1.0.6)
|
63
|
+
declarative (0.0.20)
|
64
|
+
declarative-builder (0.1.0)
|
65
|
+
declarative-option (< 0.2.0)
|
66
|
+
declarative-option (0.1.0)
|
67
|
+
disposable (0.6.2)
|
68
|
+
declarative (>= 0.0.9, < 1.0.0)
|
69
|
+
representable (>= 3.1.1, < 3.2.0)
|
70
|
+
erbse (0.1.4)
|
71
|
+
temple
|
72
|
+
erubi (1.10.0)
|
73
|
+
hashie (5.0.0)
|
74
|
+
hirb (0.7.3)
|
75
|
+
i18n (1.8.11)
|
76
|
+
concurrent-ruby (~> 1.0)
|
77
|
+
loofah (2.12.0)
|
78
|
+
crass (~> 1.0.2)
|
79
|
+
nokogiri (>= 1.5.9)
|
80
|
+
matrix (0.4.2)
|
81
|
+
method_source (1.0.0)
|
82
|
+
mini_mime (1.1.2)
|
83
|
+
minitest (5.14.4)
|
84
|
+
minitest-capybara (0.9.0)
|
85
|
+
capybara
|
86
|
+
minitest (~> 5.0)
|
87
|
+
rake
|
88
|
+
nokogiri (1.12.5-x86_64-linux)
|
89
|
+
racc (~> 1.4)
|
90
|
+
public_suffix (4.0.6)
|
91
|
+
racc (1.6.0)
|
92
|
+
rack (2.2.3)
|
93
|
+
rack-test (1.1.0)
|
94
|
+
rack (>= 1.0, < 3)
|
95
|
+
rails-dom-testing (2.0.3)
|
96
|
+
activesupport (>= 4.2.0)
|
97
|
+
nokogiri (>= 1.6)
|
98
|
+
rails-html-sanitizer (1.4.2)
|
99
|
+
loofah (~> 2.3)
|
100
|
+
railties (7.0.0.rc1)
|
101
|
+
actionpack (= 7.0.0.rc1)
|
102
|
+
activesupport (= 7.0.0.rc1)
|
103
|
+
method_source
|
104
|
+
rake (>= 12.2)
|
105
|
+
thor (~> 1.0)
|
106
|
+
zeitwerk (~> 2.5)
|
107
|
+
rake (13.0.6)
|
108
|
+
reform (2.6.1)
|
109
|
+
disposable (>= 0.5.0, < 1.0.0)
|
110
|
+
representable (>= 3.1.1, < 3.2.0)
|
111
|
+
uber (< 0.2.0)
|
112
|
+
reform-rails (0.2.3)
|
113
|
+
activemodel (>= 5.0)
|
114
|
+
reform (>= 2.3.1, < 3.0.0)
|
115
|
+
regexp_parser (2.2.0)
|
116
|
+
representable (3.1.1)
|
117
|
+
declarative (< 0.1.0)
|
118
|
+
trailblazer-option (>= 0.1.1, < 0.2.0)
|
119
|
+
uber (< 0.2.0)
|
120
|
+
sqlite3 (1.4.2)
|
121
|
+
temple (0.8.2)
|
122
|
+
thor (1.1.0)
|
123
|
+
tilt (2.0.10)
|
124
|
+
trailblazer (2.1.0)
|
125
|
+
trailblazer-macro (>= 2.1.0, < 2.2.0)
|
126
|
+
trailblazer-macro-contract (>= 2.1.0, < 2.2.0)
|
127
|
+
trailblazer-operation
|
128
|
+
trailblazer-activity (0.12.2)
|
129
|
+
trailblazer-context (~> 0.5.0)
|
130
|
+
trailblazer-option (~> 0.1.0)
|
131
|
+
trailblazer-activity-dsl-linear (0.4.3)
|
132
|
+
trailblazer-activity (>= 0.12.2, < 0.13.0)
|
133
|
+
trailblazer-cells (0.0.3)
|
134
|
+
cells (>= 4.1.0.rc1, < 5.0.0)
|
135
|
+
trailblazer-context (0.5.0)
|
136
|
+
hashie (>= 3.0.0)
|
137
|
+
trailblazer-developer (0.0.22)
|
138
|
+
hirb
|
139
|
+
representable (>= 3.1.1, < 4.0.0)
|
140
|
+
trailblazer-activity (>= 0.12.2, < 1.0.0)
|
141
|
+
trailblazer-activity-dsl-linear (>= 0.4.1, < 1.0.0)
|
142
|
+
trailblazer-loader (0.1.2)
|
143
|
+
trailblazer-macro (2.1.7)
|
144
|
+
trailblazer-activity-dsl-linear (>= 0.4.0, < 0.5.0)
|
145
|
+
trailblazer-operation (>= 0.7.0)
|
146
|
+
trailblazer-macro-contract (2.1.1)
|
147
|
+
reform (>= 2.2.0, < 3.0.0)
|
148
|
+
trailblazer-activity-dsl-linear (>= 0.4.0, < 0.5.0)
|
149
|
+
trailblazer-operation (0.7.5)
|
150
|
+
trailblazer-activity (>= 0.12.2, < 1.0.0)
|
151
|
+
trailblazer-activity-dsl-linear (>= 0.4.1, < 1.0.0)
|
152
|
+
trailblazer-developer (>= 0.0.21, < 1.0.0)
|
153
|
+
trailblazer-option (0.1.2)
|
154
|
+
tzinfo (2.0.4)
|
155
|
+
concurrent-ruby (~> 1.0)
|
156
|
+
uber (0.1.0)
|
157
|
+
xpath (3.2.0)
|
158
|
+
nokogiri (~> 1.8)
|
159
|
+
zeitwerk (2.5.1)
|
160
|
+
|
161
|
+
PLATFORMS
|
162
|
+
x86_64-linux
|
163
|
+
|
164
|
+
DEPENDENCIES
|
165
|
+
actionpack (~> 7.0.0.rc1)
|
166
|
+
activerecord (~> 7.0.0.rc1)
|
167
|
+
appraisal
|
168
|
+
bundler
|
169
|
+
cells-erb
|
170
|
+
cells-rails
|
171
|
+
minitest
|
172
|
+
minitest-capybara
|
173
|
+
rake
|
174
|
+
reform-rails
|
175
|
+
sqlite3
|
176
|
+
trailblazer
|
177
|
+
trailblazer-cells
|
178
|
+
trailblazer-loader
|
179
|
+
trailblazer-rails!
|
180
|
+
|
181
|
+
BUNDLED WITH
|
182
|
+
2.2.22
|
@@ -1,21 +1,34 @@
|
|
1
|
-
module Trailblazer::Rails::Controller::Cell
|
2
|
-
private
|
3
|
-
|
4
|
-
module Render
|
5
|
-
def render(cell = nil, options = {}, *, &block)
|
6
|
-
return super unless cell.kind_of?(::Cell::ViewModel)
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
1
|
+
module Trailblazer::Rails::Controller::Cell
|
2
|
+
private
|
3
|
+
|
4
|
+
module Render
|
5
|
+
def render(cell = nil, options = {}, *, &block)
|
6
|
+
return super unless cell.kind_of?(::Cell::ViewModel)
|
7
|
+
|
8
|
+
render_cell(cell, options)
|
9
|
+
end
|
10
|
+
|
11
|
+
def render_cell(cell, options)
|
12
|
+
options = options.reverse_merge(layout: true)
|
13
|
+
|
14
|
+
# render the cell.
|
15
|
+
content = cell.()
|
16
|
+
|
17
|
+
render({html: content}.merge(options))
|
18
|
+
end
|
19
|
+
|
20
|
+
def cell(constant, model, options={})
|
21
|
+
cell_options = options.reverse_merge(options_for_cell(model, options))
|
22
|
+
|
23
|
+
super(constant, model, cell_options)
|
24
|
+
end
|
25
|
+
|
26
|
+
# Override this to customize what options are passed into the cell constructor.
|
27
|
+
# E.g. `{layout: Song::Cell::Layout}`
|
28
|
+
def options_for_cell(_model, _options)
|
29
|
+
{}
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
include Render unless method_defined?(:render_cell) # FIXME: this will be removed soon.
|
34
|
+
end
|
@@ -1,55 +1,69 @@
|
|
1
|
-
module Trailblazer::Rails
|
2
|
-
module Controller
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
yield(result) if result.success? && block_given?
|
14
|
-
|
15
|
-
@_result = result
|
16
|
-
end
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
end
|
1
|
+
module Trailblazer::Rails
|
2
|
+
module Controller
|
3
|
+
# TODO: deprecate {*dependencies}.
|
4
|
+
def run_v21(operation, *dependencies, **variables)
|
5
|
+
result = if Rails.application.config.trailblazer.enable_tracing
|
6
|
+
_run_operation_v21(operation, :trace, *dependencies, **variables).tap { |r| _operation_trace(r) }
|
7
|
+
else
|
8
|
+
_run_operation_v21(operation, :call, *dependencies, **variables)
|
9
|
+
end
|
10
|
+
|
11
|
+
_assign_trb_ivars(result)
|
12
|
+
|
13
|
+
yield(result) if result.success? && block_given?
|
14
|
+
|
15
|
+
@_result = result
|
16
|
+
end
|
17
|
+
|
18
|
+
alias run run_v21 unless method_defined?(:run)
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
# Override to tweak params. Not recommended.
|
23
|
+
# Use a deserializer instead.
|
24
|
+
def _run_params(run_params)
|
25
|
+
run_params
|
26
|
+
end
|
27
|
+
|
28
|
+
# This is where we can inject Dry.RB containers and the like via dependencies.
|
29
|
+
def _run_runtime_options(ctx = {}, *dependencies)
|
30
|
+
[_run_options(ctx), *dependencies]
|
31
|
+
end
|
32
|
+
|
33
|
+
# Override this to inject dependencies such as "current_user"
|
34
|
+
# into the runtime options.
|
35
|
+
def _run_options(ctx)
|
36
|
+
ctx
|
37
|
+
end
|
38
|
+
|
39
|
+
def _run_operation_v21(operation, call_method, *dependencies, **variables)
|
40
|
+
operation.public_send(
|
41
|
+
call_method,
|
42
|
+
{params: _run_params(params.dup)}.
|
43
|
+
merge(*_run_runtime_options(*dependencies)).
|
44
|
+
merge(variables)
|
45
|
+
)
|
46
|
+
end
|
47
|
+
|
48
|
+
def _operation_trace(result)
|
49
|
+
puts result.wtf?
|
50
|
+
end
|
51
|
+
|
52
|
+
def _assign_trb_ivars(result)
|
53
|
+
@model = result[:model]
|
54
|
+
@form = _wrap_with_trb_form(result["contract.default"], @model.class)
|
55
|
+
end
|
56
|
+
|
57
|
+
def _wrap_with_trb_form(form, model)
|
58
|
+
Trailblazer::Rails::Form.new(form, model)
|
59
|
+
end
|
60
|
+
|
61
|
+
module Result
|
62
|
+
def result
|
63
|
+
@_result
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
include Result
|
68
|
+
end
|
69
|
+
end
|
@@ -1,28 +1,28 @@
|
|
1
|
-
require
|
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
|
-
|
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
|
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
|
+
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,56 +1,58 @@
|
|
1
|
-
require
|
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
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
end
|
33
|
-
|
34
|
-
#
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
end
|
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
|
@@ -1,30 +1,17 @@
|
|
1
|
-
require "rails/railtie"
|
2
|
-
require "trailblazer/loader"
|
3
|
-
require "trailblazer/rails/railtie/extend_application_controller"
|
4
|
-
require "trailblazer/rails/railtie/loader"
|
5
|
-
|
6
|
-
module Trailblazer
|
7
|
-
class Railtie < ::Rails::Railtie
|
8
|
-
config.trailblazer = ActiveSupport::OrderedOptions.new
|
9
|
-
## Accept also an Array of controllers
|
10
|
-
config.trailblazer.application_controller ||=
|
11
|
-
config.trailblazer.
|
12
|
-
config.trailblazer.enable_tracing ||= false
|
13
|
-
|
14
|
-
include Loader
|
15
|
-
include ExtendApplicationController
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
def reloader_class
|
20
|
-
# Rails 5.0.0.rc1 says:
|
21
|
-
# DEPRECATION WARNING: to_prepare is deprecated and will be removed from Rails 5.1
|
22
|
-
# (use ActiveSupport::Reloader.to_prepare instead)
|
23
|
-
if Gem.loaded_specs['activesupport'].version >= Gem::Version.new('5')
|
24
|
-
ActiveSupport::Reloader
|
25
|
-
else
|
26
|
-
ActionDispatch::Reloader
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
1
|
+
require "rails/railtie"
|
2
|
+
require "trailblazer/loader"
|
3
|
+
require "trailblazer/rails/railtie/extend_application_controller"
|
4
|
+
require "trailblazer/rails/railtie/loader"
|
5
|
+
|
6
|
+
module Trailblazer
|
7
|
+
class Railtie < ::Rails::Railtie
|
8
|
+
config.trailblazer = ActiveSupport::OrderedOptions.new
|
9
|
+
## Accept also an Array of controllers
|
10
|
+
config.trailblazer.application_controller ||= "ActionController::Base"
|
11
|
+
config.trailblazer.enable_loader ||= true
|
12
|
+
config.trailblazer.enable_tracing ||= false
|
13
|
+
|
14
|
+
include Loader
|
15
|
+
include ExtendApplicationController
|
16
|
+
end
|
17
|
+
end
|
@@ -1,5 +1,5 @@
|
|
1
|
-
module Trailblazer
|
2
|
-
module Rails
|
3
|
-
VERSION = "2.
|
4
|
-
end
|
5
|
-
end
|
1
|
+
module Trailblazer
|
2
|
+
module Rails
|
3
|
+
VERSION = "2.2.0".freeze
|
4
|
+
end
|
5
|
+
end
|
data/lib/trailblazer/rails.rb
CHANGED
data/lib/trailblazer-rails.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
require "trailblazer/rails"
|
1
|
+
require "trailblazer/rails" # rubocop:disable Naming/FileName
|
data/trailblazer-rails.gemspec
CHANGED
@@ -1,27 +1,25 @@
|
|
1
|
-
lib = File.expand_path(
|
2
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
-
require
|
4
|
-
|
5
|
-
Gem::Specification.new do |spec|
|
6
|
-
spec.name = "trailblazer-rails"
|
7
|
-
spec.version = Trailblazer::Rails::VERSION
|
8
|
-
spec.authors = ["Nick Sutterer"]
|
9
|
-
spec.email = ["apotonick@gmail.com"]
|
10
|
-
|
11
|
-
spec.summary =
|
12
|
-
spec.homepage = "
|
13
|
-
spec.license = "MIT"
|
14
|
-
|
15
|
-
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test)/}) }
|
16
|
-
spec.
|
17
|
-
|
18
|
-
|
19
|
-
spec.add_dependency "trailblazer", ">= 2.1.0
|
20
|
-
|
21
|
-
spec.
|
22
|
-
|
23
|
-
spec.add_development_dependency "
|
24
|
-
spec.add_development_dependency "rake"
|
25
|
-
|
26
|
-
spec.add_development_dependency "rubocop"
|
27
|
-
end
|
1
|
+
lib = File.expand_path("lib", __dir__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
require "trailblazer/rails/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "trailblazer-rails"
|
7
|
+
spec.version = Trailblazer::Rails::VERSION
|
8
|
+
spec.authors = ["Nick Sutterer"]
|
9
|
+
spec.email = ["apotonick@gmail.com"]
|
10
|
+
|
11
|
+
spec.summary = "Convenient Rails support for Trailblazer."
|
12
|
+
spec.homepage = "https://trailblazer.to/2.1/docs/trailblazer.html#trailblazer-rails"
|
13
|
+
spec.license = "MIT"
|
14
|
+
|
15
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test)/}) }
|
16
|
+
spec.require_paths = ["lib"]
|
17
|
+
|
18
|
+
spec.add_dependency "railties", ">= 5.2.0"
|
19
|
+
spec.add_dependency "trailblazer", ">= 2.1.0", "< 2.2.0"
|
20
|
+
|
21
|
+
spec.add_development_dependency "trailblazer-loader", ">= 0.1.0"
|
22
|
+
spec.add_development_dependency "bundler"
|
23
|
+
spec.add_development_dependency "minitest"
|
24
|
+
spec.add_development_dependency "rake"
|
25
|
+
end
|