cable_ready 5.0.2 → 5.0.4

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: 740e012630c79e657256a99d309e96704f2dfc7080d056edcd68c23ab18aebb2
4
- data.tar.gz: 356b0038be58993b208f1128465d46a0ed4bf0cf858038e2a44b86275b8447f7
3
+ metadata.gz: 370257c592bcb4dda3a9466cee960208bf00f23e9966d6bfbc74b5976f7aca93
4
+ data.tar.gz: a6d333775454cc46d636f0c0c0707449f9b31072307f8fbad7c8ccd565671de2
5
5
  SHA512:
6
- metadata.gz: eea5efc0262818516332c01f9e6ef98fc935c0f56e0f0a73f7ccf43c88f8774d7ccc9fd6fef4acf2f83ca77a446735a836f55a23d1391fbcc5c8811b667c5d3c
7
- data.tar.gz: 0b199e3a2950c6103e2099a194973db49ac89f53a8698693ef12767665f20497bec903336a9f197f93b006120e35e14645ad37c18b9b2ecedb87d2eee8aae7d8
6
+ metadata.gz: dca231343c358d9c33efe88ea21a05f1fec27f45c3d85cc34aed968aa6df7d6ae82beb754606504412ab18690f6b4a13811dee00f069748129bbaf8ed6ac8bd0
7
+ data.tar.gz: db45207f865f503508a0e0603e830c33f8c2b0c27e94af62d0f786fbdc6847242e1151ffafbe9524f186ea83b83bd2dc531e094df8776c690ae8b0d8a970ec07
data/Gemfile.lock CHANGED
@@ -1,10 +1,11 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cable_ready (5.0.1)
4
+ cable_ready (5.0.4)
5
5
  actionpack (>= 5.2)
6
6
  actionview (>= 5.2)
7
7
  activesupport (>= 5.2)
8
+ observer (~> 0.1)
8
9
  railties (>= 5.2)
9
10
  thread-local (>= 1.1.0)
10
11
 
@@ -114,6 +115,7 @@ GEM
114
115
  racc (~> 1.4)
115
116
  nokogiri (1.14.3-x86_64-linux)
116
117
  racc (~> 1.4)
118
+ observer (0.1.2)
117
119
  parallel (1.22.1)
118
120
  parser (3.2.1.0)
119
121
  ast (~> 2.4.1)
@@ -2,7 +2,7 @@ import morphdom from "morphdom";
2
2
 
3
3
  var name = "cable_ready";
4
4
 
5
- var version = "5.0.1";
5
+ var version = "5.0.3";
6
6
 
7
7
  var description = "CableReady helps you create great real-time user experiences by making it simple to trigger client-side DOM changes from server-side Ruby.";
8
8
 
@@ -4,7 +4,7 @@
4
4
  })(this, (function(exports, morphdom) {
5
5
  "use strict";
6
6
  var name = "cable_ready";
7
- var version = "5.0.1";
7
+ var version = "5.0.3";
8
8
  var description = "CableReady helps you create great real-time user experiences by making it simple to trigger client-side DOM changes from server-side Ruby.";
9
9
  var keywords = [ "ruby", "rails", "websockets", "actioncable", "cable", "ssr", "stimulus_reflex", "client-side", "dom" ];
10
10
  var homepage = "https://cableready.stimulusreflex.com";
data/cable_ready.gemspec CHANGED
@@ -28,6 +28,7 @@ Gem::Specification.new do |gem|
28
28
  gem.add_dependency "activesupport", rails_version
29
29
  gem.add_dependency "railties", rails_version
30
30
  gem.add_dependency "thread-local", ">= 1.1.0"
31
+ gem.add_dependency "observer", "~> 0.1"
31
32
 
32
33
  gem.add_development_dependency "magic_frozen_string_literal"
33
34
  gem.add_development_dependency "mocha"
@@ -2,223 +2,250 @@
2
2
 
3
3
  require "cable_ready/version"
4
4
 
5
- ### general utilities
5
+ module CableReady
6
+ class Installer
7
+ include Thor::Base
8
+ include Thor::Actions
6
9
 
7
- def fetch(step_path, file)
8
- relative_path = step_path + file
9
- location = template_src + relative_path
10
+ source_root Dir.pwd
10
11
 
11
- Pathname.new(location)
12
- end
12
+ ## Thor wrapper
13
13
 
14
- def complete_step(step)
15
- create_file "tmp/cable_ready_installer/#{step}", verbose: false
16
- end
14
+ def self.create_file(...)
15
+ new.create_file(...)
16
+ end
17
17
 
18
- def create_or_append(path, *args, &block)
19
- FileUtils.touch(path)
20
- append_file(path, *args, &block)
21
- end
18
+ def self.append_file(...)
19
+ new.append_file(...)
20
+ end
22
21
 
23
- def current_template
24
- ENV["LOCATION"].split("/").last.gsub(".rb", "")
25
- end
22
+ def self.copy_file(...)
23
+ new.copy_file(...)
24
+ end
26
25
 
27
- def pack_path_missing?
28
- return false unless pack_path.nil?
29
- halt "#{friendly_pack_path} is missing. You need a valid application pack file to proceed."
30
- end
26
+ def self.say(...)
27
+ new.say(...)
28
+ end
31
29
 
32
- def halt(message)
33
- say "❌ #{message}", :red
34
- create_file "tmp/cable_ready_installer/halt", verbose: false
35
- end
30
+ ### general utilities
36
31
 
37
- def backup(path, delete: false)
38
- if !path.exist?
39
- yield
40
- return
41
- end
32
+ def self.fetch(step_path, file)
33
+ relative_path = step_path + file
34
+ location = template_src + relative_path
42
35
 
43
- backup_path = Pathname.new("#{path}.bak")
44
- old_path = path.relative_path_from(Rails.root).to_s
45
- filename = path.to_path.split("/").last
36
+ Pathname.new(location)
37
+ end
46
38
 
47
- if backup_path.exist?
48
- if backup_path.read == path.read
49
- path.delete if delete
50
- yield
51
- return
39
+ def self.complete_step(step)
40
+ create_file "tmp/cable_ready_installer/#{step}", verbose: false
52
41
  end
53
- backup_path.delete
54
- end
55
42
 
56
- copy_file(path, backup_path, verbose: false)
57
- path.delete if delete
43
+ def self.create_or_append(path, *args, &block)
44
+ FileUtils.touch(path)
45
+ append_file(path, *args, &block)
46
+ end
58
47
 
59
- yield
48
+ def self.current_template
49
+ ENV["LOCATION"].split("/").last.gsub(".rb", "")
50
+ end
60
51
 
61
- if path.read != backup_path.read
62
- create_or_append(backups_path, "#{old_path}\n", verbose: false)
63
- end
64
- say "📦 #{old_path} backed up as #{filename}.bak"
65
- end
52
+ def self.pack_path_missing?
53
+ return false unless pack_path.nil?
54
+ halt "#{friendly_pack_path} is missing. You need a valid application pack file to proceed."
55
+ end
66
56
 
67
- def add_gem(name)
68
- create_or_append(add_gem_list, "#{name}\n", verbose: false)
69
- say "☑️ Added #{name} to the Gemfile"
70
- end
57
+ def self.halt(message)
58
+ say "#{message}", :red
59
+ create_file "tmp/cable_ready_installer/halt", verbose: false
60
+ end
71
61
 
72
- def remove_gem(name)
73
- create_or_append(remove_gem_list, "#{name}\n", verbose: false)
74
- say "❎ Removed #{name} from Gemfile"
75
- end
62
+ def self.backup(path, delete: false)
63
+ if !path.exist?
64
+ yield
65
+ return
66
+ end
67
+
68
+ backup_path = Pathname.new("#{path}.bak")
69
+ old_path = path.relative_path_from(Rails.root).to_s
70
+ filename = path.to_path.split("/").last
71
+
72
+ if backup_path.exist?
73
+ if backup_path.read == path.read
74
+ path.delete if delete
75
+ yield
76
+ return
77
+ end
78
+ backup_path.delete
79
+ end
80
+
81
+ copy_file(path, backup_path, verbose: false)
82
+ path.delete if delete
76
83
 
77
- def add_package(name)
78
- create_or_append(package_list, "#{name}\n", verbose: false)
79
- say "☑️ Enqueued #{name} to be added to dependencies"
80
- end
84
+ yield
81
85
 
82
- def add_dev_package(name)
83
- create_or_append(dev_package_list, "#{name}\n", verbose: false)
84
- say "☑️ Enqueued #{name} to be added to dev dependencies"
85
- end
86
+ if path.read != backup_path.read
87
+ create_or_append(backups_path, "#{old_path}\n", verbose: false)
88
+ end
89
+ say "📦 #{old_path} backed up as #{filename}.bak"
90
+ end
86
91
 
87
- def drop_package(name)
88
- create_or_append(drop_package_list, "#{name}\n", verbose: false)
89
- say " Enqueued #{name} to be removed from dependencies"
90
- end
92
+ def self.add_gem(name)
93
+ create_or_append(add_gem_list, "#{name}\n", verbose: false)
94
+ say "☑️ Added #{name} to the Gemfile"
95
+ end
91
96
 
92
- def gemfile_hash
93
- Digest::MD5.hexdigest(gemfile_path.read)
94
- end
97
+ def self.remove_gem(name)
98
+ create_or_append(remove_gem_list, "#{name}\n", verbose: false)
99
+ say "❎ Removed #{name} from Gemfile"
100
+ end
95
101
 
96
- ### memoized values
102
+ def self.add_package(name)
103
+ create_or_append(package_list, "#{name}\n", verbose: false)
104
+ say "☑️ Enqueued #{name} to be added to dependencies"
105
+ end
97
106
 
98
- def cr_npm_version
99
- @cr_npm_version ||= CableReady::VERSION.gsub(".pre", "-pre")
100
- end
107
+ def self.add_dev_package(name)
108
+ create_or_append(dev_package_list, "#{name}\n", verbose: false)
109
+ say "☑️ Enqueued #{name} to be added to dev dependencies"
110
+ end
101
111
 
102
- def package_json
103
- @package_json ||= Rails.root.join("package.json")
104
- end
112
+ def self.drop_package(name)
113
+ create_or_append(drop_package_list, "#{name}\n", verbose: false)
114
+ say "❎ Enqueued #{name} to be removed from dependencies"
115
+ end
105
116
 
106
- def entrypoint
107
- @entrypoint ||= File.read("tmp/cable_ready_installer/entrypoint")
108
- end
117
+ def self.gemfile_hash
118
+ Digest::MD5.hexdigest(gemfile_path.read)
119
+ end
109
120
 
110
- def bundler
111
- @bundler ||= File.read("tmp/cable_ready_installer/bundler")
112
- end
121
+ ### memoized values
113
122
 
114
- def config_path
115
- @config_path ||= Rails.root.join(entrypoint, "config")
116
- end
123
+ def self.cr_npm_version
124
+ @cr_npm_version ||= CableReady::VERSION.gsub(".pre", "-pre")
125
+ end
117
126
 
118
- def importmap_path
119
- @importmap_path ||= Rails.root.join("config/importmap.rb")
120
- end
127
+ def self.package_json
128
+ @package_json ||= Rails.root.join("package.json")
129
+ end
121
130
 
122
- def friendly_importmap_path
123
- @friendly_importmap_path ||= importmap_path.relative_path_from(Rails.root).to_s
124
- end
131
+ def self.entrypoint
132
+ @entrypoint ||= File.read("tmp/cable_ready_installer/entrypoint")
133
+ end
125
134
 
126
- def pack
127
- @pack ||= pack_path.read
128
- end
135
+ def self.bundler
136
+ @bundler ||= File.read("tmp/cable_ready_installer/bundler")
137
+ end
129
138
 
130
- def friendly_pack_path
131
- @friendly_pack_path ||= pack_path.relative_path_from(Rails.root).to_s
132
- end
139
+ def self.config_path
140
+ @config_path ||= Rails.root.join(entrypoint, "config")
141
+ end
133
142
 
134
- def pack_path
135
- @pack_path ||= [
136
- Rails.root.join(entrypoint, "application.js"),
137
- Rails.root.join(entrypoint, "packs/application.js"),
138
- Rails.root.join(entrypoint, "entrypoints/application.js")
139
- ].find(&:exist?)
140
- end
143
+ def self.importmap_path
144
+ @importmap_path ||= Rails.root.join("config/importmap.rb")
145
+ end
141
146
 
142
- def package_list
143
- @package_list ||= Rails.root.join("tmp/cable_ready_installer/npm_package_list")
144
- end
147
+ def self.friendly_importmap_path
148
+ @friendly_importmap_path ||= importmap_path.relative_path_from(Rails.root).to_s
149
+ end
145
150
 
146
- def dev_package_list
147
- @dev_package_list ||= Rails.root.join("tmp/cable_ready_installer/npm_dev_package_list")
148
- end
151
+ def self.pack
152
+ @pack ||= pack_path.read
153
+ end
149
154
 
150
- def drop_package_list
151
- @drop_package_list ||= Rails.root.join("tmp/cable_ready_installer/drop_npm_package_list")
152
- end
155
+ def self.friendly_pack_path
156
+ @friendly_pack_path ||= pack_path.relative_path_from(Rails.root).to_s
157
+ end
153
158
 
154
- def template_src
155
- @template_src ||= File.read("tmp/cable_ready_installer/template_src")
156
- end
159
+ def self.pack_path
160
+ @pack_path ||= [
161
+ Rails.root.join(entrypoint, "application.js"),
162
+ Rails.root.join(entrypoint, "packs/application.js"),
163
+ Rails.root.join(entrypoint, "entrypoints/application.js")
164
+ ].find(&:exist?)
165
+ end
157
166
 
158
- def controllers_path
159
- @controllers_path ||= Rails.root.join(entrypoint, "controllers")
160
- end
167
+ def self.package_list
168
+ @package_list ||= Rails.root.join("tmp/cable_ready_installer/npm_package_list")
169
+ end
161
170
 
162
- def gemfile_path
163
- @gemfile_path ||= Rails.root.join("Gemfile")
164
- end
171
+ def self.dev_package_list
172
+ @dev_package_list ||= Rails.root.join("tmp/cable_ready_installer/npm_dev_package_list")
173
+ end
165
174
 
166
- def gemfile
167
- @gemfile ||= gemfile_path.read
168
- end
175
+ def self.drop_package_list
176
+ @drop_package_list ||= Rails.root.join("tmp/cable_ready_installer/drop_npm_package_list")
177
+ end
169
178
 
170
- def prefix
171
- # standard:disable Style/RedundantStringEscape
172
- @prefix ||= {
173
- "vite" => "..\/",
174
- "webpacker" => "",
175
- "shakapacker" => "",
176
- "importmap" => "",
177
- "esbuild" => ".\/"
178
- }[bundler]
179
- # standard:enable Style/RedundantStringEscape
180
- end
179
+ def self.template_src
180
+ @template_src ||= File.read("tmp/cable_ready_installer/template_src")
181
+ end
181
182
 
182
- def application_record_path
183
- @application_record_path ||= Rails.root.join("app/models/application_record.rb")
184
- end
183
+ def self.controllers_path
184
+ @controllers_path ||= Rails.root.join(entrypoint, "controllers")
185
+ end
185
186
 
186
- def action_cable_initializer_path
187
- @action_cable_initializer_path ||= Rails.root.join("config/initializers/action_cable.rb")
188
- end
187
+ def self.gemfile_path
188
+ @gemfile_path ||= Rails.root.join("Gemfile")
189
+ end
189
190
 
190
- def action_cable_initializer_working_path
191
- @action_cable_initializer_working_path ||= Rails.root.join(working, "action_cable.rb")
192
- end
191
+ def self.gemfile
192
+ @gemfile ||= gemfile_path.read
193
+ end
193
194
 
194
- def development_path
195
- @development_path ||= Rails.root.join("config/environments/development.rb")
196
- end
195
+ def self.prefix
196
+ # standard:disable Style/RedundantStringEscape
197
+ @prefix ||= {
198
+ "vite" => "..\/",
199
+ "webpacker" => "",
200
+ "shakapacker" => "",
201
+ "importmap" => "",
202
+ "esbuild" => ".\/"
203
+ }[bundler]
204
+ # standard:enable Style/RedundantStringEscape
205
+ end
197
206
 
198
- def development_working_path
199
- @development_working_path ||= Rails.root.join(working, "development.rb")
200
- end
207
+ def self.application_record_path
208
+ @application_record_path ||= Rails.root.join("app/models/application_record.rb")
209
+ end
201
210
 
202
- def backups_path
203
- @backups_path ||= Rails.root.join("tmp/cable_ready_installer/backups")
204
- end
211
+ def self.action_cable_initializer_path
212
+ @action_cable_initializer_path ||= Rails.root.join("config/initializers/action_cable.rb")
213
+ end
205
214
 
206
- def add_gem_list
207
- @add_gem_list ||= Rails.root.join("tmp/cable_ready_installer/add_gem_list")
208
- end
215
+ def self.action_cable_initializer_working_path
216
+ @action_cable_initializer_working_path ||= Rails.root.join(working, "action_cable.rb")
217
+ end
209
218
 
210
- def remove_gem_list
211
- @remove_gem_list ||= Rails.root.join("tmp/cable_ready_installer/remove_gem_list")
212
- end
219
+ def self.development_path
220
+ @development_path ||= Rails.root.join("config/environments/development.rb")
221
+ end
213
222
 
214
- def options_path
215
- @options_path ||= Rails.root.join("tmp/cable_ready_installer/options")
216
- end
223
+ def self.development_working_path
224
+ @development_working_path ||= Rails.root.join(working, "development.rb")
225
+ end
217
226
 
218
- def options
219
- @options ||= YAML.safe_load(File.read(options_path))
220
- end
227
+ def self.backups_path
228
+ @backups_path ||= Rails.root.join("tmp/cable_ready_installer/backups")
229
+ end
230
+
231
+ def self.add_gem_list
232
+ @add_gem_list ||= Rails.root.join("tmp/cable_ready_installer/add_gem_list")
233
+ end
234
+
235
+ def self.remove_gem_list
236
+ @remove_gem_list ||= Rails.root.join("tmp/cable_ready_installer/remove_gem_list")
237
+ end
221
238
 
222
- def working
223
- @working ||= Rails.root.join("tmp/cable_ready_installer/working")
239
+ def self.options_path
240
+ @options_path ||= Rails.root.join("tmp/cable_ready_installer/options")
241
+ end
242
+
243
+ def self.options
244
+ @options ||= YAML.safe_load(File.read(options_path))
245
+ end
246
+
247
+ def self.working
248
+ @working ||= Rails.root.join("tmp/cable_ready_installer/working")
249
+ end
250
+ end
224
251
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module CableReady
4
- VERSION = "5.0.2"
4
+ VERSION = "5.0.4"
5
5
  end
@@ -6,11 +6,11 @@ require "cable_ready/installer"
6
6
  if defined?(ActionCable::Engine)
7
7
  say "✅ ActionCable::Engine is loaded and in scope"
8
8
  else
9
- halt "ActionCable::Engine is not loaded, please add or uncomment `require \"action_cable/engine\"` to your `config/application.rb`"
9
+ CableReady::Installer.halt "ActionCable::Engine is not loaded, please add or uncomment `require \"action_cable/engine\"` to your `config/application.rb`"
10
10
  return
11
11
  end
12
12
 
13
- return if pack_path_missing?
13
+ return if CableReady::Installer.pack_path_missing?
14
14
 
15
15
  # verify that the Action Cable pubsub config is created
16
16
  cable_config = Rails.root.join("config/cable.yml")
@@ -35,7 +35,7 @@ elsif yaml["development"]["adapter"] == "async"
35
35
  "url" => "<%= ENV.fetch(\"REDIS_URL\") { \"redis://localhost:6379/1\" } %>",
36
36
  "channel_prefix" => "#{app_name}_development"
37
37
  }
38
- backup(cable_config) do
38
+ CableReady::Installer.backup(cable_config) do
39
39
  cable_config.write(yaml.to_yaml)
40
40
  end
41
41
  say "✅ config/cable.yml was updated to use the redis adapter in development"
@@ -44,24 +44,24 @@ else
44
44
  end
45
45
 
46
46
  if Rails::VERSION::MAJOR >= 7
47
- add_gem "redis@~> 5"
47
+ CableReady::Installer.add_gem "redis@~> 5"
48
48
  else
49
- add_gem "redis@~> 4"
49
+ CableReady::Installer.add_gem "redis@~> 4"
50
50
  end
51
51
 
52
52
  # install action-cable-redis-backport gem if using Action Cable < 7.1
53
53
  unless ActionCable::VERSION::MAJOR >= 7 && ActionCable::VERSION::MINOR >= 1
54
- if !gemfile.match?(/gem ['"]action-cable-redis-backport['"]/)
55
- add_gem "action-cable-redis-backport@~> 1"
54
+ if !CableReady::Installer.gemfile.match?(/gem ['"]action-cable-redis-backport['"]/)
55
+ CableReady::Installer.add_gem "action-cable-redis-backport@~> 1"
56
56
  end
57
57
  end
58
58
 
59
59
  # verify that the Action Cable channels folder and consumer class is available
60
60
  step_path = "/app/javascript/channels/"
61
- channels_path = Rails.root.join(entrypoint, "channels")
62
- consumer_src = fetch(step_path, "consumer.js.tt")
61
+ channels_path = Rails.root.join(CableReady::Installer.entrypoint, "channels")
62
+ consumer_src = CableReady::Installer.fetch(step_path, "consumer.js.tt")
63
63
  consumer_path = channels_path / "consumer.js"
64
- index_src = fetch(step_path, "index.js.#{bundler}.tt")
64
+ index_src = CableReady::Installer.fetch(step_path, "index.js.#{CableReady::Installer.bundler}.tt")
65
65
  index_path = channels_path / "index.js"
66
66
  friendly_index_path = index_path.relative_path_from(Rails.root).to_s
67
67
 
@@ -73,7 +73,7 @@ if index_path.exist?
73
73
  if index_path.read == index_src.read
74
74
  say "✅ #{friendly_index_path} is present"
75
75
  else
76
- backup(index_path) do
76
+ CableReady::Installer.backup(index_path) do
77
77
  copy_file(index_src, index_path, verbose: false)
78
78
  end
79
79
  say "✅ #{friendly_index_path} has been created"
@@ -85,43 +85,43 @@ end
85
85
  # import Action Cable channels into application pack
86
86
  channels_pattern = /import ['"](\.\.\/|\.\/)?channels['"]/
87
87
  channels_commented_pattern = /\s*\/\/\s*#{channels_pattern}/
88
- channel_import = "import \"#{prefix}channels\"\n"
88
+ channel_import = "import \"#{CableReady::Installer.prefix}channels\"\n"
89
89
 
90
- if pack.match?(channels_pattern)
91
- if pack.match?(channels_commented_pattern)
92
- proceed = if options.key? "uncomment"
93
- options["uncomment"]
90
+ if CableReady::Installer.pack.match?(channels_pattern)
91
+ if CableReady::Installer.pack.match?(channels_commented_pattern)
92
+ proceed = if CableReady::Installer.options.key? "uncomment"
93
+ CableReady::Installer.options["uncomment"]
94
94
  else
95
95
  !no?("✨ Action Cable seems to be commented out in your application.js. Do you want to uncomment it? (Y/n)")
96
96
  end
97
97
 
98
98
  if proceed
99
99
  # uncomment_lines only works with Ruby comments 🙄
100
- lines = pack_path.readlines
100
+ lines = CableReady::Installer.pack_path.readlines
101
101
  matches = lines.select { |line| line =~ channels_commented_pattern }
102
102
  lines[lines.index(matches.last).to_i] = channel_import
103
- pack_path.write lines.join
104
- say "✅ channels imported in #{friendly_pack_path}"
103
+ CableReady::Installer.pack_path.write lines.join
104
+ say "✅ channels imported in #{CableReady::Installer.friendly_pack_path}"
105
105
  else
106
106
  say "🤷 your Action Cable channels are not being imported in your application.js. We trust that you have a reason for this."
107
107
  end
108
108
  else
109
- say "✅ channels imported in #{friendly_pack_path}"
109
+ say "✅ channels imported in #{CableReady::Installer.friendly_pack_path}"
110
110
  end
111
111
  else
112
- lines = pack_path.readlines
112
+ lines = CableReady::Installer.pack_path.readlines
113
113
  matches = lines.select { |line| line =~ /^import / }
114
114
  lines.insert lines.index(matches.last).to_i + 1, channel_import
115
- pack_path.write lines.join
116
- say "✅ channels imported in #{friendly_pack_path}"
115
+ CableReady::Installer.pack_path.write lines.join
116
+ say "✅ channels imported in #{CableReady::Installer.friendly_pack_path}"
117
117
  end
118
118
 
119
119
  # create working copy of Action Cable initializer in tmp
120
- if action_cable_initializer_path.exist?
121
- FileUtils.cp(action_cable_initializer_path, action_cable_initializer_working_path)
120
+ if CableReady::Installer.action_cable_initializer_path.exist?
121
+ FileUtils.cp(CableReady::Installer.action_cable_initializer_path, CableReady::Installer.action_cable_initializer_working_path)
122
122
  else
123
123
  # create Action Cable initializer if it doesn't already exist
124
- create_file(action_cable_initializer_working_path, verbose: false) do
124
+ create_file(CableReady::Installer.action_cable_initializer_working_path, verbose: false) do
125
125
  <<~RUBY
126
126
  # frozen_string_literal: true
127
127
 
@@ -131,8 +131,8 @@ else
131
131
  end
132
132
 
133
133
  # silence notoriously chatty Action Cable logs
134
- if !action_cable_initializer_working_path.read.match?(/^[^#]*ActionCable.server.config.logger/)
135
- append_file(action_cable_initializer_working_path, verbose: false) do
134
+ if !CableReady::Installer.action_cable_initializer_working_path.read.match?(/^[^#]*ActionCable.server.config.logger/)
135
+ append_file(CableReady::Installer.action_cable_initializer_working_path, verbose: false) do
136
136
  <<~RUBY
137
137
  ActionCable.server.config.logger = Logger.new(nil)
138
138
 
@@ -141,4 +141,4 @@ if !action_cable_initializer_working_path.read.match?(/^[^#]*ActionCable.server.
141
141
  say "✅ Action Cable logger silenced for performance and legibility"
142
142
  end
143
143
 
144
- complete_step :action_cable
144
+ CableReady::Installer.complete_step :action_cable