hotwire-livereload 1.2.1 → 1.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/hotwire/livereload/engine.rb +15 -6
- data/lib/hotwire/livereload/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3fafdcbb8509b000d033c3917dbde0fc0277948090d8eb5d6da0469ba8da7eae
|
4
|
+
data.tar.gz: 4680dc48e1158dcc87fca9e6a8694209d6c06a8742121b70f1d8e70514ec4f20
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b002ac0a2bb344aedc2b4085b7360004b26557082a90e2d1bbb0dd12978384a89be84319a991949890c9a8fa0a6bf118051674be6e49dd8e8834c7b6ff823a0f
|
7
|
+
data.tar.gz: 442258d2370585623836bf19f9bb88f334fc9bb54c80b5c233969e536cfb99cf1296d95fc5a2cb1413628cf5e7128db938865903385be33d385c6380d510f612
|
@@ -47,13 +47,13 @@ module Hotwire
|
|
47
47
|
end
|
48
48
|
|
49
49
|
config.after_initialize do |app|
|
50
|
-
if Rails.env.development? &&
|
50
|
+
if Rails.env.development? && Hotwire::Livereload.server_process?
|
51
51
|
options = app.config.hotwire_livereload
|
52
52
|
listen_paths = options.listen_paths.map(&:to_s).uniq
|
53
53
|
force_reload_paths = options.force_reload_paths.map(&:to_s).uniq.join("|")
|
54
54
|
|
55
55
|
@listener = Listen.to(*listen_paths) do |modified, added, removed|
|
56
|
-
unless File.
|
56
|
+
unless File.exist?(DISABLE_FILE)
|
57
57
|
changed = [modified, removed, added].flatten.uniq
|
58
58
|
return unless changed.any?
|
59
59
|
|
@@ -81,14 +81,23 @@ module Hotwire
|
|
81
81
|
end
|
82
82
|
|
83
83
|
def self.turbo_stream(locals)
|
84
|
-
Turbo::StreamsChannel.broadcast_replace_to(
|
85
|
-
|
86
|
-
|
87
|
-
|
84
|
+
Turbo::StreamsChannel.broadcast_replace_to(
|
85
|
+
"hotwire-livereload",
|
86
|
+
target: "hotwire-livereload",
|
87
|
+
partial: "hotwire/livereload/turbo_stream",
|
88
|
+
locals: locals
|
89
|
+
)
|
88
90
|
end
|
89
91
|
|
90
92
|
def self.action_cable(opts)
|
91
93
|
ActionCable.server.broadcast("hotwire-reload", opts)
|
92
94
|
end
|
95
|
+
|
96
|
+
def self.server_process?
|
97
|
+
puma_process = defined?(::Puma) && File.basename($0) == "puma"
|
98
|
+
rails_server = defined?(Rails::Server)
|
99
|
+
|
100
|
+
puma_process || rails_server
|
101
|
+
end
|
93
102
|
end
|
94
103
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hotwire-livereload
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kirill Platonov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-12-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|