mirror of https://github.com/rails/rails
Load with Zeitwerk
This commit is contained in:
parent
2a98e28a31
commit
b7ae3cba6d
|
@ -38,6 +38,7 @@ PATH
|
|||
activesupport (= 7.1.0.alpha)
|
||||
nio4r (~> 2.0)
|
||||
websocket-driver (>= 0.6.1)
|
||||
zeitwerk (~> 2.5)
|
||||
actionmailbox (7.1.0.alpha)
|
||||
actionpack (= 7.1.0.alpha)
|
||||
activejob (= 7.1.0.alpha)
|
||||
|
|
|
@ -37,4 +37,5 @@ Gem::Specification.new do |s|
|
|||
|
||||
s.add_dependency "nio4r", "~> 2.0"
|
||||
s.add_dependency "websocket-driver", ">= 0.6.1"
|
||||
s.add_dependency "zeitwerk", "~> 2.5"
|
||||
end
|
||||
|
|
|
@ -27,9 +27,22 @@ require "active_support"
|
|||
require "active_support/rails"
|
||||
require "action_cable/version"
|
||||
|
||||
module ActionCable
|
||||
extend ActiveSupport::Autoload
|
||||
require "zeitwerk"
|
||||
Zeitwerk::Loader.for_gem.tap do |loader|
|
||||
loader.inflector.inflect("postgresql" => "PostgreSQL")
|
||||
|
||||
# You only want to load the adapters that are needed at runtime.
|
||||
loader.do_not_eager_load("#{__dir__}/action_cable/subscription_adapter")
|
||||
|
||||
# This directory contains generators, templates, documentation, etc.
|
||||
# Generators are required on demand, so we can just ignore it all.
|
||||
loader.ignore("#{__dir__}/rails")
|
||||
loader.ignore("#{__dir__}/action_cable/gem_version.rb")
|
||||
|
||||
loader.setup
|
||||
end
|
||||
|
||||
module ActionCable
|
||||
INTERNAL = {
|
||||
message_types: {
|
||||
welcome: "welcome",
|
||||
|
@ -51,12 +64,4 @@ module ActionCable
|
|||
module_function def server
|
||||
@server ||= ActionCable::Server::Base.new
|
||||
end
|
||||
|
||||
autoload :Server
|
||||
autoload :Connection
|
||||
autoload :Channel
|
||||
autoload :RemoteConnections
|
||||
autoload :SubscriptionAdapter
|
||||
autoload :TestHelper
|
||||
autoload :TestCase
|
||||
end
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module ActionCable
|
||||
module Channel
|
||||
extend ActiveSupport::Autoload
|
||||
|
||||
eager_autoload do
|
||||
autoload :Base
|
||||
autoload :Broadcasting
|
||||
autoload :Callbacks
|
||||
autoload :Naming
|
||||
autoload :PeriodicTimers
|
||||
autoload :Streams
|
||||
autoload :TestCase
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,22 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module ActionCable
|
||||
module Connection
|
||||
extend ActiveSupport::Autoload
|
||||
|
||||
eager_autoload do
|
||||
autoload :Authorization
|
||||
autoload :Base
|
||||
autoload :ClientSocket
|
||||
autoload :Identification
|
||||
autoload :InternalChannel
|
||||
autoload :MessageBuffer
|
||||
autoload :Stream
|
||||
autoload :StreamEventLoop
|
||||
autoload :Subscriptions
|
||||
autoload :TaggedLoggerProxy
|
||||
autoload :TestCase
|
||||
autoload :WebSocket
|
||||
end
|
||||
end
|
||||
end
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
require "rails"
|
||||
require "action_cable"
|
||||
require "action_cable/helpers/action_cable_helper"
|
||||
require "active_support/core_ext/hash/indifferent_access"
|
||||
|
||||
module ActionCable
|
||||
|
@ -11,8 +10,6 @@ module ActionCable
|
|||
config.action_cable.mount_path = ActionCable::INTERNAL[:default_mount_path]
|
||||
config.action_cable.precompile_assets = true
|
||||
|
||||
config.eager_load_namespaces << ActionCable
|
||||
|
||||
initializer "action_cable.helpers" do
|
||||
ActiveSupport.on_load(:action_view) do
|
||||
include ActionCable::Helpers::ActionCableHelper
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module ActionCable
|
||||
module Server
|
||||
extend ActiveSupport::Autoload
|
||||
|
||||
eager_autoload do
|
||||
autoload :Base
|
||||
autoload :Broadcasting
|
||||
autoload :Connections
|
||||
autoload :Configuration
|
||||
|
||||
autoload :Worker
|
||||
end
|
||||
end
|
||||
end
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
require "active_support/callbacks"
|
||||
require "active_support/core_ext/module/attribute_accessors_per_thread"
|
||||
require "action_cable/server/worker/active_record_connection_management"
|
||||
require "concurrent"
|
||||
|
||||
module ActionCable
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module ActionCable
|
||||
module SubscriptionAdapter
|
||||
extend ActiveSupport::Autoload
|
||||
|
||||
autoload :Base
|
||||
autoload :Test
|
||||
autoload :SubscriberMap
|
||||
autoload :ChannelPrefix
|
||||
end
|
||||
end
|
|
@ -1,7 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require "action_cable/subscription_adapter/inline"
|
||||
|
||||
module ActionCable
|
||||
module SubscriptionAdapter
|
||||
class Async < Inline # :nodoc:
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require_relative "async"
|
||||
|
||||
module ActionCable
|
||||
module SubscriptionAdapter
|
||||
# == Test adapter for Action Cable
|
||||
|
|
|
@ -288,8 +288,6 @@ module ActionCable::StreamTests
|
|||
end
|
||||
end
|
||||
|
||||
require "action_cable/subscription_adapter/async"
|
||||
|
||||
class UserCallbackChannel < ActionCable::Channel::Base
|
||||
def subscribed
|
||||
stream_from :channel do
|
||||
|
|
|
@ -4,8 +4,6 @@ require "test_helper"
|
|||
require_relative "common"
|
||||
require_relative "channel_prefix"
|
||||
|
||||
require "action_cable/subscription_adapter/redis"
|
||||
|
||||
class RedisAdapterTest < ActionCable::TestCase
|
||||
include CommonSubscriptionAdapterTest
|
||||
include ChannelPrefixTest
|
||||
|
|
Loading…
Reference in New Issue