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.
Files changed (35) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +29 -121
  3. data/MIT-LICENSE +1 -1
  4. data/README.md +19 -34
  5. data/lib/anycable/rails.rb +36 -2
  6. data/lib/anycable/rails/actioncable/channel.rb +4 -0
  7. data/lib/anycable/rails/actioncable/connection.rb +26 -35
  8. data/lib/anycable/rails/actioncable/connection/persistent_session.rb +5 -1
  9. data/lib/anycable/rails/actioncable/connection/serializable_identification.rb +42 -0
  10. data/lib/anycable/rails/actioncable/remote_connections.rb +11 -0
  11. data/lib/anycable/rails/actioncable/testing.rb +35 -0
  12. data/lib/anycable/rails/channel_state.rb +46 -0
  13. data/lib/anycable/rails/compatibility.rb +4 -7
  14. data/lib/anycable/rails/compatibility/rubocop.rb +0 -1
  15. data/lib/anycable/rails/compatibility/rubocop/config/default.yml +3 -0
  16. data/lib/anycable/rails/compatibility/rubocop/cops/anycable/instance_vars.rb +1 -1
  17. data/lib/anycable/rails/compatibility/rubocop/cops/anycable/stream_from.rb +4 -4
  18. data/lib/anycable/rails/railtie.rb +26 -18
  19. data/lib/anycable/rails/refinements/subscriptions.rb +5 -0
  20. data/lib/anycable/rails/session_proxy.rb +19 -2
  21. data/lib/anycable/rails/version.rb +1 -1
  22. data/lib/generators/anycable/download/USAGE +14 -0
  23. data/lib/generators/anycable/download/download_generator.rb +83 -0
  24. data/lib/generators/anycable/setup/USAGE +2 -0
  25. data/lib/{rails/generators → generators}/anycable/setup/setup_generator.rb +89 -90
  26. data/lib/{rails/generators → generators}/anycable/setup/templates/Procfile.dev +0 -0
  27. data/lib/{rails/generators → generators}/anycable/setup/templates/config/anycable.yml.tt +14 -3
  28. data/lib/generators/anycable/setup/templates/config/cable.yml.tt +11 -0
  29. data/lib/{rails/generators/anycable/setup/templates/config/initializers/anycable.rb → generators/anycable/setup/templates/config/initializers/anycable.rb.tt} +1 -1
  30. data/lib/generators/anycable/with_os_helpers.rb +55 -0
  31. metadata +27 -50
  32. data/lib/anycable/rails/compatibility/rubocop/cops/anycable/remote_disconnect.rb +0 -31
  33. data/lib/rails/generators/anycable/setup/templates/Procfile +0 -2
  34. data/lib/rails/generators/anycable/setup/templates/bin/heroku-web +0 -7
  35. 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,2 +0,0 @@
1
- web: bin/heroku-web
2
- release: bundle exec rails db:migrate
@@ -1,7 +0,0 @@
1
- #!/bin/bash
2
-
3
- if [ "$ANYCABLE_DEPLOYMENT" == "true" ]; then
4
- bundle exec anycable --server-command="anycable-go"
5
- else
6
- bundle exec rails server -p $PORT -b 0.0.0.0
7
- fi
@@ -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") %>