anycable-rails 1.0.2 → 1.0.8

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1c58ca24c6710071b8a90eee6a0d84ba9ec3069d0fb86fecebdab3cfba9fe1d3
4
- data.tar.gz: f6ca1937e8cf821d3ded458db84cbfc83840ad45af266c04f32388e2ecec621d
3
+ metadata.gz: 8370f83414dd80b7b8f7249f8812bfa9363a89f03178f88f7a3a9feb5ea337f4
4
+ data.tar.gz: e60aa76aed1b58700b080062813f0f127ea9d6134830e7e15e9ba5d332e7fd45
5
5
  SHA512:
6
- metadata.gz: 2ffbcc289fe4be6092c67b9953074f57a976f4375b1ac91408723043e9140e041f2fae83d7c3ac7234aa05651db48be4a663a2812b8a6bf2919fa9fc3c127494
7
- data.tar.gz: b22cc5e90dfdc39369efef3feb46628635397313b203e645a042e810342bdbbe7da85ad900f3626a1d99ee85da8b4e9629be398aa68970758aeea78ff8fa95b5
6
+ metadata.gz: 22abec15d46f3e4cfcae0119b3ccb188a528075e21a3403a61d569d73f0ee51ceadc2e9dc72cc0b4c6b2c633a596f50d9a8305a3bff66205c85180acb8d94d48
7
+ data.tar.gz: e057df2ca5c474aeec283e0f162bf5f9f2b0a987d76f08dd0bf8fb1baad71d402487079d1588cc57195e369babf41d5ac2d2ebc2e034993959a37e11283efaf6
data/CHANGELOG.md CHANGED
@@ -2,6 +2,32 @@
2
2
 
3
3
  ## master
4
4
 
5
+ ## 1.0.7 (2021-03-05)
6
+
7
+ - Ruby 3 compatibility. ([@palkan][])
8
+
9
+ ## 1.0.6 (2021-02-25)
10
+
11
+ - Keep an explicit list of instance vars to ignore in compatibility checks. ([@palkan][])
12
+
13
+ You can ignore custom vars by adding them to the list: `AnyCable::Compatibility::IGNORE_INSTANCE_VARS << :@my_var`.
14
+
15
+ ## 1.0.5 (2021-02-24)
16
+
17
+ - Fixed bug with compatibility false negatives in development. ([@palkan][])
18
+
19
+ See [#151](https://github.com/anycable/anycable-rails/issues/151).
20
+
21
+ ## 1.0.4 (2020-10-02)
22
+
23
+ - Relax Rails dependencies. ([@palkan][])
24
+
25
+ Only add `actioncable` and `globalid` as runtime dependencies, not the whole `rails`.
26
+
27
+ ## 1.0.3 (2020-09-16)
28
+
29
+ - Fixed bug with building a request object when session store is absent. ([@palkan][])
30
+
5
31
  ## 1.0.2 (2020-09-08)
6
32
 
7
33
  - Added missing channel state support to `#unsubscribed` callbacks. ([@palkan][])
data/MIT-LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright 2017-2020 palkan
1
+ Copyright 2017-2021 palkan
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
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)
@@ -99,10 +98,6 @@ See [documentation](https://docs.anycable.io/#/rails/compatibility).
99
98
 
100
99
  Bug reports and pull requests are welcome on GitHub at [https://github.com/anycable/anycable-rails](https://github.com/anycable/anycable-rails).
101
100
 
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
101
  ## License
107
102
 
108
103
  The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
@@ -5,7 +5,7 @@ require "action_cable/channel"
5
5
  module ActionCable
6
6
  module Channel
7
7
  class Base # :nodoc:
8
- alias handle_subscribe subscribe_to_channel
8
+ alias_method :handle_subscribe, :subscribe_to_channel
9
9
 
10
10
  public :handle_subscribe, :subscription_rejected?
11
11
 
@@ -21,13 +21,13 @@ module ActionCable
21
21
 
22
22
  attr_reader :socket
23
23
 
24
- alias anycable_socket socket
24
+ alias_method :anycable_socket, :socket
25
25
 
26
26
  delegate :env, :session, to: :request
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
 
@@ -12,8 +12,6 @@ end
12
12
 
13
13
  ActionCable::Channel::ChannelStub.prepend(Module.new do
14
14
  def subscribe_to_channel
15
- # allocate @streams
16
- streams
17
15
  handle_subscribe
18
16
  end
19
17
  end)
@@ -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
@@ -31,7 +36,7 @@ module AnyCable
31
36
  def __anycable_check_ivars__
32
37
  was_ivars = instance_variables
33
38
  res = yield
34
- diff = instance_variables - was_ivars
39
+ diff = instance_variables - was_ivars - IGNORE_INSTANCE_VARS
35
40
 
36
41
  if self.class.respond_to?(:channel_state_attributes)
37
42
  diff.delete(:@__istate__)
@@ -38,16 +38,16 @@ module AnyCable
38
38
  config = ::Rails.application.config
39
39
 
40
40
  ActionDispatch::MiddlewareStack.new do |middleware|
41
- middleware.use(config.session_store, config.session_options)
41
+ middleware.use(config.session_store, config.session_options) if config.session_store
42
42
  end
43
43
  end
44
44
 
45
45
  def self.app
46
46
  @rack_app || app_build_lock.synchronize do
47
- @rack_app ||= begin
48
- stack = default_middleware_stack
49
- @middleware = middleware.merge_into(stack)
50
- middleware.build { [-1, {}, []] }
47
+ @rack_app ||= default_middleware_stack.yield_self do |stack|
48
+ middleware.merge_into(stack)
49
+ end.yield_self do |stack|
50
+ stack.build { [-1, {}, []] }
51
51
  end
52
52
  end
53
53
  end
@@ -18,8 +18,8 @@ module AnyCable
18
18
  AnyCable.logger = ActiveSupport::TaggedLogging.new(::ActionCable.server.config.logger)
19
19
  # Broadcast server logs to STDOUT in development
20
20
  if ::Rails.env.development? &&
21
- !ActiveSupport::Logger.logger_outputs_to?(::Rails.logger, STDOUT)
22
- console = ActiveSupport::Logger.new(STDOUT)
21
+ !ActiveSupport::Logger.logger_outputs_to?(::Rails.logger, $stdout)
22
+ console = ActiveSupport::Logger.new($stdout)
23
23
  console.formatter = ::Rails.logger.formatter
24
24
  console.level = ::Rails.logger.level
25
25
  AnyCable.logger.extend(ActiveSupport::Logger.broadcast(console))
@@ -21,8 +21,8 @@ module AnyCable
21
21
  CODE
22
22
  end
23
23
 
24
- alias include? has_key?
25
- alias key? has_key?
24
+ alias_method :include?, :has_key?
25
+ alias_method :key?, :has_key?
26
26
 
27
27
  %i[update merge! to_hash].each do |mid|
28
28
  class_eval <<~CODE, __FILE__, __LINE__ + 1
@@ -33,7 +33,7 @@ module AnyCable
33
33
  CODE
34
34
  end
35
35
 
36
- alias to_h to_hash
36
+ alias_method :to_h, :to_hash
37
37
 
38
38
  def keys
39
39
  rack_session.keys + socket_session.keys
@@ -2,6 +2,6 @@
2
2
 
3
3
  module AnyCable
4
4
  module Rails
5
- VERSION = "1.0.2"
5
+ VERSION = "1.0.8"
6
6
  end
7
7
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Add Warden middkeware to AnyCable stack to allow accessing
3
+ # Add Warden middleware to AnyCable stack to allow accessing
4
4
  # Devise current user via `env["warden"].user`.
5
5
  #
6
6
  # See <%= DOCS_ROOT %>/ruby/authentication
metadata CHANGED
@@ -1,31 +1,31 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: anycable-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - palkan
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-09-08 00:00:00.000000000 Z
11
+ date: 2021-06-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: anycable
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: 1.0.0
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
26
  version: 1.0.0
27
27
  - !ruby/object:Gem::Dependency
28
- name: rails
28
+ name: actioncable
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
@@ -38,6 +38,34 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '5'
41
+ - !ruby/object:Gem::Dependency
42
+ name: globalid
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
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'
41
69
  - !ruby/object:Gem::Dependency
42
70
  name: ammeter
43
71
  requirement: !ruby/object:Gem::Requirement
@@ -175,7 +203,7 @@ metadata:
175
203
  documentation_uri: https://docs.anycable.io/#/using_with_rails
176
204
  homepage_uri: https://anycable.io/
177
205
  source_code_uri: http://github.com/anycable/anycable-rails
178
- post_install_message:
206
+ post_install_message:
179
207
  rdoc_options: []
180
208
  require_paths:
181
209
  - lib
@@ -190,8 +218,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
190
218
  - !ruby/object:Gem::Version
191
219
  version: '0'
192
220
  requirements: []
193
- rubygems_version: 3.0.6
194
- signing_key:
221
+ rubygems_version: 3.2.15
222
+ signing_key:
195
223
  specification_version: 4
196
224
  summary: Rails adapter for AnyCable
197
225
  test_files: []