turbo-rails 0.7.14 → 0.7.15

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: b6feabeb5b9eef2fcc9032b12f9c067a2ec66408b235a02683540d182276d454
4
- data.tar.gz: 4f20ead78ccf0a8005213c864a4e3df0d82081fac933c435d367997eaf7c7d27
3
+ metadata.gz: ab24210e4f0dd28243c220d5b586b69705e2b18b50251daa22e8cd6d861fc9f5
4
+ data.tar.gz: 7379f1f27936571fe482807459f18f773c041d36ae539cd0e1750dd5ade8489b
5
5
  SHA512:
6
- metadata.gz: '015978592c5ca79dfada00ab3fa9ebceeaeb77b180af317fcf50cf29263571863e753499cab48f4baec165e7a37d438acd93b44720e206a654e8bdb644f4bd63'
7
- data.tar.gz: 2c7d3f5a342f8fd9343e494b55079628fc4e4f04e4a6728c2ef0a26e366c1c2802549da294b6025dede18827421ab1b2ac1c6f9464c0a260829a8c03c69f75b6
6
+ metadata.gz: fa92baea7d57b563f9c802e3a595a870f5c3fe38402c49720cd34908a6c396a3fcdb503fc8be035407ff3c8bdad8bcb81294fa83d81dc2e53d676de49da5cd50
7
+ data.tar.gz: b3a8d8bd0ff379e6dd40c8a41e53aa413c914c04cdf9cc2408fc1c670b3bafde13881bd4fc2a9b106e77c09ee770e61061cce8c8ddf69d0160b759995a93883e
@@ -247,7 +247,11 @@ function dispatch(eventName, {target: target, cancelable: cancelable, detail: de
247
247
  bubbles: true,
248
248
  detail: detail
249
249
  });
250
- void (target || document.documentElement).dispatchEvent(event);
250
+ if (target && target.isConnected) {
251
+ target.dispatchEvent(event);
252
+ } else {
253
+ document.documentElement.dispatchEvent(event);
254
+ }
251
255
  return event;
252
256
  }
253
257
 
@@ -2556,6 +2560,7 @@ class Session {
2556
2560
  const form = document.createElement("form");
2557
2561
  form.method = linkMethod;
2558
2562
  form.action = link.getAttribute("href") || "undefined";
2563
+ form.hidden = true;
2559
2564
  (_a = link.parentNode) === null || _a === void 0 ? void 0 : _a.insertBefore(form, link);
2560
2565
  return dispatch("submit", {
2561
2566
  cancelable: true,
@@ -1,6 +1,16 @@
1
1
  if (cable_config_path = Rails.root.join("config/cable.yml")).exist?
2
2
  say "Enable redis in bundle"
3
- uncomment_lines "Gemfile", /gem ['"]redis['"]/
3
+
4
+ gemfile_content = File.read(Rails.root.join("Gemfile"))
5
+ pattern = /gem ['"]redis['"]/
6
+
7
+ if gemfile_content.match?(pattern)
8
+ uncomment_lines "Gemfile", pattern
9
+ else
10
+ gem 'redis', '~> 4.0', comment: "Use Redis as Action Cable adapter instead of default Async. The Async adapter\ndoes not support Turbo Stream broadcasting."
11
+ end
12
+
13
+ run_bundle
4
14
 
5
15
  say "Switch development cable to use redis"
6
16
  gsub_file cable_config_path.to_s, /development:\n\s+adapter: async/, "development:\n adapter: redis\n url: redis://localhost:6379/1"
@@ -1,9 +1,9 @@
1
1
  def run_turbo_install_template(path)
2
- system "#{RbConfig.ruby} ./bin/rails app:template LOCATION=#{File.expand_path("../install/#{path}.rb", __dir__)}"
2
+ system "#{RbConfig.ruby} ./bin/rails app:template LOCATION=#{File.expand_path("../install/#{path}.rb", __dir__)}"
3
3
  end
4
4
 
5
5
  def redis_installed?
6
- system('which redis-server')
6
+ system('which redis-server > /dev/null')
7
7
  end
8
8
 
9
9
  def switch_on_redis_if_available
data/lib/turbo/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Turbo
2
- VERSION = "0.7.14"
2
+ VERSION = "0.7.15"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: turbo-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.14
4
+ version: 0.7.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam Stephenson
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2021-09-17 00:00:00.000000000 Z
13
+ date: 2021-09-23 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rails