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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5a549346a2a0e4f7ca92805c4a632cb3a7e1dab47ba77f2f33fc470f202f89ef
4
- data.tar.gz: 01de6b58b7d4a265714ca4ff668b8a579601517dc434279367d101fa058f7641
3
+ metadata.gz: 3fafdcbb8509b000d033c3917dbde0fc0277948090d8eb5d6da0469ba8da7eae
4
+ data.tar.gz: 4680dc48e1158dcc87fca9e6a8694209d6c06a8742121b70f1d8e70514ec4f20
5
5
  SHA512:
6
- metadata.gz: f42175a8c4726873851f901aebce71b4df2b60550735ccca0252bb548b9c183c8be73e66b746fd64531bd86feef20e1798e38f144194a67832b92061d2ffc6c1
7
- data.tar.gz: 81ec91c72c4af89016f35034028ef83a745a225321567d0d866ff914bb8580c45743f678907b7a3b712129eef5b9fbff807767b8b5f46f1f7f24fbcf3845925d
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? && defined?(Rails::Server)
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.exists?(DISABLE_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('hotwire-livereload',
85
- target: 'hotwire-livereload',
86
- partial: 'hotwire/livereload/turbo_stream',
87
- locals: locals)
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
@@ -1,5 +1,5 @@
1
1
  module Hotwire
2
2
  module Livereload
3
- VERSION = "1.2.1"
3
+ VERSION = "1.2.3"
4
4
  end
5
5
  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.1
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-07-27 00:00:00.000000000 Z
11
+ date: 2022-12-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails