anycable-rails 1.0.5 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1459676363d0523338a496163a296330e1bfbe363cc95b7e4433122163402a06
4
- data.tar.gz: d3c074189aa5858f2b7ffbc455c68b7bf96885e493cc8ed6bfce86c9a870a375
3
+ metadata.gz: 4b2017a00c28bf2656e223a5ba109d66044d4554c061cd4903b52485ff656906
4
+ data.tar.gz: c99be090e2e7517a9e4d680e5602a2d35331be05f39e9816813518e8726887cc
5
5
  SHA512:
6
- metadata.gz: 51ab9db5efba8e737e6608d958e550933c7ddc20e9cee8a9a830bce94403d2895a158a643f27a026fd9cb1ff486ece078f823158f2ac2fabe6cabe33fc9948ea
7
- data.tar.gz: 61b4563345b1e26ee1da6a7b61325040dca72942165f3508d1615dd06912fc2ab6ffbd8732fe9b9ebf04076a15707f51ae028d6479d90d97bc9f9590ff7c4929
6
+ metadata.gz: e3d265c017a5dbed395324ea17d9e91bdbb94aa5d8678d2df882a1d756b893eaa53272fe654ae98bcc79472e4358e9b4e45121632de3bcdc68c3d84f9d8736bc
7
+ data.tar.gz: 6184f438d860d7ee83537a2115367a84002ac833e9b58c2e767a68003039cc6ef6f0f907c76d1c599ac60729d104e5bb556012a5dc58b0eb9e0bb69c35175113
data/CHANGELOG.md CHANGED
@@ -2,6 +2,38 @@
2
2
 
3
3
  ## master
4
4
 
5
+ ## 1.1.0 🚸 (2021-06-01)
6
+
7
+ - No changes since 1.1.0.rc1.1.
8
+
9
+ ## 1.1.0.rc1.1 (2021-05-12)
10
+
11
+ - Fixed config loading regression introduced in 1.1.0.rc1.
12
+
13
+ ## 1.1.0.rc1 (2021-05-12)
14
+
15
+ - Adding `anycable` or `grpc` gem as an explicit dependency is required.
16
+
17
+ Now, `anycable-rails` depends on `anycable-core`, which doesn't include gRPC server implementation.
18
+ You should either add `anycable` or `grpc` (>= 1.37) gem as an explicit dependency.
19
+
20
+ - Add option to embed AnyCable RPC into a Rails server process. ([@palkan][])
21
+
22
+ Set `embedded: true` in the configuration to launch RPC along with `rails s` (only for Rails 6.1+).
23
+
24
+ - **Ruby >= 2.6** is required.
25
+ - **Rails >= 6.0** is required.
26
+
27
+ ## 1.0.7 (2021-03-05)
28
+
29
+ - Ruby 3 compatibility. ([@palkan][])
30
+
31
+ ## 1.0.6 (2021-02-25)
32
+
33
+ - Keep an explicit list of instance vars to ignore in compatibility checks. ([@palkan][])
34
+
35
+ You can ignore custom vars by adding them to the list: `AnyCable::Compatibility::IGNORE_INSTANCE_VARS << :@my_var`.
36
+
5
37
  ## 1.0.5 (2021-02-24)
6
38
 
7
39
  - Fixed bug with compatibility false negatives in development. ([@palkan][])
data/README.md CHANGED
@@ -1,4 +1,3 @@
1
- [![GitPitch](https://gitpitch.com/assets/badge.svg)](https://gitpitch.com/anycable/anycable/master?grs=github)
2
1
  [![Gem Version](https://badge.fury.io/rb/anycable-rails.svg)](https://rubygems.org/gems/anycable-rails)
3
2
  [![Build](https://github.com/anycable/anycable-rails/workflows/Build/badge.svg)](https://github.com/anycable/anycable-rails/actions)
4
3
  [![Gitter](https://img.shields.io/badge/gitter-join%20chat%20%E2%86%92-brightgreen.svg)](https://gitter.im/anycable/Lobby)
@@ -12,8 +11,6 @@ With AnyCable you can use channels, client-side JS, broadcasting - (almost) all
12
11
 
13
12
  You can even use Action Cable in development and not be afraid of [compatibility issues](#compatibility).
14
13
 
15
- **Important** This is a readme for the upcoming v1.0 release. For v0.6.x see the readme from the [0-6-stable](https://github.com/anycable/anycable-rails/tree/0-6-stable) branch.
16
-
17
14
  💾 [Example Application](https://github.com/anycable/anycable_rails_demo)
18
15
 
19
16
  📑 [Documentation](https://docs.anycable.io/#/rails/getting_started).
@@ -23,15 +20,16 @@ You can even use Action Cable in development and not be afraid of [compatibility
23
20
 
24
21
  ## Requirements
25
22
 
26
- - Ruby >= 2.5
27
- - Rails >= 5.2
23
+ - Ruby >= 2.6
24
+ - Rails >= 6.0
28
25
  - Redis (see [other options](https://github.com/anycable/anycable/issues/2) for broadcasting)
29
26
 
30
27
  ## Usage
31
28
 
32
- Add `anycable-rails` gem to your Gemfile:
29
+ Add `anycable-rails` and `anycable` gems to your Gemfile:
33
30
 
34
31
  ```ruby
32
+ gem "anycable"
35
33
  gem "anycable-rails"
36
34
 
37
35
  # when using Redis broadcast adapter
@@ -65,7 +63,7 @@ and specify AnyCable WebSocket server URL:
65
63
  # For development it's likely the localhost
66
64
 
67
65
  # config/environments/development.rb
68
- config.action_cable.url = "ws://localhost:3334/cable"
66
+ config.action_cable.url = "ws://localhost:8080/cable"
69
67
 
70
68
  # For production it's likely to have a sub-domain and secure connection
71
69
 
@@ -86,7 +84,7 @@ $ RAILS_ENV=production bundle exec anycable
86
84
  And, finally, run AnyCable WebSocket server, e.g. [anycable-go](https://docs.anycable.io/#/v1/anycable-go/getting_started):
87
85
 
88
86
  ```sh
89
- anycable-go --host=localhost --port=3334
87
+ anycable-go --host=localhost --port=8080
90
88
  ```
91
89
 
92
90
  See [documentation](https://docs.anycable.io/#/rails/getting_started) for more information on AnyCable + Rails usage.
@@ -99,10 +97,6 @@ See [documentation](https://docs.anycable.io/#/rails/compatibility).
99
97
 
100
98
  Bug reports and pull requests are welcome on GitHub at [https://github.com/anycable/anycable-rails](https://github.com/anycable/anycable-rails).
101
99
 
102
- ## Development
103
-
104
- If you are familiar with Docker, you can use [DIP](https://github.com/bibendi/dip) to start developing the gem quickly.
105
-
106
100
  ## License
107
101
 
108
102
  The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
@@ -27,7 +27,7 @@ module ActionCable
27
27
 
28
28
  class << self
29
29
  def call(socket, **options)
30
- new(socket, nil, options)
30
+ new(socket, nil, **options)
31
31
  end
32
32
  end
33
33
 
@@ -18,7 +18,7 @@ end)
18
18
 
19
19
  ActionCable::Channel::ConnectionStub.prepend(Module.new do
20
20
  def socket
21
- @socket ||= AnyCable::Socket.new(env: {})
21
+ @socket ||= AnyCable::Socket.new(env: AnyCable::Env.new(url: "http://test.host", headers: {}))
22
22
  end
23
23
 
24
24
  alias_method :anycable_socket, :socket
@@ -4,6 +4,11 @@ module AnyCable
4
4
  class CompatibilityError < StandardError; end
5
5
 
6
6
  module Compatibility # :nodoc:
7
+ IGNORE_INSTANCE_VARS = %i[
8
+ @active_periodic_timers
9
+ @_streams
10
+ ]
11
+
7
12
  ActionCable::Channel::Base.prepend(Module.new do
8
13
  def stream_from(broadcasting, callback = nil, coder: nil)
9
14
  if coder.present? && coder != ActiveSupport::JSON
@@ -23,8 +28,6 @@ module AnyCable
23
28
  %w[run_callbacks perform_action].each do |mid|
24
29
  module_eval <<~CODE, __FILE__, __LINE__ + 1
25
30
  def #{mid}(*)
26
- # allocate @_streams
27
- streams
28
31
  __anycable_check_ivars__ { super }
29
32
  end
30
33
  CODE
@@ -33,7 +36,7 @@ module AnyCable
33
36
  def __anycable_check_ivars__
34
37
  was_ivars = instance_variables
35
38
  res = yield
36
- diff = instance_variables - was_ivars
39
+ diff = instance_variables - was_ivars - IGNORE_INSTANCE_VARS
37
40
 
38
41
  if self.class.respond_to?(:channel_state_attributes)
39
42
  diff.delete(:@__istate__)
@@ -1,12 +1,17 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "anycable/config"
4
+ # Make sure Rails extensions for Anyway Config are loaded
5
+ # See https://github.com/anycable/anycable-rails/issues/63
6
+ require "anyway/rails"
4
7
 
5
8
  # Extend AnyCable configuration with:
6
9
  # - `access_logs_disabled` (defaults to true) — whether to print Started/Finished logs
7
10
  # - `persistent_session_enabled` (defaults to false) — whether to store session changes in the connection state
11
+ # - `embedded` (defaults to false) — whether to run RPC server inside a Rails server process
8
12
  AnyCable::Config.attr_config(
9
13
  access_logs_disabled: true,
10
- persistent_session_enabled: false
14
+ persistent_session_enabled: false,
15
+ embedded: false
11
16
  )
12
17
  AnyCable::Config.ignore_options :access_logs_disabled, :persistent_session_enabled
@@ -9,8 +9,8 @@ module AnyCable
9
9
  #
10
10
  # See https://github.com/grpc/grpc-go/blob/master/Documentation/grpc-metadata.md
11
11
  class LogTagging < AnyCable::Middleware
12
- def call(_request, call, _method)
13
- sid = call.metadata["sid"]
12
+ def call(_method, _request, metadata)
13
+ sid = metadata["sid"]
14
14
  return yield unless sid
15
15
 
16
16
  AnyCable.logger.tagged("AnyCable sid=#{sid}") { yield }
@@ -59,6 +59,16 @@ module AnyCable
59
59
  end
60
60
  end
61
61
  end
62
+
63
+ # Since Rails 6.1
64
+ if respond_to?(:server)
65
+ server do
66
+ next unless AnyCable.config.embedded?
67
+
68
+ require "anycable/cli"
69
+ AnyCable::CLI.embed!
70
+ end
71
+ end
62
72
  end
63
73
  end
64
74
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module AnyCable
4
4
  module Rails
5
- VERSION = "1.0.5"
5
+ VERSION = "1.1.0"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,43 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: anycable-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.5
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - palkan
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-02-24 00:00:00.000000000 Z
11
+ date: 2021-06-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: anycable
14
+ name: anycable-core
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 1.0.0
19
+ version: '1.1'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 1.0.0
26
+ version: '1.1'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: actioncable
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '5'
33
+ version: '6'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '5'
40
+ version: '6'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: globalid
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -52,20 +52,6 @@ dependencies:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
- - !ruby/object:Gem::Dependency
56
- name: activerecord
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - ">="
60
- - !ruby/object:Gem::Version
61
- version: '0'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - ">="
67
- - !ruby/object:Gem::Version
68
- version: '0'
69
55
  - !ruby/object:Gem::Dependency
70
56
  name: ammeter
71
57
  requirement: !ruby/object:Gem::Requirement
@@ -203,7 +189,8 @@ metadata:
203
189
  documentation_uri: https://docs.anycable.io/#/using_with_rails
204
190
  homepage_uri: https://anycable.io/
205
191
  source_code_uri: http://github.com/anycable/anycable-rails
206
- post_install_message:
192
+ funding_uri: https://github.com/sponsors/anycable
193
+ post_install_message:
207
194
  rdoc_options: []
208
195
  require_paths:
209
196
  - lib
@@ -211,15 +198,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
211
198
  requirements:
212
199
  - - ">="
213
200
  - !ruby/object:Gem::Version
214
- version: '2.5'
201
+ version: '2.6'
215
202
  required_rubygems_version: !ruby/object:Gem::Requirement
216
203
  requirements:
217
204
  - - ">="
218
205
  - !ruby/object:Gem::Version
219
206
  version: '0'
220
207
  requirements: []
221
- rubygems_version: 3.0.6
222
- signing_key:
208
+ rubygems_version: 3.2.15
209
+ signing_key:
223
210
  specification_version: 4
224
211
  summary: Rails adapter for AnyCable
225
212
  test_files: []