voidable-hotwire 0.6.0 → 0.7.0

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: 59c7b2cc1d547ce69e4a1e1c2ac846ec6edbd2cd19073a85fa55344f3ebb6068
4
- data.tar.gz: 560fadb3f3418b0de825ddf510f8d45e27cc0f5e5ca55a5be9637d910d2f6336
3
+ metadata.gz: 64213f6a889487e4b5847bd5460791fa641009c2d24f848a5abc4c905c94b93b
4
+ data.tar.gz: 7659fd6e398f7844536a6ea355206afdcf4d29d9ff2a804c1275e3176e127405
5
5
  SHA512:
6
- metadata.gz: 8047f63314accf8dbb84d088543ec9e118baaeb245ad3e2b8af860bb57340d379ef9a9296947565c73307b60db75fc3115efdbd1ae4068aae54c0c173fee633f
7
- data.tar.gz: c9fa0a2593164ca0a92dbaf6c0b39c17b51ec3775bf86a3f2a1927d347e6714f17c20d8576435cb68142b66823e6602a73c6664c4db7d034bb9038cbc6be848c
6
+ metadata.gz: abf7e3352ce595eec8041d4cfdbf6b9de49efb43cd645e564399e388be68426631a3e2f80c2a09ac32670cc367cddad5864d0915544303eb2aff063cb8ea23f3
7
+ data.tar.gz: bea1ceac3fb0bf644181e3c70188b2fec07429379fe968f44b537b3eb24151d9bdc065b91f9a7154cec8faab7f7e1fc665a1dbf713759ef637b4fea2d5c527bb
@@ -145,9 +145,34 @@ module Voidable
145
145
  imports += "\nimport \"./voidable-layout.js\";"
146
146
  append_to_file js_entrypoint, "\n#{imports}\n"
147
147
  end
148
+ if vite? && !contents.include?("VoidEventController")
149
+ append_to_file js_entrypoint, <<~JS
150
+
151
+ import { VoidEventController, VoidTurbo } from "@voidable/ui-hotwire";
152
+ const app = Application.start();
153
+ app.register("void-event", VoidEventController);
154
+ VoidTurbo.start();
155
+ JS
156
+ end
148
157
  say "Added Voidable imports to application.js", :green
149
158
  end
150
159
 
160
+ def wire_stimulus_controllers
161
+ return if vite?
162
+ controllers_js = "app/javascript/controllers/application.js"
163
+ return unless File.exist?(controllers_js)
164
+ return if File.read(controllers_js).include?("VoidEventController")
165
+ inject_into_file controllers_js, after: /window\.Stimulus\s*=\s*application\n/ do
166
+ <<~JS
167
+
168
+ import { VoidEventController, VoidTurbo } from "@voidable/ui-hotwire"
169
+ application.register("void-event", VoidEventController)
170
+ VoidTurbo.start()
171
+ JS
172
+ end
173
+ say "Registered VoidEventController and started VoidTurbo in controllers/application.js", :green
174
+ end
175
+
151
176
  def create_vite_helper
152
177
  return unless vite?
153
178
  template "vite_helper.rb.tt", "app/helpers/vite_helper.rb"
@@ -185,6 +210,12 @@ module Voidable
185
210
  say "", :yellow
186
211
  end
187
212
  end
213
+
214
+ def install_active_storage
215
+ return if File.exist?("db/migrate") && Dir.glob("db/migrate/*active_storage*").any?
216
+ rails_command "active_storage:install"
217
+ say "Installed Active Storage migrations (run `bin/rails db:migrate` to apply)", :green
218
+ end
188
219
  end
189
220
  end
190
221
  end
@@ -1,5 +1,5 @@
1
1
  module Voidable
2
2
  module Hotwire
3
- VERSION = "0.6.0"
3
+ VERSION = "0.7.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: voidable-hotwire
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kaz Walker