anycable-rails 1.0.0.rc4 → 1.0.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: 36db9ad402206c4fa664b7f66a7ab9dee5438fa58a9a372ea5f1bed05787beaf
4
- data.tar.gz: 6ee564a9967354216882bf3bfb562d6567193f975a1fd67ef35464acc4a2bbf8
3
+ metadata.gz: 49d905b11d3ffb0c71c238ece809817adbbf336f489e1a317a692e9c50db0a5f
4
+ data.tar.gz: e632e101cb3e710548703da397843ef4c6f7df00f4afb2ba09a2a54a680ebd5c
5
5
  SHA512:
6
- metadata.gz: 51fbfcf41d1d2bc19f4ad8473bc02ea81dd2e19d600daa98e9a7c652cf95608b1c52e5aaa7934f062f92dbf20e976010a5f6ea488abcc2ee171dc474fd90699a
7
- data.tar.gz: 41acea91c33bd22b53c54ef57735746ffd0791f1b61a304801d67d79f3d2d94f73fe737573070a52e091f281ed45e49b2797b445fef4549d33f0d3c018e2acb3
6
+ metadata.gz: 1b6763e1152e6a2ce712053f6d6bc798c40af7f6fa01fc38f52e8105c924ac451c916ac7775e30dc83445f30b6956da4ddac1d83cda5360032b3c585f68bd0a5
7
+ data.tar.gz: d656c094dd40d392f2f1aaf093577e887d264dc75778b5a84da1563d24ce33c272ab34fdd526ec8d5ba22b5c5d570f0f86ba26b61821edbb21e2356446dd208b
@@ -2,14 +2,14 @@
2
2
 
3
3
  ## master
4
4
 
5
- ## 1.0.0.rc4 (2020-06-24)
5
+ ## 1.0.0 (2020-07-01)
6
+
7
+ - Support `rescue_from` in connections (Rails 6.1). ([@palkan][])
6
8
 
7
9
  - Make AnyCable patches compatible with Action Cable testing. ([@palkan][])
8
10
 
9
11
  - Do not add localhost `redis_url` to `anycable.yml` when Docker development method is chosen in `anycable:setup`. ([@palkan][])
10
12
 
11
- ## 1.0.0.rc2 (2020-06-16)
12
-
13
13
  - Fix connection identifiers deserialization regression. ([@palkan][])
14
14
 
15
15
  Using non-strings or non-GlobalId-encoded objects was broken.
@@ -19,8 +19,6 @@ Using non-strings or non-GlobalId-encoded objects was broken.
19
19
  Update Docker snippet, do not enable persistent sessions automatically,
20
20
  fix setting `config.action_cable.url` in environment configuration.
21
21
 
22
- ## 1.0.0.rc1 (2020-06-10)
23
-
24
22
  - Add `state_attr_accessor` for channels. ([@palkan][])
25
23
 
26
24
  Just like `attr_accessor` but "persists" the state between RPC calls.
@@ -198,3 +198,16 @@ module ActionCable
198
198
  # rubocop:enable Metrics/ClassLength
199
199
  end
200
200
  end
201
+
202
+ # Support rescue_from
203
+ # https://github.com/rails/rails/commit/d2571e560c62116f60429c933d0c41a0e249b58b
204
+ if ActionCable::Connection::Base.respond_to?(:rescue_from)
205
+ ActionCable::Connection::Base.prepend(Module.new do
206
+ def handle_channel_command(*)
207
+ super
208
+ rescue Exception => e # rubocop:disable Lint/RescueException
209
+ rescue_with_handler(e) || raise
210
+ false
211
+ end
212
+ end)
213
+ end
@@ -15,8 +15,8 @@ module ActionCable
15
15
  return super unless socket.session
16
16
 
17
17
  super.tap do |req|
18
- req.env[Rack::RACK_SESSION] =
19
- AnyCable::Rails::SessionProxy.new(req.env[Rack::RACK_SESSION], socket.session)
18
+ req.env[::Rack::RACK_SESSION] =
19
+ AnyCable::Rails::SessionProxy.new(req.env[::Rack::RACK_SESSION], socket.session)
20
20
  end
21
21
  end
22
22
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module AnyCable
4
4
  module Rails
5
- VERSION = "1.0.0.rc4"
5
+ VERSION = "1.0.0"
6
6
  end
7
7
  end
@@ -143,6 +143,10 @@ module AnyCableRailsGenerators
143
143
  !!gemfile_lock&.match?(/^\s+redis\b/)
144
144
  end
145
145
 
146
+ def webpacker?
147
+ !!gemfile_lock&.match?(/^\s+webpacker\b/)
148
+ end
149
+
146
150
  def rubocop?
147
151
  !!gemfile_lock&.match?(/^\s+rubocop\b/)
148
152
  end
@@ -224,8 +228,8 @@ module AnyCableRailsGenerators
224
228
  def template_proc_files
225
229
  file_name = "Procfile.dev"
226
230
 
227
- if File.exist?(file_name)
228
- append_file file_name, 'anycable: bundle exec anycable --server-command "anycable-go --port 3334"'
231
+ if file_exists?(file_name)
232
+ append_file file_name, "anycable: bundle exec anycable\nws: anycable-go#{anycable_go_options}", force: true
229
233
  else
230
234
  say_status :help, "💡 We recommend using Hivemind to manage multiple processes in development 👉 https://github.com/DarthSim/hivemind", :yellow
231
235
 
@@ -262,5 +266,15 @@ module AnyCableRailsGenerators
262
266
  args << "--version #{opts[:version]}" if opts[:version]
263
267
  end.join(" ")
264
268
  end
269
+
270
+ def anycable_go_options
271
+ redis? ? " --port=8080" : " --port=8080 --broadcast_adapter=http"
272
+ end
273
+
274
+ def file_exists?(name)
275
+ in_root do
276
+ return File.file?(name)
277
+ end
278
+ end
265
279
  end
266
280
  end
@@ -0,0 +1,6 @@
1
+ server: bundle exec rails s
2
+ <%- if webpacker? -%>
3
+ assets: bundle exec bin/webpack-dev-server
4
+ <%- end -%>
5
+ anycable: bundle exec anycable
6
+ ws: anycable-go<%= anycable_go_options %>
@@ -30,10 +30,17 @@ default: &default
30
30
  # Use the same channel name for WebSocket server, e.g.:
31
31
  # $ anycable-go --redis-channel="__anycable__"
32
32
  redis_channel: "__anycable__"
33
+ <%- if redis? -%>
34
+ # You can use REDIS_URL env var to configure Redis URL.
35
+ # Localhost is used by default.
36
+ # redis_url: "redis://localhost:6379/1"
37
+ <%- end -%>
33
38
 
34
39
  development:
35
40
  <<: *default
36
- redis_url: "redis://localhost:6379/1"
41
+
42
+ test:
43
+ <<: *default
37
44
 
38
45
  production:
39
46
  <<: *default
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: anycable-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.rc4
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - palkan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-06-24 00:00:00.000000000 Z
11
+ date: 2020-06-30 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
- version: 1.0.0.rc2
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
- version: 1.0.0.rc2
26
+ version: 1.0.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rails
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -161,7 +161,7 @@ files:
161
161
  - lib/generators/anycable/download/download_generator.rb
162
162
  - lib/generators/anycable/setup/USAGE
163
163
  - lib/generators/anycable/setup/setup_generator.rb
164
- - lib/generators/anycable/setup/templates/Procfile.dev
164
+ - lib/generators/anycable/setup/templates/Procfile.dev.tt
165
165
  - lib/generators/anycable/setup/templates/config/anycable.yml.tt
166
166
  - lib/generators/anycable/setup/templates/config/cable.yml.tt
167
167
  - lib/generators/anycable/setup/templates/config/initializers/anycable.rb.tt
@@ -186,9 +186,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
186
186
  version: '2.5'
187
187
  required_rubygems_version: !ruby/object:Gem::Requirement
188
188
  requirements:
189
- - - ">"
189
+ - - ">="
190
190
  - !ruby/object:Gem::Version
191
- version: 1.3.1
191
+ version: '0'
192
192
  requirements: []
193
193
  rubygems_version: 3.0.6
194
194
  signing_key:
@@ -1,3 +0,0 @@
1
- server: bin/rails server
2
- assets: bin/webpack-dev-server
3
- anycable: bundle exec anycable --server-command "anycable-go --port 3334"