From b6b0c99ff3e8ace3f42813154dbe4b8ad6a98e6c Mon Sep 17 00:00:00 2001 From: Genadi Samokovarov Date: Wed, 31 May 2017 12:16:20 +0300 Subject: Use mattr_accessor default: option throughout the project --- actioncable/lib/action_cable/server/base.rb | 2 +- actioncable/lib/action_cable/subscription_adapter/evented_redis.rb | 4 ++-- actioncable/lib/action_cable/subscription_adapter/redis.rb | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'actioncable') diff --git a/actioncable/lib/action_cable/server/base.rb b/actioncable/lib/action_cable/server/base.rb index 419eccd73c..3b3a17a532 100644 --- a/actioncable/lib/action_cable/server/base.rb +++ b/actioncable/lib/action_cable/server/base.rb @@ -10,7 +10,7 @@ module ActionCable include ActionCable::Server::Broadcasting include ActionCable::Server::Connections - cattr_accessor(:config, instance_accessor: true) { ActionCable::Server::Configuration.new } + cattr_accessor :config, instance_accessor: true, default: ActionCable::Server::Configuration.new def self.logger; config.logger; end delegate :logger, to: :config diff --git a/actioncable/lib/action_cable/subscription_adapter/evented_redis.rb b/actioncable/lib/action_cable/subscription_adapter/evented_redis.rb index ed8f315791..ae71708240 100644 --- a/actioncable/lib/action_cable/subscription_adapter/evented_redis.rb +++ b/actioncable/lib/action_cable/subscription_adapter/evented_redis.rb @@ -17,11 +17,11 @@ module ActionCable # Overwrite this factory method for EventMachine Redis connections if you want to use a different Redis connection library than EM::Hiredis. # This is needed, for example, when using Makara proxies for distributed Redis. - cattr_accessor(:em_redis_connector) { ->(config) { EM::Hiredis.connect(config[:url]) } } + cattr_accessor :em_redis_connector, default: ->(config) { EM::Hiredis.connect(config[:url]) } # Overwrite this factory method for Redis connections if you want to use a different Redis connection library than Redis. # This is needed, for example, when using Makara proxies for distributed Redis. - cattr_accessor(:redis_connector) { ->(config) { ::Redis.new(url: config[:url]) } } + cattr_accessor :redis_connector, default: ->(config) { ::Redis.new(url: config[:url]) } def initialize(*) ActiveSupport::Deprecation.warn(<<-MSG.squish) diff --git a/actioncable/lib/action_cable/subscription_adapter/redis.rb b/actioncable/lib/action_cable/subscription_adapter/redis.rb index 41a6e55822..a31ed33bdb 100644 --- a/actioncable/lib/action_cable/subscription_adapter/redis.rb +++ b/actioncable/lib/action_cable/subscription_adapter/redis.rb @@ -10,7 +10,7 @@ module ActionCable # Overwrite this factory method for redis connections if you want to use a different Redis library than Redis. # This is needed, for example, when using Makara proxies for distributed Redis. - cattr_accessor(:redis_connector) { ->(config) { ::Redis.new(url: config[:url]) } } + cattr_accessor :redis_connector, default: ->(config) { ::Redis.new(url: config[:url]) } def initialize(*) super -- cgit v1.2.3 From 6673cf7071094e87d473459452a2d0e4c2ccfebe Mon Sep 17 00:00:00 2001 From: bogdanvlviv Date: Sun, 11 Jun 2017 15:59:23 +0300 Subject: Use `require_relative` instead of `require` with full path --- actioncable/README.md | 2 +- actioncable/bin/test | 2 +- actioncable/test/subscription_adapter/async_test.rb | 2 +- actioncable/test/subscription_adapter/evented_redis_test.rb | 4 ++-- actioncable/test/subscription_adapter/inline_test.rb | 2 +- actioncable/test/subscription_adapter/postgresql_test.rb | 2 +- actioncable/test/subscription_adapter/redis_test.rb | 4 ++-- 7 files changed, 9 insertions(+), 9 deletions(-) (limited to 'actioncable') diff --git a/actioncable/README.md b/actioncable/README.md index d14f20d75b..6946dbefb0 100644 --- a/actioncable/README.md +++ b/actioncable/README.md @@ -409,7 +409,7 @@ application. The recommended basic setup is as follows: ```ruby # cable/config.ru -require ::File.expand_path('../config/environment', __dir__) +require_relative '../config/environment' Rails.application.eager_load! run ActionCable.server diff --git a/actioncable/bin/test b/actioncable/bin/test index a7beb14b27..470ce93f10 100755 --- a/actioncable/bin/test +++ b/actioncable/bin/test @@ -1,4 +1,4 @@ #!/usr/bin/env ruby COMPONENT_ROOT = File.expand_path("..", __dir__) -require File.expand_path("../tools/test", COMPONENT_ROOT) +require_relative "../../tools/test" diff --git a/actioncable/test/subscription_adapter/async_test.rb b/actioncable/test/subscription_adapter/async_test.rb index 7bc2e55d40..8a447c7a4f 100644 --- a/actioncable/test/subscription_adapter/async_test.rb +++ b/actioncable/test/subscription_adapter/async_test.rb @@ -1,5 +1,5 @@ require "test_helper" -require_relative "./common" +require_relative "common" class AsyncAdapterTest < ActionCable::TestCase include CommonSubscriptionAdapterTest diff --git a/actioncable/test/subscription_adapter/evented_redis_test.rb b/actioncable/test/subscription_adapter/evented_redis_test.rb index 256458bc24..5453511549 100644 --- a/actioncable/test/subscription_adapter/evented_redis_test.rb +++ b/actioncable/test/subscription_adapter/evented_redis_test.rb @@ -1,6 +1,6 @@ require "test_helper" -require_relative "./common" -require_relative "./channel_prefix" +require_relative "common" +require_relative "channel_prefix" class EventedRedisAdapterTest < ActionCable::TestCase include CommonSubscriptionAdapterTest diff --git a/actioncable/test/subscription_adapter/inline_test.rb b/actioncable/test/subscription_adapter/inline_test.rb index 52bfa00aba..eafa3df2df 100644 --- a/actioncable/test/subscription_adapter/inline_test.rb +++ b/actioncable/test/subscription_adapter/inline_test.rb @@ -1,5 +1,5 @@ require "test_helper" -require_relative "./common" +require_relative "common" class InlineAdapterTest < ActionCable::TestCase include CommonSubscriptionAdapterTest diff --git a/actioncable/test/subscription_adapter/postgresql_test.rb b/actioncable/test/subscription_adapter/postgresql_test.rb index beb6efab28..ada4c2e2bd 100644 --- a/actioncable/test/subscription_adapter/postgresql_test.rb +++ b/actioncable/test/subscription_adapter/postgresql_test.rb @@ -1,5 +1,5 @@ require "test_helper" -require_relative "./common" +require_relative "common" require "active_record" diff --git a/actioncable/test/subscription_adapter/redis_test.rb b/actioncable/test/subscription_adapter/redis_test.rb index 4df5e0cbcd..11120b3f85 100644 --- a/actioncable/test/subscription_adapter/redis_test.rb +++ b/actioncable/test/subscription_adapter/redis_test.rb @@ -1,6 +1,6 @@ require "test_helper" -require_relative "./common" -require_relative "./channel_prefix" +require_relative "common" +require_relative "channel_prefix" class RedisAdapterTest < ActionCable::TestCase include CommonSubscriptionAdapterTest -- cgit v1.2.3 From 2f8dc184fcf6deff75600fd229757ac7ed367abe Mon Sep 17 00:00:00 2001 From: "T.J. Schuck" Date: Fri, 16 Jun 2017 18:36:04 -0400 Subject: nodoc AC::Connection::WebSocket Users should never publicly be interacting with an instance of this. The instance that comes along with an `AC::Connection::Base` instance (the only thing a user should be working with) is [itself intended to be private](https://github.com/tjschuck/rails/blob/master/actioncable/lib/action_cable/connection/base.rb#L137-L140). [ci skip] --- actioncable/lib/action_cable/connection/web_socket.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'actioncable') diff --git a/actioncable/lib/action_cable/connection/web_socket.rb b/actioncable/lib/action_cable/connection/web_socket.rb index 03eb6e2ea8..27ae499f29 100644 --- a/actioncable/lib/action_cable/connection/web_socket.rb +++ b/actioncable/lib/action_cable/connection/web_socket.rb @@ -3,7 +3,7 @@ require "websocket/driver" module ActionCable module Connection # Wrap the real socket to minimize the externally-presented API - class WebSocket + class WebSocket # :nodoc: def initialize(env, event_target, event_loop, protocols: ActionCable::INTERNAL[:protocols]) @websocket = ::WebSocket::Driver.websocket?(env) ? ClientSocket.new(env, event_target, event_loop, protocols) : nil end -- cgit v1.2.3 From f55ecc6a7c7866a13fe9f5b84b295f2935c6ff1f Mon Sep 17 00:00:00 2001 From: Marc Ignacio Date: Thu, 22 Jun 2017 09:10:08 +0800 Subject: Allows for other common redis options to be in cable.yml, by default MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Adds RedisAdapterTest::AlternateConfiguration to account for a relatively common alternative setup, as it’s used as the first example in the [Redis rubygem](https://github.com/redis/redis-rb#getting-started) - Supplies original RedisAdapterTest with more complete redis:// url format by adding a ‘userinfo’ (blank user), so that it resembles the alternate configuration - Supplies original EventedRedisAdapterTest with more complete redis:// url as well - Adds before_script to start redis-server with password as a daemon and with explicit defaults copied from the default redis.conf (Instead of using Travis' default init/upstart scripts for `redis` service) --- actioncable/lib/action_cable/subscription_adapter/redis.rb | 4 +++- actioncable/test/subscription_adapter/evented_redis_test.rb | 2 +- actioncable/test/subscription_adapter/redis_test.rb | 10 +++++++++- 3 files changed, 13 insertions(+), 3 deletions(-) (limited to 'actioncable') diff --git a/actioncable/lib/action_cable/subscription_adapter/redis.rb b/actioncable/lib/action_cable/subscription_adapter/redis.rb index a31ed33bdb..225609c236 100644 --- a/actioncable/lib/action_cable/subscription_adapter/redis.rb +++ b/actioncable/lib/action_cable/subscription_adapter/redis.rb @@ -10,7 +10,9 @@ module ActionCable # Overwrite this factory method for redis connections if you want to use a different Redis library than Redis. # This is needed, for example, when using Makara proxies for distributed Redis. - cattr_accessor :redis_connector, default: ->(config) { ::Redis.new(url: config[:url]) } + cattr_accessor :redis_connector, default: ->(config) do + ::Redis.new(config.slice(:url, :host, :port, :db, :password)) + end def initialize(*) super diff --git a/actioncable/test/subscription_adapter/evented_redis_test.rb b/actioncable/test/subscription_adapter/evented_redis_test.rb index 5453511549..1c99031ab0 100644 --- a/actioncable/test/subscription_adapter/evented_redis_test.rb +++ b/actioncable/test/subscription_adapter/evented_redis_test.rb @@ -54,6 +54,6 @@ class EventedRedisAdapterTest < ActionCable::TestCase end def cable_config - { adapter: "evented_redis", url: "redis://127.0.0.1:6379/12" } + { adapter: "evented_redis", url: "redis://:password@127.0.0.1:6379/12" } end end diff --git a/actioncable/test/subscription_adapter/redis_test.rb b/actioncable/test/subscription_adapter/redis_test.rb index 11120b3f85..60596dd205 100644 --- a/actioncable/test/subscription_adapter/redis_test.rb +++ b/actioncable/test/subscription_adapter/redis_test.rb @@ -7,7 +7,7 @@ class RedisAdapterTest < ActionCable::TestCase include ChannelPrefixTest def cable_config - { adapter: "redis", driver: "ruby", url: "redis://127.0.0.1:6379/12" } + { adapter: "redis", driver: "ruby", url: "redis://:password@127.0.0.1:6379/12" } end end @@ -16,3 +16,11 @@ class RedisAdapterTest::Hiredis < RedisAdapterTest super.merge(driver: "hiredis") end end + +class RedisAdapterTest::AlternateConfiguration < RedisAdapterTest + def cable_config + alt_cable_config = super.dup + alt_cable_config.delete(:url) + alt_cable_config.merge(host: "127.0.0.1", port: 6379, db: 12, password: "password") + end +end -- cgit v1.2.3 From d7252786f4e133304b3d05966497272a2da9e098 Mon Sep 17 00:00:00 2001 From: Marc Rendl Ignacio Date: Tue, 27 Jun 2017 09:34:37 +0800 Subject: Adds CHANGELOG for f55ecc6 [ci skip] --- actioncable/CHANGELOG.md | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'actioncable') diff --git a/actioncable/CHANGELOG.md b/actioncable/CHANGELOG.md index 2bf11da463..b1408496a0 100644 --- a/actioncable/CHANGELOG.md +++ b/actioncable/CHANGELOG.md @@ -1,3 +1,12 @@ +* ActionCable's `redis` adapter allows for other common redis-rb options (`host`, `port`, `db`, `password`) in cable.yml. + + Previously, it accepts only a [redis:// url](https://www.iana.org/assignments/uri-schemes/prov/redis) as an option. + While we can add all of these options to the `url` itself, it is not explicitly documented. This alternative setup + is shown as the first example in the [Redis rubygem](https://github.com/redis/redis-rb#getting-started), which + makes this set of options as sensible as using just the `url`. + + *Marc Rendl Ignacio* + * ActionCable socket errors are now logged to the console Previously any socket errors were ignored and this made it hard to diagnose socket issues (e.g. as discussed in #28362). -- cgit v1.2.3 From 3e6ce1cd698878d3324a5eda32bd600bfcb909f8 Mon Sep 17 00:00:00 2001 From: Grey Baker Date: Tue, 27 Jun 2017 11:06:28 +0100 Subject: Add source code and changelog links to gemspecs --- actioncable/actioncable.gemspec | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'actioncable') diff --git a/actioncable/actioncable.gemspec b/actioncable/actioncable.gemspec index 05ffd655e8..a72c0d2608 100644 --- a/actioncable/actioncable.gemspec +++ b/actioncable/actioncable.gemspec @@ -18,6 +18,11 @@ Gem::Specification.new do |s| s.files = Dir["CHANGELOG.md", "MIT-LICENSE", "README.md", "lib/**/*"] s.require_path = "lib" + s.metadata = { + "source_code_uri" => "https://github.com/rails/rails/tree/v#{version}/actioncable", + "changelog_uri" => "https://github.com/rails/rails/blob/v#{version}/actioncable/CHANGELOG.md" + } + s.add_dependency "actionpack", version s.add_dependency "nio4r", "~> 2.0" -- cgit v1.2.3 From cfade1ec7ee7b5b51f3c1578e3474f9c156f2971 Mon Sep 17 00:00:00 2001 From: Kir Shatrov Date: Thu, 22 Jun 2017 22:59:18 -0400 Subject: Enforce frozen string in Rubocop --- actioncable/Rakefile | 1 + actioncable/actioncable.gemspec | 1 + actioncable/bin/test | 1 + actioncable/lib/action_cable.rb | 1 + actioncable/lib/action_cable/channel.rb | 1 + actioncable/lib/action_cable/channel/base.rb | 1 + actioncable/lib/action_cable/channel/broadcasting.rb | 1 + actioncable/lib/action_cable/channel/callbacks.rb | 1 + actioncable/lib/action_cable/channel/naming.rb | 1 + actioncable/lib/action_cable/channel/periodic_timers.rb | 1 + actioncable/lib/action_cable/channel/streams.rb | 1 + actioncable/lib/action_cable/connection.rb | 1 + actioncable/lib/action_cable/connection/authorization.rb | 1 + actioncable/lib/action_cable/connection/base.rb | 1 + actioncable/lib/action_cable/connection/client_socket.rb | 1 + actioncable/lib/action_cable/connection/identification.rb | 1 + actioncable/lib/action_cable/connection/internal_channel.rb | 1 + actioncable/lib/action_cable/connection/message_buffer.rb | 1 + actioncable/lib/action_cable/connection/stream.rb | 1 + actioncable/lib/action_cable/connection/stream_event_loop.rb | 1 + actioncable/lib/action_cable/connection/subscriptions.rb | 1 + actioncable/lib/action_cable/connection/tagged_logger_proxy.rb | 1 + actioncable/lib/action_cable/connection/web_socket.rb | 1 + actioncable/lib/action_cable/engine.rb | 1 + actioncable/lib/action_cable/gem_version.rb | 1 + actioncable/lib/action_cable/helpers/action_cable_helper.rb | 1 + actioncable/lib/action_cable/remote_connections.rb | 1 + actioncable/lib/action_cable/server.rb | 1 + actioncable/lib/action_cable/server/base.rb | 1 + actioncable/lib/action_cable/server/broadcasting.rb | 1 + actioncable/lib/action_cable/server/configuration.rb | 1 + actioncable/lib/action_cable/server/connections.rb | 1 + actioncable/lib/action_cable/server/worker.rb | 1 + .../action_cable/server/worker/active_record_connection_management.rb | 1 + actioncable/lib/action_cable/subscription_adapter.rb | 1 + actioncable/lib/action_cable/subscription_adapter/async.rb | 1 + actioncable/lib/action_cable/subscription_adapter/base.rb | 1 + actioncable/lib/action_cable/subscription_adapter/channel_prefix.rb | 1 + actioncable/lib/action_cable/subscription_adapter/evented_redis.rb | 1 + actioncable/lib/action_cable/subscription_adapter/inline.rb | 1 + actioncable/lib/action_cable/subscription_adapter/postgresql.rb | 1 + actioncable/lib/action_cable/subscription_adapter/redis.rb | 1 + actioncable/lib/action_cable/subscription_adapter/subscriber_map.rb | 1 + actioncable/lib/action_cable/version.rb | 1 + actioncable/lib/rails/generators/channel/channel_generator.rb | 1 + actioncable/test/channel/base_test.rb | 1 + actioncable/test/channel/broadcasting_test.rb | 1 + actioncable/test/channel/naming_test.rb | 1 + actioncable/test/channel/periodic_timers_test.rb | 1 + actioncable/test/channel/rejection_test.rb | 1 + actioncable/test/channel/stream_test.rb | 1 + actioncable/test/client_test.rb | 1 + actioncable/test/connection/authorization_test.rb | 1 + actioncable/test/connection/base_test.rb | 1 + actioncable/test/connection/client_socket_test.rb | 1 + actioncable/test/connection/cross_site_forgery_test.rb | 1 + actioncable/test/connection/identifier_test.rb | 1 + actioncable/test/connection/multiple_identifiers_test.rb | 1 + actioncable/test/connection/stream_test.rb | 1 + actioncable/test/connection/string_identifier_test.rb | 1 + actioncable/test/connection/subscriptions_test.rb | 1 + actioncable/test/server/base_test.rb | 1 + actioncable/test/server/broadcasting_test.rb | 1 + actioncable/test/stubs/global_id.rb | 1 + actioncable/test/stubs/room.rb | 1 + actioncable/test/stubs/test_adapter.rb | 1 + actioncable/test/stubs/test_connection.rb | 1 + actioncable/test/stubs/test_server.rb | 1 + actioncable/test/stubs/user.rb | 1 + actioncable/test/subscription_adapter/async_test.rb | 1 + actioncable/test/subscription_adapter/base_test.rb | 1 + actioncable/test/subscription_adapter/channel_prefix.rb | 1 + actioncable/test/subscription_adapter/common.rb | 1 + actioncable/test/subscription_adapter/evented_redis_test.rb | 1 + actioncable/test/subscription_adapter/inline_test.rb | 1 + actioncable/test/subscription_adapter/postgresql_test.rb | 1 + actioncable/test/subscription_adapter/redis_test.rb | 1 + actioncable/test/subscription_adapter/subscriber_map_test.rb | 1 + actioncable/test/test_helper.rb | 1 + actioncable/test/worker_test.rb | 1 + 80 files changed, 80 insertions(+) (limited to 'actioncable') diff --git a/actioncable/Rakefile b/actioncable/Rakefile index e21843bb44..95875fa27b 100644 --- a/actioncable/Rakefile +++ b/actioncable/Rakefile @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "rake/testtask" require "pathname" require "open3" diff --git a/actioncable/actioncable.gemspec b/actioncable/actioncable.gemspec index a72c0d2608..a95e8f8bda 100644 --- a/actioncable/actioncable.gemspec +++ b/actioncable/actioncable.gemspec @@ -1,3 +1,4 @@ +# frozen_string_literal: true version = File.read(File.expand_path("../RAILS_VERSION", __dir__)).strip Gem::Specification.new do |s| diff --git a/actioncable/bin/test b/actioncable/bin/test index 470ce93f10..c53377cc97 100755 --- a/actioncable/bin/test +++ b/actioncable/bin/test @@ -1,4 +1,5 @@ #!/usr/bin/env ruby +# frozen_string_literal: true COMPONENT_ROOT = File.expand_path("..", __dir__) require_relative "../../tools/test" diff --git a/actioncable/lib/action_cable.rb b/actioncable/lib/action_cable.rb index c2d3550acb..8c274b130e 100644 --- a/actioncable/lib/action_cable.rb +++ b/actioncable/lib/action_cable.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true #-- # Copyright (c) 2015-2017 Basecamp, LLC # diff --git a/actioncable/lib/action_cable/channel.rb b/actioncable/lib/action_cable/channel.rb index 7ae262ce5f..4ad5e1b003 100644 --- a/actioncable/lib/action_cable/channel.rb +++ b/actioncable/lib/action_cable/channel.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActionCable module Channel extend ActiveSupport::Autoload diff --git a/actioncable/lib/action_cable/channel/base.rb b/actioncable/lib/action_cable/channel/base.rb index 718f630f58..ca812e80d2 100644 --- a/actioncable/lib/action_cable/channel/base.rb +++ b/actioncable/lib/action_cable/channel/base.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "set" module ActionCable diff --git a/actioncable/lib/action_cable/channel/broadcasting.rb b/actioncable/lib/action_cable/channel/broadcasting.rb index 23ed4ec943..3db211446a 100644 --- a/actioncable/lib/action_cable/channel/broadcasting.rb +++ b/actioncable/lib/action_cable/channel/broadcasting.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "active_support/core_ext/object/to_param" module ActionCable diff --git a/actioncable/lib/action_cable/channel/callbacks.rb b/actioncable/lib/action_cable/channel/callbacks.rb index c740132c94..65629e4191 100644 --- a/actioncable/lib/action_cable/channel/callbacks.rb +++ b/actioncable/lib/action_cable/channel/callbacks.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "active_support/callbacks" module ActionCable diff --git a/actioncable/lib/action_cable/channel/naming.rb b/actioncable/lib/action_cable/channel/naming.rb index b565cb3cac..433d9c5219 100644 --- a/actioncable/lib/action_cable/channel/naming.rb +++ b/actioncable/lib/action_cable/channel/naming.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActionCable module Channel module Naming diff --git a/actioncable/lib/action_cable/channel/periodic_timers.rb b/actioncable/lib/action_cable/channel/periodic_timers.rb index 90c68cfe84..4686145f64 100644 --- a/actioncable/lib/action_cable/channel/periodic_timers.rb +++ b/actioncable/lib/action_cable/channel/periodic_timers.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActionCable module Channel module PeriodicTimers diff --git a/actioncable/lib/action_cable/channel/streams.rb b/actioncable/lib/action_cable/channel/streams.rb index dbba333353..c938adab9a 100644 --- a/actioncable/lib/action_cable/channel/streams.rb +++ b/actioncable/lib/action_cable/channel/streams.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActionCable module Channel # Streams allow channels to route broadcastings to the subscriber. A broadcasting is, as discussed elsewhere, a pubsub queue where any data diff --git a/actioncable/lib/action_cable/connection.rb b/actioncable/lib/action_cable/connection.rb index 902efb07e2..c301846da6 100644 --- a/actioncable/lib/action_cable/connection.rb +++ b/actioncable/lib/action_cable/connection.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActionCable module Connection extend ActiveSupport::Autoload diff --git a/actioncable/lib/action_cable/connection/authorization.rb b/actioncable/lib/action_cable/connection/authorization.rb index 989a67d6df..e01fdf6c89 100644 --- a/actioncable/lib/action_cable/connection/authorization.rb +++ b/actioncable/lib/action_cable/connection/authorization.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActionCable module Connection module Authorization diff --git a/actioncable/lib/action_cable/connection/base.rb b/actioncable/lib/action_cable/connection/base.rb index ac5f405dea..e50ed7ef05 100644 --- a/actioncable/lib/action_cable/connection/base.rb +++ b/actioncable/lib/action_cable/connection/base.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "action_dispatch" module ActionCable diff --git a/actioncable/lib/action_cable/connection/client_socket.rb b/actioncable/lib/action_cable/connection/client_socket.rb index c7e30e78c8..2b45befb01 100644 --- a/actioncable/lib/action_cable/connection/client_socket.rb +++ b/actioncable/lib/action_cable/connection/client_socket.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "websocket/driver" module ActionCable diff --git a/actioncable/lib/action_cable/connection/identification.rb b/actioncable/lib/action_cable/connection/identification.rb index ffab359429..b10728a911 100644 --- a/actioncable/lib/action_cable/connection/identification.rb +++ b/actioncable/lib/action_cable/connection/identification.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "set" module ActionCable diff --git a/actioncable/lib/action_cable/connection/internal_channel.rb b/actioncable/lib/action_cable/connection/internal_channel.rb index 8f0ec766c3..1feb1cf0dc 100644 --- a/actioncable/lib/action_cable/connection/internal_channel.rb +++ b/actioncable/lib/action_cable/connection/internal_channel.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActionCable module Connection # Makes it possible for the RemoteConnection to disconnect a specific connection. diff --git a/actioncable/lib/action_cable/connection/message_buffer.rb b/actioncable/lib/action_cable/connection/message_buffer.rb index 4ccd322644..222505de6c 100644 --- a/actioncable/lib/action_cable/connection/message_buffer.rb +++ b/actioncable/lib/action_cable/connection/message_buffer.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActionCable module Connection # Allows us to buffer messages received from the WebSocket before the Connection has been fully initialized, and is ready to receive them. diff --git a/actioncable/lib/action_cable/connection/stream.rb b/actioncable/lib/action_cable/connection/stream.rb index e620b93845..4b755cc7d5 100644 --- a/actioncable/lib/action_cable/connection/stream.rb +++ b/actioncable/lib/action_cable/connection/stream.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "thread" module ActionCable diff --git a/actioncable/lib/action_cable/connection/stream_event_loop.rb b/actioncable/lib/action_cable/connection/stream_event_loop.rb index 2d1af0ff9f..2ea233ed72 100644 --- a/actioncable/lib/action_cable/connection/stream_event_loop.rb +++ b/actioncable/lib/action_cable/connection/stream_event_loop.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "nio" require "thread" diff --git a/actioncable/lib/action_cable/connection/subscriptions.rb b/actioncable/lib/action_cable/connection/subscriptions.rb index 44bce1e195..ae82d2f164 100644 --- a/actioncable/lib/action_cable/connection/subscriptions.rb +++ b/actioncable/lib/action_cable/connection/subscriptions.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "active_support/core_ext/hash/indifferent_access" module ActionCable diff --git a/actioncable/lib/action_cable/connection/tagged_logger_proxy.rb b/actioncable/lib/action_cable/connection/tagged_logger_proxy.rb index aef549aa86..7e22a551a3 100644 --- a/actioncable/lib/action_cable/connection/tagged_logger_proxy.rb +++ b/actioncable/lib/action_cable/connection/tagged_logger_proxy.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActionCable module Connection # Allows the use of per-connection tags against the server logger. This wouldn't work using the traditional diff --git a/actioncable/lib/action_cable/connection/web_socket.rb b/actioncable/lib/action_cable/connection/web_socket.rb index 27ae499f29..3df2c577e3 100644 --- a/actioncable/lib/action_cable/connection/web_socket.rb +++ b/actioncable/lib/action_cable/connection/web_socket.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "websocket/driver" module ActionCable diff --git a/actioncable/lib/action_cable/engine.rb b/actioncable/lib/action_cable/engine.rb index 63a26636a0..0cfd0a84c9 100644 --- a/actioncable/lib/action_cable/engine.rb +++ b/actioncable/lib/action_cable/engine.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "rails" require "action_cable" require "action_cable/helpers/action_cable_helper" diff --git a/actioncable/lib/action_cable/gem_version.rb b/actioncable/lib/action_cable/gem_version.rb index 5d6f9af0bb..f15c22da00 100644 --- a/actioncable/lib/action_cable/gem_version.rb +++ b/actioncable/lib/action_cable/gem_version.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActionCable # Returns the version of the currently loaded Action Cable as a Gem::Version. def self.gem_version diff --git a/actioncable/lib/action_cable/helpers/action_cable_helper.rb b/actioncable/lib/action_cable/helpers/action_cable_helper.rb index f53be0bc31..b1d312ca53 100644 --- a/actioncable/lib/action_cable/helpers/action_cable_helper.rb +++ b/actioncable/lib/action_cable/helpers/action_cable_helper.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActionCable module Helpers module ActionCableHelper diff --git a/actioncable/lib/action_cable/remote_connections.rb b/actioncable/lib/action_cable/remote_connections.rb index e689fbf21b..4a4e36a0f1 100644 --- a/actioncable/lib/action_cable/remote_connections.rb +++ b/actioncable/lib/action_cable/remote_connections.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActionCable # If you need to disconnect a given connection, you can go through the # RemoteConnections. You can find the connections you're looking for by diff --git a/actioncable/lib/action_cable/server.rb b/actioncable/lib/action_cable/server.rb index 22f9353825..13ead5486d 100644 --- a/actioncable/lib/action_cable/server.rb +++ b/actioncable/lib/action_cable/server.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActionCable module Server extend ActiveSupport::Autoload diff --git a/actioncable/lib/action_cable/server/base.rb b/actioncable/lib/action_cable/server/base.rb index 3b3a17a532..dd968e88b2 100644 --- a/actioncable/lib/action_cable/server/base.rb +++ b/actioncable/lib/action_cable/server/base.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "monitor" module ActionCable diff --git a/actioncable/lib/action_cable/server/broadcasting.rb b/actioncable/lib/action_cable/server/broadcasting.rb index 7fcd6c6587..10549b5d32 100644 --- a/actioncable/lib/action_cable/server/broadcasting.rb +++ b/actioncable/lib/action_cable/server/broadcasting.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActionCable module Server # Broadcasting is how other parts of your application can send messages to a channel's subscribers. As explained in Channel, most of the time, these diff --git a/actioncable/lib/action_cable/server/configuration.rb b/actioncable/lib/action_cable/server/configuration.rb index 17e0dee064..ecfc846264 100644 --- a/actioncable/lib/action_cable/server/configuration.rb +++ b/actioncable/lib/action_cable/server/configuration.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActionCable module Server # An instance of this configuration object is available via ActionCable.server.config, which allows you to tweak Action Cable configuration diff --git a/actioncable/lib/action_cable/server/connections.rb b/actioncable/lib/action_cable/server/connections.rb index 5e61b4e335..c506c744b3 100644 --- a/actioncable/lib/action_cable/server/connections.rb +++ b/actioncable/lib/action_cable/server/connections.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActionCable module Server # Collection class for all the connections that have been established on this specific server. Remember, usually you'll run many Action Cable servers, so diff --git a/actioncable/lib/action_cable/server/worker.rb b/actioncable/lib/action_cable/server/worker.rb index 43639c27af..c6fb8ec775 100644 --- a/actioncable/lib/action_cable/server/worker.rb +++ b/actioncable/lib/action_cable/server/worker.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "active_support/callbacks" require "active_support/core_ext/module/attribute_accessors_per_thread" require "concurrent" diff --git a/actioncable/lib/action_cable/server/worker/active_record_connection_management.rb b/actioncable/lib/action_cable/server/worker/active_record_connection_management.rb index c1e4aa8103..02886ee441 100644 --- a/actioncable/lib/action_cable/server/worker/active_record_connection_management.rb +++ b/actioncable/lib/action_cable/server/worker/active_record_connection_management.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActionCable module Server class Worker diff --git a/actioncable/lib/action_cable/subscription_adapter.rb b/actioncable/lib/action_cable/subscription_adapter.rb index 596269ab9b..018e8dbe31 100644 --- a/actioncable/lib/action_cable/subscription_adapter.rb +++ b/actioncable/lib/action_cable/subscription_adapter.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActionCable module SubscriptionAdapter extend ActiveSupport::Autoload diff --git a/actioncable/lib/action_cable/subscription_adapter/async.rb b/actioncable/lib/action_cable/subscription_adapter/async.rb index 46819dbfec..b1d29a693c 100644 --- a/actioncable/lib/action_cable/subscription_adapter/async.rb +++ b/actioncable/lib/action_cable/subscription_adapter/async.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "action_cable/subscription_adapter/inline" module ActionCable diff --git a/actioncable/lib/action_cable/subscription_adapter/base.rb b/actioncable/lib/action_cable/subscription_adapter/base.rb index 796db5ffa3..c33d75986d 100644 --- a/actioncable/lib/action_cable/subscription_adapter/base.rb +++ b/actioncable/lib/action_cable/subscription_adapter/base.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActionCable module SubscriptionAdapter class Base diff --git a/actioncable/lib/action_cable/subscription_adapter/channel_prefix.rb b/actioncable/lib/action_cable/subscription_adapter/channel_prefix.rb index 8b293cc785..4beeaa24a0 100644 --- a/actioncable/lib/action_cable/subscription_adapter/channel_prefix.rb +++ b/actioncable/lib/action_cable/subscription_adapter/channel_prefix.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActionCable module SubscriptionAdapter module ChannelPrefix # :nodoc: diff --git a/actioncable/lib/action_cable/subscription_adapter/evented_redis.rb b/actioncable/lib/action_cable/subscription_adapter/evented_redis.rb index ae71708240..2703c7f297 100644 --- a/actioncable/lib/action_cable/subscription_adapter/evented_redis.rb +++ b/actioncable/lib/action_cable/subscription_adapter/evented_redis.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "thread" gem "em-hiredis", "~> 0.3.0" diff --git a/actioncable/lib/action_cable/subscription_adapter/inline.rb b/actioncable/lib/action_cable/subscription_adapter/inline.rb index 81357faead..7e04253635 100644 --- a/actioncable/lib/action_cable/subscription_adapter/inline.rb +++ b/actioncable/lib/action_cable/subscription_adapter/inline.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActionCable module SubscriptionAdapter class Inline < Base # :nodoc: diff --git a/actioncable/lib/action_cable/subscription_adapter/postgresql.rb b/actioncable/lib/action_cable/subscription_adapter/postgresql.rb index bdab5205ec..58db65f546 100644 --- a/actioncable/lib/action_cable/subscription_adapter/postgresql.rb +++ b/actioncable/lib/action_cable/subscription_adapter/postgresql.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true gem "pg", "~> 0.18" require "pg" require "thread" diff --git a/actioncable/lib/action_cable/subscription_adapter/redis.rb b/actioncable/lib/action_cable/subscription_adapter/redis.rb index 225609c236..1931f443c1 100644 --- a/actioncable/lib/action_cable/subscription_adapter/redis.rb +++ b/actioncable/lib/action_cable/subscription_adapter/redis.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "thread" gem "redis", "~> 3.0" diff --git a/actioncable/lib/action_cable/subscription_adapter/subscriber_map.rb b/actioncable/lib/action_cable/subscription_adapter/subscriber_map.rb index 4cce86dcca..373b9d7fe3 100644 --- a/actioncable/lib/action_cable/subscription_adapter/subscriber_map.rb +++ b/actioncable/lib/action_cable/subscription_adapter/subscriber_map.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActionCable module SubscriptionAdapter class SubscriberMap diff --git a/actioncable/lib/action_cable/version.rb b/actioncable/lib/action_cable/version.rb index d6081409f0..a6fe27aa68 100644 --- a/actioncable/lib/action_cable/version.rb +++ b/actioncable/lib/action_cable/version.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require_relative "gem_version" module ActionCable diff --git a/actioncable/lib/rails/generators/channel/channel_generator.rb b/actioncable/lib/rails/generators/channel/channel_generator.rb index 80f512c94c..0b833611d3 100644 --- a/actioncable/lib/rails/generators/channel/channel_generator.rb +++ b/actioncable/lib/rails/generators/channel/channel_generator.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module Rails module Generators class ChannelGenerator < NamedBase diff --git a/actioncable/test/channel/base_test.rb b/actioncable/test/channel/base_test.rb index 9a3a3581e6..afefbaf076 100644 --- a/actioncable/test/channel/base_test.rb +++ b/actioncable/test/channel/base_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "test_helper" require "stubs/test_connection" require "stubs/room" diff --git a/actioncable/test/channel/broadcasting_test.rb b/actioncable/test/channel/broadcasting_test.rb index 3476c1db31..9062a244e4 100644 --- a/actioncable/test/channel/broadcasting_test.rb +++ b/actioncable/test/channel/broadcasting_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "test_helper" require "stubs/test_connection" require "stubs/room" diff --git a/actioncable/test/channel/naming_test.rb b/actioncable/test/channel/naming_test.rb index 08f0e7be48..b6ac7cfd42 100644 --- a/actioncable/test/channel/naming_test.rb +++ b/actioncable/test/channel/naming_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "test_helper" class ActionCable::Channel::NamingTest < ActiveSupport::TestCase diff --git a/actioncable/test/channel/periodic_timers_test.rb b/actioncable/test/channel/periodic_timers_test.rb index 17a8e45a35..02945a2eed 100644 --- a/actioncable/test/channel/periodic_timers_test.rb +++ b/actioncable/test/channel/periodic_timers_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "test_helper" require "stubs/test_connection" require "stubs/room" diff --git a/actioncable/test/channel/rejection_test.rb b/actioncable/test/channel/rejection_test.rb index 99c4a7603a..989ecef1f1 100644 --- a/actioncable/test/channel/rejection_test.rb +++ b/actioncable/test/channel/rejection_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "test_helper" require "stubs/test_connection" require "stubs/room" diff --git a/actioncable/test/channel/stream_test.rb b/actioncable/test/channel/stream_test.rb index 50fc7be30b..14b5d24fbd 100644 --- a/actioncable/test/channel/stream_test.rb +++ b/actioncable/test/channel/stream_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "test_helper" require "stubs/test_connection" require "stubs/room" diff --git a/actioncable/test/client_test.rb b/actioncable/test/client_test.rb index 30ac1e9c38..d38d280339 100644 --- a/actioncable/test/client_test.rb +++ b/actioncable/test/client_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "test_helper" require "concurrent" diff --git a/actioncable/test/connection/authorization_test.rb b/actioncable/test/connection/authorization_test.rb index dcdbe9c1d1..174821f785 100644 --- a/actioncable/test/connection/authorization_test.rb +++ b/actioncable/test/connection/authorization_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "test_helper" require "stubs/test_server" diff --git a/actioncable/test/connection/base_test.rb b/actioncable/test/connection/base_test.rb index 9bcd0700cf..a460fa2a33 100644 --- a/actioncable/test/connection/base_test.rb +++ b/actioncable/test/connection/base_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "test_helper" require "stubs/test_server" require "active_support/core_ext/object/json" diff --git a/actioncable/test/connection/client_socket_test.rb b/actioncable/test/connection/client_socket_test.rb index bc3ff6a3d7..b0e01fa5cc 100644 --- a/actioncable/test/connection/client_socket_test.rb +++ b/actioncable/test/connection/client_socket_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "test_helper" require "stubs/test_server" diff --git a/actioncable/test/connection/cross_site_forgery_test.rb b/actioncable/test/connection/cross_site_forgery_test.rb index 37bedfd734..f94717fecd 100644 --- a/actioncable/test/connection/cross_site_forgery_test.rb +++ b/actioncable/test/connection/cross_site_forgery_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "test_helper" require "stubs/test_server" diff --git a/actioncable/test/connection/identifier_test.rb b/actioncable/test/connection/identifier_test.rb index f3d3bc0603..de9447ba3b 100644 --- a/actioncable/test/connection/identifier_test.rb +++ b/actioncable/test/connection/identifier_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "test_helper" require "stubs/test_server" require "stubs/user" diff --git a/actioncable/test/connection/multiple_identifiers_test.rb b/actioncable/test/connection/multiple_identifiers_test.rb index ca1a08f4d6..754e76a123 100644 --- a/actioncable/test/connection/multiple_identifiers_test.rb +++ b/actioncable/test/connection/multiple_identifiers_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "test_helper" require "stubs/test_server" require "stubs/user" diff --git a/actioncable/test/connection/stream_test.rb b/actioncable/test/connection/stream_test.rb index 36e1d3c095..b0f7408cac 100644 --- a/actioncable/test/connection/stream_test.rb +++ b/actioncable/test/connection/stream_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "test_helper" require "stubs/test_server" diff --git a/actioncable/test/connection/string_identifier_test.rb b/actioncable/test/connection/string_identifier_test.rb index 6d53e249cb..22dc95b8f6 100644 --- a/actioncable/test/connection/string_identifier_test.rb +++ b/actioncable/test/connection/string_identifier_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "test_helper" require "stubs/test_server" diff --git a/actioncable/test/connection/subscriptions_test.rb b/actioncable/test/connection/subscriptions_test.rb index a1c8a4613c..20333376e9 100644 --- a/actioncable/test/connection/subscriptions_test.rb +++ b/actioncable/test/connection/subscriptions_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "test_helper" class ActionCable::Connection::SubscriptionsTest < ActionCable::TestCase diff --git a/actioncable/test/server/base_test.rb b/actioncable/test/server/base_test.rb index f0a51c5a7d..bb79ed2ab9 100644 --- a/actioncable/test/server/base_test.rb +++ b/actioncable/test/server/base_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "test_helper" require "stubs/test_server" require "active_support/core_ext/hash/indifferent_access" diff --git a/actioncable/test/server/broadcasting_test.rb b/actioncable/test/server/broadcasting_test.rb index ed377b7d5d..b941eb1e4f 100644 --- a/actioncable/test/server/broadcasting_test.rb +++ b/actioncable/test/server/broadcasting_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "test_helper" require "stubs/test_server" diff --git a/actioncable/test/stubs/global_id.rb b/actioncable/test/stubs/global_id.rb index 334f0d03e8..374503487d 100644 --- a/actioncable/test/stubs/global_id.rb +++ b/actioncable/test/stubs/global_id.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class GlobalID attr_reader :uri delegate :to_param, :to_s, to: :uri diff --git a/actioncable/test/stubs/room.rb b/actioncable/test/stubs/room.rb index 1664b07d12..662200aa68 100644 --- a/actioncable/test/stubs/room.rb +++ b/actioncable/test/stubs/room.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Room attr_reader :id, :name diff --git a/actioncable/test/stubs/test_adapter.rb b/actioncable/test/stubs/test_adapter.rb index bbd142b287..0d23576d2c 100644 --- a/actioncable/test/stubs/test_adapter.rb +++ b/actioncable/test/stubs/test_adapter.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class SuccessAdapter < ActionCable::SubscriptionAdapter::Base def broadcast(channel, payload) end diff --git a/actioncable/test/stubs/test_connection.rb b/actioncable/test/stubs/test_connection.rb index cd2e219d88..c543518929 100644 --- a/actioncable/test/stubs/test_connection.rb +++ b/actioncable/test/stubs/test_connection.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "stubs/user" class TestConnection diff --git a/actioncable/test/stubs/test_server.rb b/actioncable/test/stubs/test_server.rb index 5bf2a151dc..fc5b0df6bc 100644 --- a/actioncable/test/stubs/test_server.rb +++ b/actioncable/test/stubs/test_server.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "ostruct" class TestServer diff --git a/actioncable/test/stubs/user.rb b/actioncable/test/stubs/user.rb index a66b4f87d5..e6b917b281 100644 --- a/actioncable/test/stubs/user.rb +++ b/actioncable/test/stubs/user.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class User attr_reader :name diff --git a/actioncable/test/subscription_adapter/async_test.rb b/actioncable/test/subscription_adapter/async_test.rb index 8a447c7a4f..0b5bfb2fa9 100644 --- a/actioncable/test/subscription_adapter/async_test.rb +++ b/actioncable/test/subscription_adapter/async_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "test_helper" require_relative "common" diff --git a/actioncable/test/subscription_adapter/base_test.rb b/actioncable/test/subscription_adapter/base_test.rb index 212ea49d2f..15ce40b1c1 100644 --- a/actioncable/test/subscription_adapter/base_test.rb +++ b/actioncable/test/subscription_adapter/base_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "test_helper" require "stubs/test_server" diff --git a/actioncable/test/subscription_adapter/channel_prefix.rb b/actioncable/test/subscription_adapter/channel_prefix.rb index 9ad659912e..71f993b72a 100644 --- a/actioncable/test/subscription_adapter/channel_prefix.rb +++ b/actioncable/test/subscription_adapter/channel_prefix.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "test_helper" class ActionCable::Server::WithIndependentConfig < ActionCable::Server::Base diff --git a/actioncable/test/subscription_adapter/common.rb b/actioncable/test/subscription_adapter/common.rb index 3aa88c2caa..10639cb112 100644 --- a/actioncable/test/subscription_adapter/common.rb +++ b/actioncable/test/subscription_adapter/common.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "test_helper" require "concurrent" diff --git a/actioncable/test/subscription_adapter/evented_redis_test.rb b/actioncable/test/subscription_adapter/evented_redis_test.rb index 1c99031ab0..33aab4672b 100644 --- a/actioncable/test/subscription_adapter/evented_redis_test.rb +++ b/actioncable/test/subscription_adapter/evented_redis_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "test_helper" require_relative "common" require_relative "channel_prefix" diff --git a/actioncable/test/subscription_adapter/inline_test.rb b/actioncable/test/subscription_adapter/inline_test.rb index eafa3df2df..a3d83c07fc 100644 --- a/actioncable/test/subscription_adapter/inline_test.rb +++ b/actioncable/test/subscription_adapter/inline_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "test_helper" require_relative "common" diff --git a/actioncable/test/subscription_adapter/postgresql_test.rb b/actioncable/test/subscription_adapter/postgresql_test.rb index ada4c2e2bd..4534846e6e 100644 --- a/actioncable/test/subscription_adapter/postgresql_test.rb +++ b/actioncable/test/subscription_adapter/postgresql_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "test_helper" require_relative "common" diff --git a/actioncable/test/subscription_adapter/redis_test.rb b/actioncable/test/subscription_adapter/redis_test.rb index 60596dd205..64dbd74a60 100644 --- a/actioncable/test/subscription_adapter/redis_test.rb +++ b/actioncable/test/subscription_adapter/redis_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "test_helper" require_relative "common" require_relative "channel_prefix" diff --git a/actioncable/test/subscription_adapter/subscriber_map_test.rb b/actioncable/test/subscription_adapter/subscriber_map_test.rb index 76b984c849..ee36dd7a22 100644 --- a/actioncable/test/subscription_adapter/subscriber_map_test.rb +++ b/actioncable/test/subscription_adapter/subscriber_map_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "test_helper" class SubscriberMapTest < ActionCable::TestCase diff --git a/actioncable/test/test_helper.rb b/actioncable/test/test_helper.rb index 5d246c2b76..b9d407fb6d 100644 --- a/actioncable/test/test_helper.rb +++ b/actioncable/test/test_helper.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "action_cable" require "active_support/testing/autorun" diff --git a/actioncable/test/worker_test.rb b/actioncable/test/worker_test.rb index 3385593f74..2512df59e8 100644 --- a/actioncable/test/worker_test.rb +++ b/actioncable/test/worker_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "test_helper" class WorkerTest < ActiveSupport::TestCase -- cgit v1.2.3 From f851e1f705f26d8f92f0fc1b265b20bc389d23cb Mon Sep 17 00:00:00 2001 From: Akira Matsuda Date: Fri, 30 Jun 2017 14:18:35 +0900 Subject: [Action Cable] require => require_relative --- actioncable/lib/action_cable.rb | 2 +- actioncable/lib/action_cable/engine.rb | 2 +- actioncable/lib/action_cable/subscription_adapter/async.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'actioncable') diff --git a/actioncable/lib/action_cable.rb b/actioncable/lib/action_cable.rb index c2d3550acb..9edd82e7b5 100644 --- a/actioncable/lib/action_cable.rb +++ b/actioncable/lib/action_cable.rb @@ -23,7 +23,7 @@ require "active_support" require "active_support/rails" -require "action_cable/version" +require_relative "action_cable/version" module ActionCable extend ActiveSupport::Autoload diff --git a/actioncable/lib/action_cable/engine.rb b/actioncable/lib/action_cable/engine.rb index 63a26636a0..d8c49ec6e1 100644 --- a/actioncable/lib/action_cable/engine.rb +++ b/actioncable/lib/action_cable/engine.rb @@ -1,6 +1,6 @@ require "rails" require "action_cable" -require "action_cable/helpers/action_cable_helper" +require_relative "helpers/action_cable_helper" require "active_support/core_ext/hash/indifferent_access" module ActionCable diff --git a/actioncable/lib/action_cable/subscription_adapter/async.rb b/actioncable/lib/action_cable/subscription_adapter/async.rb index 46819dbfec..9169734471 100644 --- a/actioncable/lib/action_cable/subscription_adapter/async.rb +++ b/actioncable/lib/action_cable/subscription_adapter/async.rb @@ -1,4 +1,4 @@ -require "action_cable/subscription_adapter/inline" +require_relative "inline" module ActionCable module SubscriptionAdapter -- cgit v1.2.3 From 87b3e226d65ac1ed371620bfdcd2f950c87cfece Mon Sep 17 00:00:00 2001 From: Matthew Draper Date: Sun, 2 Jul 2017 02:15:17 +0930 Subject: Revert "Merge pull request #29540 from kirs/rubocop-frozen-string" This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa. --- actioncable/Rakefile | 1 - actioncable/actioncable.gemspec | 1 - actioncable/bin/test | 1 - actioncable/lib/action_cable.rb | 1 - actioncable/lib/action_cable/channel.rb | 1 - actioncable/lib/action_cable/channel/base.rb | 1 - actioncable/lib/action_cable/channel/broadcasting.rb | 1 - actioncable/lib/action_cable/channel/callbacks.rb | 1 - actioncable/lib/action_cable/channel/naming.rb | 1 - actioncable/lib/action_cable/channel/periodic_timers.rb | 1 - actioncable/lib/action_cable/channel/streams.rb | 1 - actioncable/lib/action_cable/connection.rb | 1 - actioncable/lib/action_cable/connection/authorization.rb | 1 - actioncable/lib/action_cable/connection/base.rb | 1 - actioncable/lib/action_cable/connection/client_socket.rb | 1 - actioncable/lib/action_cable/connection/identification.rb | 1 - actioncable/lib/action_cable/connection/internal_channel.rb | 1 - actioncable/lib/action_cable/connection/message_buffer.rb | 1 - actioncable/lib/action_cable/connection/stream.rb | 1 - actioncable/lib/action_cable/connection/stream_event_loop.rb | 1 - actioncable/lib/action_cable/connection/subscriptions.rb | 1 - actioncable/lib/action_cable/connection/tagged_logger_proxy.rb | 1 - actioncable/lib/action_cable/connection/web_socket.rb | 1 - actioncable/lib/action_cable/engine.rb | 1 - actioncable/lib/action_cable/gem_version.rb | 1 - actioncable/lib/action_cable/helpers/action_cable_helper.rb | 1 - actioncable/lib/action_cable/remote_connections.rb | 1 - actioncable/lib/action_cable/server.rb | 1 - actioncable/lib/action_cable/server/base.rb | 1 - actioncable/lib/action_cable/server/broadcasting.rb | 1 - actioncable/lib/action_cable/server/configuration.rb | 1 - actioncable/lib/action_cable/server/connections.rb | 1 - actioncable/lib/action_cable/server/worker.rb | 1 - .../action_cable/server/worker/active_record_connection_management.rb | 1 - actioncable/lib/action_cable/subscription_adapter.rb | 1 - actioncable/lib/action_cable/subscription_adapter/async.rb | 1 - actioncable/lib/action_cable/subscription_adapter/base.rb | 1 - actioncable/lib/action_cable/subscription_adapter/channel_prefix.rb | 1 - actioncable/lib/action_cable/subscription_adapter/evented_redis.rb | 1 - actioncable/lib/action_cable/subscription_adapter/inline.rb | 1 - actioncable/lib/action_cable/subscription_adapter/postgresql.rb | 1 - actioncable/lib/action_cable/subscription_adapter/redis.rb | 1 - actioncable/lib/action_cable/subscription_adapter/subscriber_map.rb | 1 - actioncable/lib/action_cable/version.rb | 1 - actioncable/lib/rails/generators/channel/channel_generator.rb | 1 - actioncable/test/channel/base_test.rb | 1 - actioncable/test/channel/broadcasting_test.rb | 1 - actioncable/test/channel/naming_test.rb | 1 - actioncable/test/channel/periodic_timers_test.rb | 1 - actioncable/test/channel/rejection_test.rb | 1 - actioncable/test/channel/stream_test.rb | 1 - actioncable/test/client_test.rb | 1 - actioncable/test/connection/authorization_test.rb | 1 - actioncable/test/connection/base_test.rb | 1 - actioncable/test/connection/client_socket_test.rb | 1 - actioncable/test/connection/cross_site_forgery_test.rb | 1 - actioncable/test/connection/identifier_test.rb | 1 - actioncable/test/connection/multiple_identifiers_test.rb | 1 - actioncable/test/connection/stream_test.rb | 1 - actioncable/test/connection/string_identifier_test.rb | 1 - actioncable/test/connection/subscriptions_test.rb | 1 - actioncable/test/server/base_test.rb | 1 - actioncable/test/server/broadcasting_test.rb | 1 - actioncable/test/stubs/global_id.rb | 1 - actioncable/test/stubs/room.rb | 1 - actioncable/test/stubs/test_adapter.rb | 1 - actioncable/test/stubs/test_connection.rb | 1 - actioncable/test/stubs/test_server.rb | 1 - actioncable/test/stubs/user.rb | 1 - actioncable/test/subscription_adapter/async_test.rb | 1 - actioncable/test/subscription_adapter/base_test.rb | 1 - actioncable/test/subscription_adapter/channel_prefix.rb | 1 - actioncable/test/subscription_adapter/common.rb | 1 - actioncable/test/subscription_adapter/evented_redis_test.rb | 1 - actioncable/test/subscription_adapter/inline_test.rb | 1 - actioncable/test/subscription_adapter/postgresql_test.rb | 1 - actioncable/test/subscription_adapter/redis_test.rb | 1 - actioncable/test/subscription_adapter/subscriber_map_test.rb | 1 - actioncable/test/test_helper.rb | 1 - actioncable/test/worker_test.rb | 1 - 80 files changed, 80 deletions(-) (limited to 'actioncable') diff --git a/actioncable/Rakefile b/actioncable/Rakefile index 95875fa27b..e21843bb44 100644 --- a/actioncable/Rakefile +++ b/actioncable/Rakefile @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "rake/testtask" require "pathname" require "open3" diff --git a/actioncable/actioncable.gemspec b/actioncable/actioncable.gemspec index a95e8f8bda..a72c0d2608 100644 --- a/actioncable/actioncable.gemspec +++ b/actioncable/actioncable.gemspec @@ -1,4 +1,3 @@ -# frozen_string_literal: true version = File.read(File.expand_path("../RAILS_VERSION", __dir__)).strip Gem::Specification.new do |s| diff --git a/actioncable/bin/test b/actioncable/bin/test index c53377cc97..470ce93f10 100755 --- a/actioncable/bin/test +++ b/actioncable/bin/test @@ -1,5 +1,4 @@ #!/usr/bin/env ruby -# frozen_string_literal: true COMPONENT_ROOT = File.expand_path("..", __dir__) require_relative "../../tools/test" diff --git a/actioncable/lib/action_cable.rb b/actioncable/lib/action_cable.rb index 8c274b130e..c2d3550acb 100644 --- a/actioncable/lib/action_cable.rb +++ b/actioncable/lib/action_cable.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true #-- # Copyright (c) 2015-2017 Basecamp, LLC # diff --git a/actioncable/lib/action_cable/channel.rb b/actioncable/lib/action_cable/channel.rb index 4ad5e1b003..7ae262ce5f 100644 --- a/actioncable/lib/action_cable/channel.rb +++ b/actioncable/lib/action_cable/channel.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActionCable module Channel extend ActiveSupport::Autoload diff --git a/actioncable/lib/action_cable/channel/base.rb b/actioncable/lib/action_cable/channel/base.rb index ca812e80d2..718f630f58 100644 --- a/actioncable/lib/action_cable/channel/base.rb +++ b/actioncable/lib/action_cable/channel/base.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "set" module ActionCable diff --git a/actioncable/lib/action_cable/channel/broadcasting.rb b/actioncable/lib/action_cable/channel/broadcasting.rb index 3db211446a..23ed4ec943 100644 --- a/actioncable/lib/action_cable/channel/broadcasting.rb +++ b/actioncable/lib/action_cable/channel/broadcasting.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "active_support/core_ext/object/to_param" module ActionCable diff --git a/actioncable/lib/action_cable/channel/callbacks.rb b/actioncable/lib/action_cable/channel/callbacks.rb index 65629e4191..c740132c94 100644 --- a/actioncable/lib/action_cable/channel/callbacks.rb +++ b/actioncable/lib/action_cable/channel/callbacks.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "active_support/callbacks" module ActionCable diff --git a/actioncable/lib/action_cable/channel/naming.rb b/actioncable/lib/action_cable/channel/naming.rb index 433d9c5219..b565cb3cac 100644 --- a/actioncable/lib/action_cable/channel/naming.rb +++ b/actioncable/lib/action_cable/channel/naming.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActionCable module Channel module Naming diff --git a/actioncable/lib/action_cable/channel/periodic_timers.rb b/actioncable/lib/action_cable/channel/periodic_timers.rb index 4686145f64..90c68cfe84 100644 --- a/actioncable/lib/action_cable/channel/periodic_timers.rb +++ b/actioncable/lib/action_cable/channel/periodic_timers.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActionCable module Channel module PeriodicTimers diff --git a/actioncable/lib/action_cable/channel/streams.rb b/actioncable/lib/action_cable/channel/streams.rb index c938adab9a..dbba333353 100644 --- a/actioncable/lib/action_cable/channel/streams.rb +++ b/actioncable/lib/action_cable/channel/streams.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActionCable module Channel # Streams allow channels to route broadcastings to the subscriber. A broadcasting is, as discussed elsewhere, a pubsub queue where any data diff --git a/actioncable/lib/action_cable/connection.rb b/actioncable/lib/action_cable/connection.rb index c301846da6..902efb07e2 100644 --- a/actioncable/lib/action_cable/connection.rb +++ b/actioncable/lib/action_cable/connection.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActionCable module Connection extend ActiveSupport::Autoload diff --git a/actioncable/lib/action_cable/connection/authorization.rb b/actioncable/lib/action_cable/connection/authorization.rb index e01fdf6c89..989a67d6df 100644 --- a/actioncable/lib/action_cable/connection/authorization.rb +++ b/actioncable/lib/action_cable/connection/authorization.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActionCable module Connection module Authorization diff --git a/actioncable/lib/action_cable/connection/base.rb b/actioncable/lib/action_cable/connection/base.rb index e50ed7ef05..ac5f405dea 100644 --- a/actioncable/lib/action_cable/connection/base.rb +++ b/actioncable/lib/action_cable/connection/base.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "action_dispatch" module ActionCable diff --git a/actioncable/lib/action_cable/connection/client_socket.rb b/actioncable/lib/action_cable/connection/client_socket.rb index 2b45befb01..c7e30e78c8 100644 --- a/actioncable/lib/action_cable/connection/client_socket.rb +++ b/actioncable/lib/action_cable/connection/client_socket.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "websocket/driver" module ActionCable diff --git a/actioncable/lib/action_cable/connection/identification.rb b/actioncable/lib/action_cable/connection/identification.rb index b10728a911..ffab359429 100644 --- a/actioncable/lib/action_cable/connection/identification.rb +++ b/actioncable/lib/action_cable/connection/identification.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "set" module ActionCable diff --git a/actioncable/lib/action_cable/connection/internal_channel.rb b/actioncable/lib/action_cable/connection/internal_channel.rb index 1feb1cf0dc..8f0ec766c3 100644 --- a/actioncable/lib/action_cable/connection/internal_channel.rb +++ b/actioncable/lib/action_cable/connection/internal_channel.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActionCable module Connection # Makes it possible for the RemoteConnection to disconnect a specific connection. diff --git a/actioncable/lib/action_cable/connection/message_buffer.rb b/actioncable/lib/action_cable/connection/message_buffer.rb index 222505de6c..4ccd322644 100644 --- a/actioncable/lib/action_cable/connection/message_buffer.rb +++ b/actioncable/lib/action_cable/connection/message_buffer.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActionCable module Connection # Allows us to buffer messages received from the WebSocket before the Connection has been fully initialized, and is ready to receive them. diff --git a/actioncable/lib/action_cable/connection/stream.rb b/actioncable/lib/action_cable/connection/stream.rb index 4b755cc7d5..e620b93845 100644 --- a/actioncable/lib/action_cable/connection/stream.rb +++ b/actioncable/lib/action_cable/connection/stream.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "thread" module ActionCable diff --git a/actioncable/lib/action_cable/connection/stream_event_loop.rb b/actioncable/lib/action_cable/connection/stream_event_loop.rb index 2ea233ed72..2d1af0ff9f 100644 --- a/actioncable/lib/action_cable/connection/stream_event_loop.rb +++ b/actioncable/lib/action_cable/connection/stream_event_loop.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "nio" require "thread" diff --git a/actioncable/lib/action_cable/connection/subscriptions.rb b/actioncable/lib/action_cable/connection/subscriptions.rb index ae82d2f164..44bce1e195 100644 --- a/actioncable/lib/action_cable/connection/subscriptions.rb +++ b/actioncable/lib/action_cable/connection/subscriptions.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "active_support/core_ext/hash/indifferent_access" module ActionCable diff --git a/actioncable/lib/action_cable/connection/tagged_logger_proxy.rb b/actioncable/lib/action_cable/connection/tagged_logger_proxy.rb index 7e22a551a3..aef549aa86 100644 --- a/actioncable/lib/action_cable/connection/tagged_logger_proxy.rb +++ b/actioncable/lib/action_cable/connection/tagged_logger_proxy.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActionCable module Connection # Allows the use of per-connection tags against the server logger. This wouldn't work using the traditional diff --git a/actioncable/lib/action_cable/connection/web_socket.rb b/actioncable/lib/action_cable/connection/web_socket.rb index 3df2c577e3..27ae499f29 100644 --- a/actioncable/lib/action_cable/connection/web_socket.rb +++ b/actioncable/lib/action_cable/connection/web_socket.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "websocket/driver" module ActionCable diff --git a/actioncable/lib/action_cable/engine.rb b/actioncable/lib/action_cable/engine.rb index 0cfd0a84c9..63a26636a0 100644 --- a/actioncable/lib/action_cable/engine.rb +++ b/actioncable/lib/action_cable/engine.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "rails" require "action_cable" require "action_cable/helpers/action_cable_helper" diff --git a/actioncable/lib/action_cable/gem_version.rb b/actioncable/lib/action_cable/gem_version.rb index f15c22da00..5d6f9af0bb 100644 --- a/actioncable/lib/action_cable/gem_version.rb +++ b/actioncable/lib/action_cable/gem_version.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActionCable # Returns the version of the currently loaded Action Cable as a Gem::Version. def self.gem_version diff --git a/actioncable/lib/action_cable/helpers/action_cable_helper.rb b/actioncable/lib/action_cable/helpers/action_cable_helper.rb index b1d312ca53..f53be0bc31 100644 --- a/actioncable/lib/action_cable/helpers/action_cable_helper.rb +++ b/actioncable/lib/action_cable/helpers/action_cable_helper.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActionCable module Helpers module ActionCableHelper diff --git a/actioncable/lib/action_cable/remote_connections.rb b/actioncable/lib/action_cable/remote_connections.rb index 4a4e36a0f1..e689fbf21b 100644 --- a/actioncable/lib/action_cable/remote_connections.rb +++ b/actioncable/lib/action_cable/remote_connections.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActionCable # If you need to disconnect a given connection, you can go through the # RemoteConnections. You can find the connections you're looking for by diff --git a/actioncable/lib/action_cable/server.rb b/actioncable/lib/action_cable/server.rb index 13ead5486d..22f9353825 100644 --- a/actioncable/lib/action_cable/server.rb +++ b/actioncable/lib/action_cable/server.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActionCable module Server extend ActiveSupport::Autoload diff --git a/actioncable/lib/action_cable/server/base.rb b/actioncable/lib/action_cable/server/base.rb index dd968e88b2..3b3a17a532 100644 --- a/actioncable/lib/action_cable/server/base.rb +++ b/actioncable/lib/action_cable/server/base.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "monitor" module ActionCable diff --git a/actioncable/lib/action_cable/server/broadcasting.rb b/actioncable/lib/action_cable/server/broadcasting.rb index 10549b5d32..7fcd6c6587 100644 --- a/actioncable/lib/action_cable/server/broadcasting.rb +++ b/actioncable/lib/action_cable/server/broadcasting.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActionCable module Server # Broadcasting is how other parts of your application can send messages to a channel's subscribers. As explained in Channel, most of the time, these diff --git a/actioncable/lib/action_cable/server/configuration.rb b/actioncable/lib/action_cable/server/configuration.rb index ecfc846264..17e0dee064 100644 --- a/actioncable/lib/action_cable/server/configuration.rb +++ b/actioncable/lib/action_cable/server/configuration.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActionCable module Server # An instance of this configuration object is available via ActionCable.server.config, which allows you to tweak Action Cable configuration diff --git a/actioncable/lib/action_cable/server/connections.rb b/actioncable/lib/action_cable/server/connections.rb index c506c744b3..5e61b4e335 100644 --- a/actioncable/lib/action_cable/server/connections.rb +++ b/actioncable/lib/action_cable/server/connections.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActionCable module Server # Collection class for all the connections that have been established on this specific server. Remember, usually you'll run many Action Cable servers, so diff --git a/actioncable/lib/action_cable/server/worker.rb b/actioncable/lib/action_cable/server/worker.rb index c6fb8ec775..43639c27af 100644 --- a/actioncable/lib/action_cable/server/worker.rb +++ b/actioncable/lib/action_cable/server/worker.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "active_support/callbacks" require "active_support/core_ext/module/attribute_accessors_per_thread" require "concurrent" diff --git a/actioncable/lib/action_cable/server/worker/active_record_connection_management.rb b/actioncable/lib/action_cable/server/worker/active_record_connection_management.rb index 02886ee441..c1e4aa8103 100644 --- a/actioncable/lib/action_cable/server/worker/active_record_connection_management.rb +++ b/actioncable/lib/action_cable/server/worker/active_record_connection_management.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActionCable module Server class Worker diff --git a/actioncable/lib/action_cable/subscription_adapter.rb b/actioncable/lib/action_cable/subscription_adapter.rb index 018e8dbe31..596269ab9b 100644 --- a/actioncable/lib/action_cable/subscription_adapter.rb +++ b/actioncable/lib/action_cable/subscription_adapter.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActionCable module SubscriptionAdapter extend ActiveSupport::Autoload diff --git a/actioncable/lib/action_cable/subscription_adapter/async.rb b/actioncable/lib/action_cable/subscription_adapter/async.rb index b1d29a693c..46819dbfec 100644 --- a/actioncable/lib/action_cable/subscription_adapter/async.rb +++ b/actioncable/lib/action_cable/subscription_adapter/async.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "action_cable/subscription_adapter/inline" module ActionCable diff --git a/actioncable/lib/action_cable/subscription_adapter/base.rb b/actioncable/lib/action_cable/subscription_adapter/base.rb index c33d75986d..796db5ffa3 100644 --- a/actioncable/lib/action_cable/subscription_adapter/base.rb +++ b/actioncable/lib/action_cable/subscription_adapter/base.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActionCable module SubscriptionAdapter class Base diff --git a/actioncable/lib/action_cable/subscription_adapter/channel_prefix.rb b/actioncable/lib/action_cable/subscription_adapter/channel_prefix.rb index 4beeaa24a0..8b293cc785 100644 --- a/actioncable/lib/action_cable/subscription_adapter/channel_prefix.rb +++ b/actioncable/lib/action_cable/subscription_adapter/channel_prefix.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActionCable module SubscriptionAdapter module ChannelPrefix # :nodoc: diff --git a/actioncable/lib/action_cable/subscription_adapter/evented_redis.rb b/actioncable/lib/action_cable/subscription_adapter/evented_redis.rb index 2703c7f297..ae71708240 100644 --- a/actioncable/lib/action_cable/subscription_adapter/evented_redis.rb +++ b/actioncable/lib/action_cable/subscription_adapter/evented_redis.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "thread" gem "em-hiredis", "~> 0.3.0" diff --git a/actioncable/lib/action_cable/subscription_adapter/inline.rb b/actioncable/lib/action_cable/subscription_adapter/inline.rb index 7e04253635..81357faead 100644 --- a/actioncable/lib/action_cable/subscription_adapter/inline.rb +++ b/actioncable/lib/action_cable/subscription_adapter/inline.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActionCable module SubscriptionAdapter class Inline < Base # :nodoc: diff --git a/actioncable/lib/action_cable/subscription_adapter/postgresql.rb b/actioncable/lib/action_cable/subscription_adapter/postgresql.rb index 58db65f546..bdab5205ec 100644 --- a/actioncable/lib/action_cable/subscription_adapter/postgresql.rb +++ b/actioncable/lib/action_cable/subscription_adapter/postgresql.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true gem "pg", "~> 0.18" require "pg" require "thread" diff --git a/actioncable/lib/action_cable/subscription_adapter/redis.rb b/actioncable/lib/action_cable/subscription_adapter/redis.rb index 1931f443c1..225609c236 100644 --- a/actioncable/lib/action_cable/subscription_adapter/redis.rb +++ b/actioncable/lib/action_cable/subscription_adapter/redis.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "thread" gem "redis", "~> 3.0" diff --git a/actioncable/lib/action_cable/subscription_adapter/subscriber_map.rb b/actioncable/lib/action_cable/subscription_adapter/subscriber_map.rb index 373b9d7fe3..4cce86dcca 100644 --- a/actioncable/lib/action_cable/subscription_adapter/subscriber_map.rb +++ b/actioncable/lib/action_cable/subscription_adapter/subscriber_map.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActionCable module SubscriptionAdapter class SubscriberMap diff --git a/actioncable/lib/action_cable/version.rb b/actioncable/lib/action_cable/version.rb index a6fe27aa68..d6081409f0 100644 --- a/actioncable/lib/action_cable/version.rb +++ b/actioncable/lib/action_cable/version.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require_relative "gem_version" module ActionCable diff --git a/actioncable/lib/rails/generators/channel/channel_generator.rb b/actioncable/lib/rails/generators/channel/channel_generator.rb index 0b833611d3..80f512c94c 100644 --- a/actioncable/lib/rails/generators/channel/channel_generator.rb +++ b/actioncable/lib/rails/generators/channel/channel_generator.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module Rails module Generators class ChannelGenerator < NamedBase diff --git a/actioncable/test/channel/base_test.rb b/actioncable/test/channel/base_test.rb index afefbaf076..9a3a3581e6 100644 --- a/actioncable/test/channel/base_test.rb +++ b/actioncable/test/channel/base_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "test_helper" require "stubs/test_connection" require "stubs/room" diff --git a/actioncable/test/channel/broadcasting_test.rb b/actioncable/test/channel/broadcasting_test.rb index 9062a244e4..3476c1db31 100644 --- a/actioncable/test/channel/broadcasting_test.rb +++ b/actioncable/test/channel/broadcasting_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "test_helper" require "stubs/test_connection" require "stubs/room" diff --git a/actioncable/test/channel/naming_test.rb b/actioncable/test/channel/naming_test.rb index b6ac7cfd42..08f0e7be48 100644 --- a/actioncable/test/channel/naming_test.rb +++ b/actioncable/test/channel/naming_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "test_helper" class ActionCable::Channel::NamingTest < ActiveSupport::TestCase diff --git a/actioncable/test/channel/periodic_timers_test.rb b/actioncable/test/channel/periodic_timers_test.rb index 02945a2eed..17a8e45a35 100644 --- a/actioncable/test/channel/periodic_timers_test.rb +++ b/actioncable/test/channel/periodic_timers_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "test_helper" require "stubs/test_connection" require "stubs/room" diff --git a/actioncable/test/channel/rejection_test.rb b/actioncable/test/channel/rejection_test.rb index 989ecef1f1..99c4a7603a 100644 --- a/actioncable/test/channel/rejection_test.rb +++ b/actioncable/test/channel/rejection_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "test_helper" require "stubs/test_connection" require "stubs/room" diff --git a/actioncable/test/channel/stream_test.rb b/actioncable/test/channel/stream_test.rb index 14b5d24fbd..50fc7be30b 100644 --- a/actioncable/test/channel/stream_test.rb +++ b/actioncable/test/channel/stream_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "test_helper" require "stubs/test_connection" require "stubs/room" diff --git a/actioncable/test/client_test.rb b/actioncable/test/client_test.rb index d38d280339..30ac1e9c38 100644 --- a/actioncable/test/client_test.rb +++ b/actioncable/test/client_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "test_helper" require "concurrent" diff --git a/actioncable/test/connection/authorization_test.rb b/actioncable/test/connection/authorization_test.rb index 174821f785..dcdbe9c1d1 100644 --- a/actioncable/test/connection/authorization_test.rb +++ b/actioncable/test/connection/authorization_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "test_helper" require "stubs/test_server" diff --git a/actioncable/test/connection/base_test.rb b/actioncable/test/connection/base_test.rb index a460fa2a33..9bcd0700cf 100644 --- a/actioncable/test/connection/base_test.rb +++ b/actioncable/test/connection/base_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "test_helper" require "stubs/test_server" require "active_support/core_ext/object/json" diff --git a/actioncable/test/connection/client_socket_test.rb b/actioncable/test/connection/client_socket_test.rb index b0e01fa5cc..bc3ff6a3d7 100644 --- a/actioncable/test/connection/client_socket_test.rb +++ b/actioncable/test/connection/client_socket_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "test_helper" require "stubs/test_server" diff --git a/actioncable/test/connection/cross_site_forgery_test.rb b/actioncable/test/connection/cross_site_forgery_test.rb index f94717fecd..37bedfd734 100644 --- a/actioncable/test/connection/cross_site_forgery_test.rb +++ b/actioncable/test/connection/cross_site_forgery_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "test_helper" require "stubs/test_server" diff --git a/actioncable/test/connection/identifier_test.rb b/actioncable/test/connection/identifier_test.rb index de9447ba3b..f3d3bc0603 100644 --- a/actioncable/test/connection/identifier_test.rb +++ b/actioncable/test/connection/identifier_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "test_helper" require "stubs/test_server" require "stubs/user" diff --git a/actioncable/test/connection/multiple_identifiers_test.rb b/actioncable/test/connection/multiple_identifiers_test.rb index 754e76a123..ca1a08f4d6 100644 --- a/actioncable/test/connection/multiple_identifiers_test.rb +++ b/actioncable/test/connection/multiple_identifiers_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "test_helper" require "stubs/test_server" require "stubs/user" diff --git a/actioncable/test/connection/stream_test.rb b/actioncable/test/connection/stream_test.rb index b0f7408cac..36e1d3c095 100644 --- a/actioncable/test/connection/stream_test.rb +++ b/actioncable/test/connection/stream_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "test_helper" require "stubs/test_server" diff --git a/actioncable/test/connection/string_identifier_test.rb b/actioncable/test/connection/string_identifier_test.rb index 22dc95b8f6..6d53e249cb 100644 --- a/actioncable/test/connection/string_identifier_test.rb +++ b/actioncable/test/connection/string_identifier_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "test_helper" require "stubs/test_server" diff --git a/actioncable/test/connection/subscriptions_test.rb b/actioncable/test/connection/subscriptions_test.rb index 20333376e9..a1c8a4613c 100644 --- a/actioncable/test/connection/subscriptions_test.rb +++ b/actioncable/test/connection/subscriptions_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "test_helper" class ActionCable::Connection::SubscriptionsTest < ActionCable::TestCase diff --git a/actioncable/test/server/base_test.rb b/actioncable/test/server/base_test.rb index bb79ed2ab9..f0a51c5a7d 100644 --- a/actioncable/test/server/base_test.rb +++ b/actioncable/test/server/base_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "test_helper" require "stubs/test_server" require "active_support/core_ext/hash/indifferent_access" diff --git a/actioncable/test/server/broadcasting_test.rb b/actioncable/test/server/broadcasting_test.rb index b941eb1e4f..ed377b7d5d 100644 --- a/actioncable/test/server/broadcasting_test.rb +++ b/actioncable/test/server/broadcasting_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "test_helper" require "stubs/test_server" diff --git a/actioncable/test/stubs/global_id.rb b/actioncable/test/stubs/global_id.rb index 374503487d..334f0d03e8 100644 --- a/actioncable/test/stubs/global_id.rb +++ b/actioncable/test/stubs/global_id.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class GlobalID attr_reader :uri delegate :to_param, :to_s, to: :uri diff --git a/actioncable/test/stubs/room.rb b/actioncable/test/stubs/room.rb index 662200aa68..1664b07d12 100644 --- a/actioncable/test/stubs/room.rb +++ b/actioncable/test/stubs/room.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class Room attr_reader :id, :name diff --git a/actioncable/test/stubs/test_adapter.rb b/actioncable/test/stubs/test_adapter.rb index 0d23576d2c..bbd142b287 100644 --- a/actioncable/test/stubs/test_adapter.rb +++ b/actioncable/test/stubs/test_adapter.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class SuccessAdapter < ActionCable::SubscriptionAdapter::Base def broadcast(channel, payload) end diff --git a/actioncable/test/stubs/test_connection.rb b/actioncable/test/stubs/test_connection.rb index c543518929..cd2e219d88 100644 --- a/actioncable/test/stubs/test_connection.rb +++ b/actioncable/test/stubs/test_connection.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "stubs/user" class TestConnection diff --git a/actioncable/test/stubs/test_server.rb b/actioncable/test/stubs/test_server.rb index fc5b0df6bc..5bf2a151dc 100644 --- a/actioncable/test/stubs/test_server.rb +++ b/actioncable/test/stubs/test_server.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "ostruct" class TestServer diff --git a/actioncable/test/stubs/user.rb b/actioncable/test/stubs/user.rb index e6b917b281..a66b4f87d5 100644 --- a/actioncable/test/stubs/user.rb +++ b/actioncable/test/stubs/user.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class User attr_reader :name diff --git a/actioncable/test/subscription_adapter/async_test.rb b/actioncable/test/subscription_adapter/async_test.rb index 0b5bfb2fa9..8a447c7a4f 100644 --- a/actioncable/test/subscription_adapter/async_test.rb +++ b/actioncable/test/subscription_adapter/async_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "test_helper" require_relative "common" diff --git a/actioncable/test/subscription_adapter/base_test.rb b/actioncable/test/subscription_adapter/base_test.rb index 15ce40b1c1..212ea49d2f 100644 --- a/actioncable/test/subscription_adapter/base_test.rb +++ b/actioncable/test/subscription_adapter/base_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "test_helper" require "stubs/test_server" diff --git a/actioncable/test/subscription_adapter/channel_prefix.rb b/actioncable/test/subscription_adapter/channel_prefix.rb index 71f993b72a..9ad659912e 100644 --- a/actioncable/test/subscription_adapter/channel_prefix.rb +++ b/actioncable/test/subscription_adapter/channel_prefix.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "test_helper" class ActionCable::Server::WithIndependentConfig < ActionCable::Server::Base diff --git a/actioncable/test/subscription_adapter/common.rb b/actioncable/test/subscription_adapter/common.rb index 10639cb112..3aa88c2caa 100644 --- a/actioncable/test/subscription_adapter/common.rb +++ b/actioncable/test/subscription_adapter/common.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "test_helper" require "concurrent" diff --git a/actioncable/test/subscription_adapter/evented_redis_test.rb b/actioncable/test/subscription_adapter/evented_redis_test.rb index 33aab4672b..1c99031ab0 100644 --- a/actioncable/test/subscription_adapter/evented_redis_test.rb +++ b/actioncable/test/subscription_adapter/evented_redis_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "test_helper" require_relative "common" require_relative "channel_prefix" diff --git a/actioncable/test/subscription_adapter/inline_test.rb b/actioncable/test/subscription_adapter/inline_test.rb index a3d83c07fc..eafa3df2df 100644 --- a/actioncable/test/subscription_adapter/inline_test.rb +++ b/actioncable/test/subscription_adapter/inline_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "test_helper" require_relative "common" diff --git a/actioncable/test/subscription_adapter/postgresql_test.rb b/actioncable/test/subscription_adapter/postgresql_test.rb index 4534846e6e..ada4c2e2bd 100644 --- a/actioncable/test/subscription_adapter/postgresql_test.rb +++ b/actioncable/test/subscription_adapter/postgresql_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "test_helper" require_relative "common" diff --git a/actioncable/test/subscription_adapter/redis_test.rb b/actioncable/test/subscription_adapter/redis_test.rb index 64dbd74a60..60596dd205 100644 --- a/actioncable/test/subscription_adapter/redis_test.rb +++ b/actioncable/test/subscription_adapter/redis_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "test_helper" require_relative "common" require_relative "channel_prefix" diff --git a/actioncable/test/subscription_adapter/subscriber_map_test.rb b/actioncable/test/subscription_adapter/subscriber_map_test.rb index ee36dd7a22..76b984c849 100644 --- a/actioncable/test/subscription_adapter/subscriber_map_test.rb +++ b/actioncable/test/subscription_adapter/subscriber_map_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "test_helper" class SubscriberMapTest < ActionCable::TestCase diff --git a/actioncable/test/test_helper.rb b/actioncable/test/test_helper.rb index b9d407fb6d..5d246c2b76 100644 --- a/actioncable/test/test_helper.rb +++ b/actioncable/test/test_helper.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "action_cable" require "active_support/testing/autorun" diff --git a/actioncable/test/worker_test.rb b/actioncable/test/worker_test.rb index 2512df59e8..3385593f74 100644 --- a/actioncable/test/worker_test.rb +++ b/actioncable/test/worker_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "test_helper" class WorkerTest < ActiveSupport::TestCase -- cgit v1.2.3 From 6aa658e329e54f94519268a02b29dc102b415c07 Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Mon, 3 Jul 2017 00:16:53 +0900 Subject: Remove redundant `assert_respond_to` It is covered by following assertion. --- actioncable/test/subscription_adapter/base_test.rb | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) (limited to 'actioncable') diff --git a/actioncable/test/subscription_adapter/base_test.rb b/actioncable/test/subscription_adapter/base_test.rb index 212ea49d2f..5793415b5f 100644 --- a/actioncable/test/subscription_adapter/base_test.rb +++ b/actioncable/test/subscription_adapter/base_test.rb @@ -39,35 +39,25 @@ class ActionCable::SubscriptionAdapter::BaseTest < ActionCable::TestCase # TEST METHODS THAT ARE REQUIRED OF THE ADAPTER'S BACKEND STORAGE OBJECT test "#broadcast is implemented" do - broadcast = SuccessAdapter.new(@server).broadcast("channel", "payload") - - assert_respond_to(SuccessAdapter.new(@server), :broadcast) - assert_nothing_raised do - broadcast + SuccessAdapter.new(@server).broadcast("channel", "payload") end end test "#subscribe is implemented" do callback = lambda { puts "callback" } success_callback = lambda { puts "success" } - subscribe = SuccessAdapter.new(@server).subscribe("channel", callback, success_callback) - - assert_respond_to(SuccessAdapter.new(@server), :subscribe) assert_nothing_raised do - subscribe + SuccessAdapter.new(@server).subscribe("channel", callback, success_callback) end end test "#unsubscribe is implemented" do callback = lambda { puts "callback" } - unsubscribe = SuccessAdapter.new(@server).unsubscribe("channel", callback) - - assert_respond_to(SuccessAdapter.new(@server), :unsubscribe) assert_nothing_raised do - unsubscribe + SuccessAdapter.new(@server).unsubscribe("channel", callback) end end end -- cgit v1.2.3 From 2bce7777b70efe81f45e4ae8dc61b25f1e18771e Mon Sep 17 00:00:00 2001 From: palkan Date: Thu, 6 Jul 2017 17:34:05 +0300 Subject: [Fix #28751] Hash stream long stream identifiers when using Postgres adapter --- actioncable/CHANGELOG.md | 9 +++++++++ .../lib/action_cable/subscription_adapter/postgresql.rb | 11 ++++++++--- actioncable/test/subscription_adapter/common.rb | 14 ++++++++++++++ 3 files changed, 31 insertions(+), 3 deletions(-) (limited to 'actioncable') diff --git a/actioncable/CHANGELOG.md b/actioncable/CHANGELOG.md index b1408496a0..fbe9863af7 100644 --- a/actioncable/CHANGELOG.md +++ b/actioncable/CHANGELOG.md @@ -1,3 +1,12 @@ +* Hash long stream identifiers when using Postgres adapter. + + PostgreSQL has a limit on identifiers length (63 chars, [docs](https://www.postgresql.org/docs/current/static/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS)). + Provided fix minifies identifiers longer than 63 chars by hashing them with SHA1. + + Fixes #28751. + + *Vladimir Dementyev* + * ActionCable's `redis` adapter allows for other common redis-rb options (`host`, `port`, `db`, `password`) in cable.yml. Previously, it accepts only a [redis:// url](https://www.iana.org/assignments/uri-schemes/prov/redis) as an option. diff --git a/actioncable/lib/action_cable/subscription_adapter/postgresql.rb b/actioncable/lib/action_cable/subscription_adapter/postgresql.rb index bdab5205ec..487564c46c 100644 --- a/actioncable/lib/action_cable/subscription_adapter/postgresql.rb +++ b/actioncable/lib/action_cable/subscription_adapter/postgresql.rb @@ -1,6 +1,7 @@ gem "pg", "~> 0.18" require "pg" require "thread" +require "digest/sha1" module ActionCable module SubscriptionAdapter @@ -12,16 +13,16 @@ module ActionCable def broadcast(channel, payload) with_connection do |pg_conn| - pg_conn.exec("NOTIFY #{pg_conn.escape_identifier(channel)}, '#{pg_conn.escape_string(payload)}'") + pg_conn.exec("NOTIFY #{pg_conn.escape_identifier(channel_identifier(channel))}, '#{pg_conn.escape_string(payload)}'") end end def subscribe(channel, callback, success_callback = nil) - listener.add_subscriber(channel, callback, success_callback) + listener.add_subscriber(channel_identifier(channel), callback, success_callback) end def unsubscribe(channel, callback) - listener.remove_subscriber(channel, callback) + listener.remove_subscriber(channel_identifier(channel), callback) end def shutdown @@ -41,6 +42,10 @@ module ActionCable end private + def channel_identifier(channel) + channel.size > 63 ? Digest::SHA1.hexdigest(channel) : channel + end + def listener @listener || @server.mutex.synchronize { @listener ||= Listener.new(self, @server.event_loop) } end diff --git a/actioncable/test/subscription_adapter/common.rb b/actioncable/test/subscription_adapter/common.rb index 3aa88c2caa..80baf2f771 100644 --- a/actioncable/test/subscription_adapter/common.rb +++ b/actioncable/test/subscription_adapter/common.rb @@ -112,4 +112,18 @@ module CommonSubscriptionAdapterTest assert_equal "two", queue.pop end end + + def test_long_identifiers + channel_1 = "a" * 100 + "1" + channel_2 = "a" * 100 + "2" + subscribe_as_queue(channel_1) do |queue| + subscribe_as_queue(channel_2) do |queue_2| + @tx_adapter.broadcast(channel_1, "apples") + @tx_adapter.broadcast(channel_2, "oranges") + + assert_equal "apples", queue.pop + assert_equal "oranges", queue_2.pop + end + end + end end -- cgit v1.2.3