rails-route-checker 0.2.7 → 0.3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f97ee66f59a03025db7fab6e63fa8b0ff74f9b058b5f57fd87d3da88bed310e3
4
- data.tar.gz: 0c5ecf132b1a53cf812fe4af8404658b097e2058859afeb6114531321e42d9f8
3
+ metadata.gz: 5f38c16077809f2e617da5cca49336c8f53694664026f9fad3f420fe183337bc
4
+ data.tar.gz: d1bb1ab078167c72802690f47d6bb3961a2d3a880ff137802ec5cca36dbbeee6
5
5
  SHA512:
6
- metadata.gz: 14840d1099677ef965aaf077c33b043527ea6a95d1591c53683b38782ba275d460ae5701b4f284dd34513cafde6a5cda6a94476477f5f7ebbd7604df641a2420
7
- data.tar.gz: 01361ddc934b7e73351dc3294bc5e584339b6125ecadc6d1807ccbac25acc632ee14f1da9a94df7044e85e7fd2eb7286d9ffda11ebb32ba840eaf9116e6b8d1a
6
+ metadata.gz: c65951475dc610c7955eaaacd1c83d16469e8d1948bf6c24cb34c8735cd95bd26d8ae0fa0c98a33279c4b72b5dfdac7596b6de31038f1d16cd1f921115a90023
7
+ data.tar.gz: 397bdd0e46b7aa59757d95c3f578d7a53a72d4f47976ed5f109e081ee0221065b10490f18da05b73cdf3ab07b627a79d3bd990f17257f1b4d15d4fc00ac04eec
@@ -3,18 +3,27 @@
3
3
  module RailsRouteChecker
4
4
  class LoadedApp
5
5
  def initialize
6
- @app = suppress_output do
7
- app_base_path = Dir.pwd
6
+ app_base_path = Dir.pwd
7
+ suppress_output do
8
8
  require_relative "#{app_base_path}/config/boot"
9
- require_relative "#{Dir.pwd}/config/environment"
9
+ end
10
10
 
11
- a = Rails.application
12
- a.eager_load!
13
- attempt_to_load_default_controllers
14
- a.reload_routes!
15
- Rails::Engine.subclasses.each(&:eager_load!)
11
+ begin
12
+ suppress_output do
13
+ require_relative "#{Dir.pwd}/config/environment"
14
+ end
15
+ rescue Exception => e
16
+ puts "Requiring your config/environment.rb file failed."
17
+ puts "This means that something raised while trying to start Rails."
18
+ puts ""
19
+ puts e.backtrace
20
+ raise(e)
21
+ end
16
22
 
17
- a
23
+ suppress_output do
24
+ @app = Rails.application
25
+ @app.eager_load!
26
+ Rails::Engine.subclasses.each(&:eager_load!)
18
27
  end
19
28
  end
20
29
 
@@ -25,7 +34,7 @@ module RailsRouteChecker
25
34
  reject_route?(r)
26
35
  end.uniq
27
36
 
28
- return @routes unless @app.config.respond_to?(:assets)
37
+ return @routes unless app.config.respond_to?(:assets)
29
38
 
30
39
  use_spec = defined?(ActionDispatch::Journey::Route) || defined?(Journey::Route)
31
40
  @routes.reject do |route|
@@ -40,7 +49,7 @@ module RailsRouteChecker
40
49
 
41
50
  def controller_information
42
51
  @controller_information ||= ActionController::Base.descendants.map do |controller|
43
- next if controller.controller_path.start_with?('rails/')
52
+ next if controller.controller_path.nil? || controller.controller_path.start_with?('rails/')
44
53
 
45
54
  [
46
55
  controller.controller_path,
@@ -86,23 +95,6 @@ module RailsRouteChecker
86
95
  retval
87
96
  end
88
97
 
89
- def attempt_to_load_default_controllers
90
- # rubocop:disable Lint/SuppressedException
91
- begin
92
- ::Rails::InfoController
93
- rescue NameError # ignored
94
- end
95
- begin
96
- ::Rails::WelcomeController
97
- rescue NameError # ignored
98
- end
99
- begin
100
- ::Rails::MailersController
101
- rescue NameError # ignored
102
- end
103
- # rubocop:enable Lint/SuppressedException
104
- end
105
-
106
98
  def reject_route?(route)
107
99
  return true if route.name.nil? && route.requirements.blank?
108
100
  return true if route.app.is_a?(ActionDispatch::Routing::Mapper::Constraints) &&
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RailsRouteChecker
4
- VERSION = '0.2.7'
4
+ VERSION = '0.3.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-route-checker
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.7
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dave Allie
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-10-26 00:00:00.000000000 Z
11
+ date: 2022-04-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -87,7 +87,7 @@ homepage: https://github.com/daveallie/rails-route-checker
87
87
  licenses:
88
88
  - MIT
89
89
  metadata: {}
90
- post_install_message:
90
+ post_install_message:
91
91
  rdoc_options: []
92
92
  require_paths:
93
93
  - lib
@@ -102,8 +102,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
102
102
  - !ruby/object:Gem::Version
103
103
  version: '0'
104
104
  requirements: []
105
- rubygems_version: 3.1.2
106
- signing_key:
105
+ rubygems_version: 3.1.6
106
+ signing_key:
107
107
  specification_version: 4
108
108
  summary: A linting tool for your Rails routes
109
109
  test_files: []