anycable-rails-core 1.6.0.rc.2 → 1.6.0.rc.3

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: 2fa2800d673ee7d03d6faee822368319e1930f4f31336127a09c10ac536048d3
4
- data.tar.gz: 19b10b1b47fee99b344e40371e6f3159627d18118768d50812a07cc22324fe43
3
+ metadata.gz: 734dca7d3a224a971ba2e4979e0a33337fa4551ff07cb86acd3c6cc546eea974
4
+ data.tar.gz: 88d96b3f0c85a2259c29cb0f863cdcee92584b801309202cab4a9d03c8152710
5
5
  SHA512:
6
- metadata.gz: c7ed672ed4817e197bc43a2839642556a432be2dd41916841cbfc065135afa3009ca4592f84159c58c804e5e1050e27db3b767e0856493ece3690427c7675a33
7
- data.tar.gz: 5ddc58e66b3f7d49eda206fbba61b993789ab92ba4adb382276a550a3492b571d53722f0f9bbfdee13a61d2df6874a7859e793446d3f2951fe441a4f4d94585a
6
+ metadata.gz: 5b0d2f5faf24b406264326771b00b23aadc88cb6b20d62a9055857e31c5e99d6cc770dc835dfabfff66c65aa26768062197c8d67d1e357749f0563d214d2cc30
7
+ data.tar.gz: 2793659e6c349ef838a84e57b4d42b3ddcff7aeabfb9024207e1e8a08b09e85ff28e68aaa1693b4e174512a03ddd0c7cc11450a988470846add034d31742f0b4
data/CHANGELOG.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  ## main
4
4
 
5
+ ## 1.6.0.rc.3 (2025-02-20)
6
+
7
+ - Update `anycable:download` generator to support v1.6+. ([@palkan][])
8
+
9
+ - Add `#anycable_token_meta_tag` helper. ([@palkan][])
10
+
11
+ It generates a meta tag with the AnyCable JWT token (w/o the URL).
12
+
5
13
  ## 1.6.0.rc.2 (2025-02-10)
6
14
 
7
15
  - Add Presence API. ([@palkan][])
@@ -22,10 +22,10 @@ module AnyCable
22
22
  tag "meta", name: "action-cable-url", content: url
23
23
  end
24
24
 
25
- def any_cable_jwt_meta_tag(**identifiers)
25
+ def anycable_token_meta_tag(**identifiers)
26
26
  token = JWT.encode(identifiers)
27
27
 
28
- tag "meta", name: "any-cable-jwt", content: token
28
+ tag "meta", name: "cable-token", content: token
29
29
  end
30
30
 
31
31
  def signed_stream_name(streamables)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module AnyCable
4
4
  module Rails
5
- VERSION = "1.6.0.rc.2"
5
+ VERSION = "1.6.0.rc.3"
6
6
  end
7
7
  end
@@ -37,24 +37,35 @@ module AnyCableRailsGenerators
37
37
  return latest_release_url(version) if version == "latest"
38
38
 
39
39
  if Gem::Version.new(version).segments.first >= 1
40
- new_release_url("v#{version}")
40
+ new_release_url(version)
41
41
  else
42
- legacy_release_url("v#{version}")
42
+ legacy_release_url(version)
43
+ end
44
+ end
45
+
46
+ def repository_name(version)
47
+ return "anycable/anycable" if version == "latest"
48
+
49
+ major, minor, = Gem::Version.new(version).segments
50
+ if (major >= 1 && minor >= 6) || (major > 1)
51
+ "anycable/anycable"
52
+ else
53
+ "anycable/anycable-go"
43
54
  end
44
55
  end
45
56
 
46
57
  def legacy_release_url(version)
47
- "https://github.com/anycable/anycable-go/releases/download/#{version}/" \
58
+ "https://github.com/#{repository_name(version)}/releases/download/v#{version}/" \
48
59
  "anycable-go-v#{version}-#{os_name}-#{cpu_name}"
49
60
  end
50
61
 
51
62
  def new_release_url(version)
52
- "https://github.com/anycable/anycable-go/releases/download/#{version}/" \
63
+ "https://github.com/#{repository_name(version)}/releases/download/v#{version}/" \
53
64
  "anycable-go-#{os_name}-#{cpu_name}"
54
65
  end
55
66
 
56
67
  def latest_release_url(version)
57
- "https://github.com/anycable/anycable-go/releases/latest/download/" \
68
+ "https://github.com/#{repository_name(version)}/releases/latest/download/" \
58
69
  "anycable-go-#{os_name}-#{cpu_name}"
59
70
  end
60
71
 
@@ -88,6 +88,13 @@ module AnyCableRailsGenerators
88
88
  "`action_cable_meta_tag` or `action_cable_with_jwt_meta_tag` included in your HTML layout"
89
89
  end
90
90
 
91
+ def cable_engine_warning
92
+ return unless application_rb
93
+ return if application_rb.match?(/^require\s+['"](action_cable\/engine|rails\/all)['"]/)
94
+
95
+ say_status :help, "⚠️ Ensure Action Cable is loaded.\nAdd `require \"action_cable/engine\"` to your `config/application.rb`."
96
+ end
97
+
91
98
  def deployment_method
92
99
  say_status :info, "🚢 See our deployment guide to learn how to run AnyCable in production 👉 #{DOCS_ROOT}/deployment"
93
100
 
@@ -139,6 +146,17 @@ module AnyCableRailsGenerators
139
146
  end
140
147
  end
141
148
 
149
+ def application_rb
150
+ @application_rb ||= begin
151
+ res = nil
152
+ in_root do
153
+ next unless File.file?("config/application.rb")
154
+ res = File.read("config/application.rb")
155
+ end
156
+ res
157
+ end
158
+ end
159
+
142
160
  def install_for_docker
143
161
  say_status :help, "️️⚠️ Docker development configuration could vary", :yellow
144
162
 
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.6.0.rc.2
4
+ version: 1.6.0.rc.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - palkan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-02-11 00:00:00.000000000 Z
11
+ date: 2025-02-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: anycable-core