anycable-rails 1.0.0.preview1 → 1.0.0.rc4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +29 -121
- data/MIT-LICENSE +1 -1
- data/README.md +19 -34
- data/lib/anycable/rails.rb +36 -2
- data/lib/anycable/rails/actioncable/channel.rb +4 -0
- data/lib/anycable/rails/actioncable/connection.rb +26 -35
- data/lib/anycable/rails/actioncable/connection/persistent_session.rb +5 -1
- data/lib/anycable/rails/actioncable/connection/serializable_identification.rb +42 -0
- data/lib/anycable/rails/actioncable/remote_connections.rb +11 -0
- data/lib/anycable/rails/actioncable/testing.rb +35 -0
- data/lib/anycable/rails/channel_state.rb +46 -0
- data/lib/anycable/rails/compatibility.rb +4 -7
- data/lib/anycable/rails/compatibility/rubocop.rb +0 -1
- data/lib/anycable/rails/compatibility/rubocop/config/default.yml +3 -0
- data/lib/anycable/rails/compatibility/rubocop/cops/anycable/instance_vars.rb +1 -1
- data/lib/anycable/rails/compatibility/rubocop/cops/anycable/stream_from.rb +4 -4
- data/lib/anycable/rails/railtie.rb +26 -18
- data/lib/anycable/rails/refinements/subscriptions.rb +5 -0
- data/lib/anycable/rails/session_proxy.rb +19 -2
- data/lib/anycable/rails/version.rb +1 -1
- data/lib/generators/anycable/download/USAGE +14 -0
- data/lib/generators/anycable/download/download_generator.rb +83 -0
- data/lib/generators/anycable/setup/USAGE +2 -0
- data/lib/{rails/generators → generators}/anycable/setup/setup_generator.rb +89 -90
- data/lib/{rails/generators → generators}/anycable/setup/templates/Procfile.dev +0 -0
- data/lib/{rails/generators → generators}/anycable/setup/templates/config/anycable.yml.tt +14 -3
- data/lib/generators/anycable/setup/templates/config/cable.yml.tt +11 -0
- data/lib/{rails/generators/anycable/setup/templates/config/initializers/anycable.rb → generators/anycable/setup/templates/config/initializers/anycable.rb.tt} +1 -1
- data/lib/generators/anycable/with_os_helpers.rb +55 -0
- metadata +27 -50
- data/lib/anycable/rails/compatibility/rubocop/cops/anycable/remote_disconnect.rb +0 -31
- data/lib/rails/generators/anycable/setup/templates/Procfile +0 -2
- data/lib/rails/generators/anycable/setup/templates/bin/heroku-web +0 -7
- data/lib/rails/generators/anycable/setup/templates/config/cable.yml.tt +0 -11
@@ -1,31 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "rubocop"
|
4
|
-
|
5
|
-
module RuboCop
|
6
|
-
module Cop
|
7
|
-
module AnyCable
|
8
|
-
# Checks for remote disconnect usage.
|
9
|
-
#
|
10
|
-
# @example
|
11
|
-
# # bad
|
12
|
-
# class MyServive
|
13
|
-
# def call(user)
|
14
|
-
# ActionCable.server.remote_connections.where(current_user: user).disconnect
|
15
|
-
# end
|
16
|
-
# end
|
17
|
-
#
|
18
|
-
class RemoteDisconnect < RuboCop::Cop::Cop
|
19
|
-
MSG = "Disconnecting remote clients is not supported in AnyCable"
|
20
|
-
|
21
|
-
def_node_matcher :has_remote_disconnect?, <<-PATTERN
|
22
|
-
(send (send (send _ :remote_connections) ...) :disconnect)
|
23
|
-
PATTERN
|
24
|
-
|
25
|
-
def on_send(node)
|
26
|
-
add_offense(node) if has_remote_disconnect?(node)
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
@@ -1,11 +0,0 @@
|
|
1
|
-
# Make it possible to switch adapters by passing the CABLE_ADAPTER env variable.
|
2
|
-
# For example, you can use it fallback to the standard Action Cable in staging/review
|
3
|
-
# environments (by setting `CABLE_ADAPTER=redis`).
|
4
|
-
development:
|
5
|
-
adapter: <%%= ENV.fetch("CABLE_ADAPTER", "any_cable") %>
|
6
|
-
|
7
|
-
test:
|
8
|
-
adapter: test
|
9
|
-
|
10
|
-
production:
|
11
|
-
adapter: <%%= ENV.fetch("CABLE_ADAPTER", "any_cable") %>
|