trailblazer-rails 2.2.0 → 2.3.0

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: 23162999add75f4ab1c7aa0c35c9a724ab782f43aa691f42c39a957efd432ec3
4
- data.tar.gz: 83016e2f641215fef72122d2af2310745528ac9f81f82b5f0773318cee2749b7
3
+ metadata.gz: e43931b1874b64a31a8a64c738d6568a213c3fa4d796f4dd28d93b894f3c928a
4
+ data.tar.gz: d51bde81af75fcd5fead6b78a2e27b1caddbd1e0b86bf575a139784fd92bd306
5
5
  SHA512:
6
- metadata.gz: 5f32d5bf8b70bd0bfde72874d0c5825fe724b1557e4b4adff08db90d5bba11c02b3c5a6697ae5e07ee3d9b95db53f4f922d06fc4f8e7056ff65348e3319c1b09
7
- data.tar.gz: 304419bf4c80e9ddd30636c67a2346b6e8a9121b9d1614b6610853bc2f9433a28d7468a5b3ffed78d922e0e97f4be926d5ccabe97663c7771ad7b983c9178360
6
+ metadata.gz: 430cc9f51fe61f924a9d82581ddbcd00343a7b70956e85f82da8cd4a31577e95533f887ab13889a947982957ccebdcca31e1402414886dcb1c5e775ab0fe8421
7
+ data.tar.gz: 65c5490e4030fb7638e3cab85d3d7e1a1f7a320e85f5f84cf884f622ce945b86738e34819b835bf883801afe09bb7773aa33d4a399d0a9e5db62d6cd6addb700
data/CHANGES.md CHANGED
@@ -1,3 +1,6 @@
1
+ # 2.3.0
2
+ * Remove loader support (no longer needed as zeitwerk is now a better alternative)
3
+
1
4
  # 2.2.0
2
5
 
3
6
  * 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
- [![Build
8
- Status](https://travis-ci.org/trailblazer/trailblazer-rails.svg)](https://travis-ci.org/trailblazer/trailblazer-rails)
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
- Rails.application.load_tasks
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
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- trailblazer-rails (2.2.0)
4
+ trailblazer-rails (2.3.0)
5
5
  railties (>= 5.2.0)
6
6
  trailblazer (>= 2.1.0, < 2.2.0)
7
7
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- trailblazer-rails (2.2.0)
4
+ trailblazer-rails (2.3.0)
5
5
  railties (>= 5.2.0)
6
6
  trailblazer (>= 2.1.0, < 2.2.0)
7
7
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- trailblazer-rails (2.2.0)
4
+ trailblazer-rails (2.3.0)
5
5
  railties (>= 5.2.0)
6
6
  trailblazer (>= 2.1.0, < 2.2.0)
7
7
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- trailblazer-rails (2.2.0)
4
+ trailblazer-rails (2.3.0)
5
5
  railties (>= 5.2.0)
6
6
  trailblazer (>= 2.1.0, < 2.2.0)
7
7
 
@@ -1,6 +1,4 @@
1
1
  module Trailblazer::Rails::Controller::Cell
2
- private
3
-
4
2
  module Render
5
3
  def render(cell = nil, options = {}, *, &block)
6
4
  return super unless cell.kind_of?(::Cell::ViewModel)
@@ -1,17 +1,27 @@
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
7
  config.trailblazer.application_controller ||= "ActionController::Base"
11
- config.trailblazer.enable_loader ||= true
12
8
  config.trailblazer.enable_tracing ||= false
13
9
 
14
- include Loader
15
- include ExtendApplicationController
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
15
+ end
16
+ end
17
+
18
+ def extend_application_controller!(app)
19
+ controllers = Array(::Rails.application.config.trailblazer.application_controller).map(&:to_s)
20
+ if controllers.include? app.to_s
21
+ app.send :include, Trailblazer::Rails::Controller
22
+ app.send :include, Trailblazer::Rails::Controller::Cell if defined?(::Cell)
23
+ end
24
+ app
25
+ end
16
26
  end
17
27
  end
@@ -1,5 +1,5 @@
1
1
  module Trailblazer
2
2
  module Rails
3
- VERSION = "2.2.0".freeze
3
+ VERSION = "2.3.0".freeze
4
4
  end
5
5
  end
@@ -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.2.0
4
+ version: 2.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick Sutterer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-12-10 00:00:00.000000000 Z
11
+ date: 2021-12-13 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
@@ -124,14 +110,11 @@ files:
124
110
  - gemfiles/rails_7.0.gemfile
125
111
  - gemfiles/rails_7.0.gemfile.lock
126
112
  - lib/trailblazer-rails.rb
127
- - lib/trailblazer/operation/responder.rb
128
113
  - lib/trailblazer/rails.rb
129
114
  - lib/trailblazer/rails/cell.rb
130
115
  - lib/trailblazer/rails/controller.rb
131
116
  - lib/trailblazer/rails/form.rb
132
117
  - lib/trailblazer/rails/railtie.rb
133
- - lib/trailblazer/rails/railtie/extend_application_controller.rb
134
- - lib/trailblazer/rails/railtie/loader.rb
135
118
  - lib/trailblazer/rails/version.rb
136
119
  - trailblazer-rails.gemspec
137
120
  homepage: https://trailblazer.to/2.1/docs/trailblazer.html#trailblazer-rails
@@ -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