anycable-rails-core 1.5.4 → 1.5.5

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: 6ceb26b8e5c09c7bd5500007a29a79a2933cc38848a63da16af272a4a5d11771
4
- data.tar.gz: 6db49c5ceca2e5b020fb7b225ebe2e1db63df8beb9858224502883ff35392529
3
+ metadata.gz: 2d1806c2fa82dabe3ba59ed53b814f9b1380e42f8f6341af82c4c27bf192c283
4
+ data.tar.gz: f2bf0761e8d2edf39f9a17869f89e0e2ad0bb80d49c74de451f53b00a0406144
5
5
  SHA512:
6
- metadata.gz: d78c540124cec98c20e2004f49324580300a9be00eea194fa09200a8b30090b3448e3411dcba1a4002efa857997e0ed66da44a808efd17ceede3ce45fd97b751
7
- data.tar.gz: 4e7916ccc0f8c18ed305eab329575c1bc840be9eeeb1534d4d3c661067a5f9a96ac761af3e8f2f9871a0f3bcbc7d30816e09a3e9998d7bffdf3555d36a88f515
6
+ metadata.gz: a4ece01b56c5118971493acf71a9f99651961d872dc51a6f58808ce4daf84e3e9c9514f4d79b214cf4621b39131d2cbf0cac04a085cef0e0394bb72a7a11b4b8
7
+ data.tar.gz: '0441569abd1b2c94969fc30d2f4b2a33657a663f3e3b6a2e68c7970da1a2008f72d7fd4afe2de49d86b1d85963237f2630e459e2708cf19d8e9f3f105bf59f8a'
data/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  ## master
4
4
 
5
+ ## 1.5.5 (2024-12-12)
6
+
7
+ - Publish RuboCop cops as a separate gem (`rubocop-anycable-rails`). ([@palkan][])
8
+
9
+ - Upgrade RuboCop cops. ([@palkan][])
10
+
5
11
  ## 1.5.4 (2024-10-08)
6
12
 
7
13
  - Add [actioncable-next](https://github.com/anycable/actioncable-next) support. ([@palkan][])
@@ -1,27 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "rubocop"
4
- require "pathname"
5
-
6
- require_relative "rubocop/cops/anycable/stream_from"
7
- require_relative "rubocop/cops/anycable/periodical_timers"
8
- require_relative "rubocop/cops/anycable/instance_vars"
9
-
10
- module RuboCop
11
- module AnyCable # :nodoc:
12
- CONFIG_DEFAULT = Pathname.new(__dir__).join("rubocop", "config", "default.yml").freeze
13
-
14
- # Merge anycable config into default configuration
15
- # See https://github.com/backus/rubocop-rspec/blob/master/lib/rubocop/rspec/inject.rb
16
- def self.inject!
17
- path = CONFIG_DEFAULT.to_s
18
- puts "configuration from #{path}" if ConfigLoader.debug?
19
- hash = ConfigLoader.send(:load_yaml_configuration, path)
20
- config = Config.new(hash, path)
21
- config = ConfigLoader.merge_with_default(config, path)
22
- ConfigLoader.instance_variable_set(:@default_configuration, config)
23
- end
24
- end
25
- end
26
-
27
- RuboCop::AnyCable.inject!
3
+ # For backwards compatibility
4
+ require_relative "../rubocop"
@@ -24,7 +24,7 @@ module RuboCop
24
24
  # end
25
25
  # end
26
26
  #
27
- class InstanceVars < RuboCop::Cop::Cop
27
+ class InstanceVars < RuboCop::Cop::Base
28
28
  MSG = "Channel instance variables are not supported in AnyCable. Use `state_attr_accessor` instead"
29
29
 
30
30
  def on_class(node)
@@ -13,7 +13,7 @@ module RuboCop
13
13
  # periodically(:do_something, every: 2.seconds)
14
14
  # end
15
15
  #
16
- class PeriodicalTimers < RuboCop::Cop::Cop
16
+ class PeriodicalTimers < RuboCop::Cop::Base
17
17
  MSG = "Periodical Timers are not supported in AnyCable"
18
18
 
19
19
  def_node_matcher :calls_periodically?, <<-PATTERN
@@ -34,7 +34,7 @@ module RuboCop
34
34
  # end
35
35
  # end
36
36
  #
37
- class StreamFrom < RuboCop::Cop::Cop
37
+ class StreamFrom < RuboCop::Cop::Base
38
38
  def_node_matcher :stream_from_with_block?, <<-PATTERN
39
39
  (block {(send _ :stream_from ...) (send _ :stream_for ...)} ...)
40
40
  PATTERN
@@ -81,16 +81,14 @@ module RuboCop
81
81
 
82
82
  def add_callback_offense(node)
83
83
  add_offense(
84
- node,
85
- location: :expression,
84
+ node.loc.expression,
86
85
  message: "Custom stream callbacks are not supported in AnyCable"
87
86
  )
88
87
  end
89
88
 
90
89
  def add_custom_coder_offense(node)
91
90
  add_offense(
92
- node,
93
- location: :expression,
91
+ node.loc.expression,
94
92
  message: "Custom coders are not supported in AnyCable"
95
93
  )
96
94
  end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "rubocop"
4
+ require "pathname"
5
+
6
+ require_relative "rubocop/cops/anycable/stream_from"
7
+ require_relative "rubocop/cops/anycable/periodical_timers"
8
+ require_relative "rubocop/cops/anycable/instance_vars"
9
+
10
+ module RuboCop
11
+ module AnyCable # :nodoc:
12
+ CONFIG_DEFAULT = Pathname.new(__dir__).join("rubocop", "config", "default.yml").freeze
13
+
14
+ # Merge anycable config into default configuration
15
+ # See https://github.com/backus/rubocop-rspec/blob/master/lib/rubocop/rspec/inject.rb
16
+ def self.inject!
17
+ path = CONFIG_DEFAULT.to_s
18
+ puts "configuration from #{path}" if ConfigLoader.debug?
19
+ hash = ConfigLoader.send(:load_yaml_configuration, path)
20
+ config = Config.new(hash, path)
21
+ config = ConfigLoader.merge_with_default(config, path)
22
+ ConfigLoader.instance_variable_set(:@default_configuration, config)
23
+ end
24
+ end
25
+ end
26
+
27
+ RuboCop::AnyCable.inject!
@@ -2,6 +2,6 @@
2
2
 
3
3
  module AnyCable
4
4
  module Rails
5
- VERSION = "1.5.4"
5
+ VERSION = "1.5.5"
6
6
  end
7
7
  end
@@ -84,7 +84,7 @@ end
84
84
 
85
85
  # Warn if application has been already initialized.
86
86
  # AnyCable should be loaded before initialization in order to work correctly.
87
- if defined?(::Rails) && ::Rails.application && ::Rails.application.initialized?
87
+ if defined?(::Rails) && ::Rails.application&.initialized?
88
88
  puts("\n**************************************************")
89
89
  puts(
90
90
  "⛔️ WARNING: AnyCable loaded after application initialization. Might not work correctly.\n" \
@@ -23,7 +23,7 @@ default: &default
23
23
  <%- else -%>
24
24
  # Use HTTP broadcaster
25
25
  broadcast_adapter: http
26
- http_broadcast_url: "http://localhost:8090/_anycable"
26
+ http_broadcast_url: "http://localhost:8090/_broadcast"
27
27
  <%- end -%>
28
28
  <%- if redis? -%>
29
29
  # You can use REDIS_URL env var to configure Redis URL.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: anycable-rails-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.4
4
+ version: 1.5.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - palkan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-10-09 00:00:00.000000000 Z
11
+ date: 2024-12-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: anycable-core
@@ -80,10 +80,6 @@ files:
80
80
  - lib/anycable/rails/channel_state.rb
81
81
  - lib/anycable/rails/compatibility.rb
82
82
  - lib/anycable/rails/compatibility/rubocop.rb
83
- - lib/anycable/rails/compatibility/rubocop/config/default.yml
84
- - lib/anycable/rails/compatibility/rubocop/cops/anycable/instance_vars.rb
85
- - lib/anycable/rails/compatibility/rubocop/cops/anycable/periodical_timers.rb
86
- - lib/anycable/rails/compatibility/rubocop/cops/anycable/stream_from.rb
87
83
  - lib/anycable/rails/config.rb
88
84
  - lib/anycable/rails/connection.rb
89
85
  - lib/anycable/rails/connection_factory.rb
@@ -105,6 +101,11 @@ files:
105
101
  - lib/anycable/rails/pubsub_channel.rb
106
102
  - lib/anycable/rails/rack.rb
107
103
  - lib/anycable/rails/railtie.rb
104
+ - lib/anycable/rails/rubocop.rb
105
+ - lib/anycable/rails/rubocop/config/default.yml
106
+ - lib/anycable/rails/rubocop/cops/anycable/instance_vars.rb
107
+ - lib/anycable/rails/rubocop/cops/anycable/periodical_timers.rb
108
+ - lib/anycable/rails/rubocop/cops/anycable/stream_from.rb
108
109
  - lib/anycable/rails/socket_id_tracking.rb
109
110
  - lib/anycable/rails/version.rb
110
111
  - lib/generators/anycable/bin/USAGE