Module: ChromeDevtoolsRails

Defined in:
lib/chrome_devtools_rails.rb,
lib/chrome_devtools_rails/engine.rb,
lib/chrome_devtools_rails/version.rb,
app/controllers/chrome_devtools_rails/devtools_controller.rb

Defined Under Namespace

Classes: DevtoolsController, Engine

Constant Summary collapse

RAILS_NATIVE_SUPPORT_VERSION =

Rails serves /.well-known/appspecific/com.chrome.devtools.json natively from this version on, via the built-in Rails::DevToolsController, which makes this gem unnecessary. See github.com/rails/rails/pull/56245.

Gem::Version.new("8.2")
VERSION =
ENV.fetch("CHROME_DEVTOOLS_RAILS_VERSION", "0.0.0.dev")

Class Method Summary collapse

Class Method Details

.deprecatorObject



10
11
12
# File 'lib/chrome_devtools_rails.rb', line 10

def self.deprecator
  @_deprecator ||= ActiveSupport::Deprecation.new("1.0", "chrome_devtools_rails")
end

.superseded_by_rails?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/chrome_devtools_rails.rb', line 14

def self.superseded_by_rails?
  Rails.gem_version >= RAILS_NATIVE_SUPPORT_VERSION
end

.warn_if_supersededObject

Emitted at boot once Rails ships its own endpoint, so apps know they can drop the gem. The route is still served, so nothing breaks on upgrade — this only nudges migration to the native controller.



21
22
23
24
25
26
27
28
29
30
# File 'lib/chrome_devtools_rails.rb', line 21

def self.warn_if_superseded
  return unless superseded_by_rails?

  deprecator.warn(
    "chrome_devtools_rails is no longer needed on Rails #{Rails.version}: Rails serves " \
    "/.well-known/appspecific/com.chrome.devtools.json natively via Rails::DevToolsController. " \
    "Uncomment the devtools route in config/routes.rb and remove this gem from your Gemfile. " \
    "See https://github.com/rails/rails/pull/56245."
  )
end