rails_live_reload 0.4.0 → 0.5.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 +4 -4
- data/README.md +5 -4
- data/lib/generators/templates/rails_live_reload.rb +3 -0
- data/lib/rails_live_reload/config.rb +11 -1
- data/lib/rails_live_reload/version.rb +1 -1
- data/lib/rails_live_reload/watcher.rb +8 -1
- metadata +3 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1f3623d0079c16a21e2b52a6c54e554c7acc9fa24abc25b503bd155ef1370b06
|
4
|
+
data.tar.gz: e2319b7fc9e036246a7f93c5cfba1d08447975c9d0f848fb7336b19050c1898d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6d17d66422af418d7cdfc506de8c92276df44e3ba5361b25522d5ade8324cf2fddf041f06026ef939f3ef3801f2b943c58a85e8f2d686ebc5bec0c9f23eac53d
|
7
|
+
data.tar.gz: 5fdb4bfc1a17a817a2606654501b7389dd044f83624d8f923efc2794e5aa12115661efa4aa35f4851bb2a6f7f3b123a5c983a045be53e66e4684651f9fc6a3c6
|
data/README.md
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
# Rails Live Reload
|
2
2
|
|
3
3
|
[](https://www.railsjazz.com)
|
4
|
-
|
4
|
+
|
5
|
+
[](https://buymeacoffee.com/igorkasyanchuk)
|
5
6
|
|
6
7
|

|
7
8
|
|
@@ -66,9 +67,6 @@ The default configuration assumes that you either use asset pipeline, or that yo
|
|
66
67
|
|
67
68
|
You are welcome to contribute. See list of `TODO's` below.
|
68
69
|
|
69
|
-
[<img src="https://opensource-heroes.com/svg/embed/railsjazz/rails_live_reload"
|
70
|
-
/>](https://opensource-heroes.com/svg/embed/railsjazz/rails_live_reload)
|
71
|
-
|
72
70
|
## TODO
|
73
71
|
|
74
72
|
- reload CSS without reloading the whole page?
|
@@ -90,3 +88,6 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
90
88
|
|
91
89
|
[<img src="https://github.com/igorkasyanchuk/rails_time_travel/blob/main/docs/more_gems.png?raw=true"
|
92
90
|
/>](https://www.railsjazz.com/?utm_source=github&utm_medium=bottom&utm_campaign=rails_live_reload)
|
91
|
+
|
92
|
+
|
93
|
+
[](https://buymeacoffee.com/igorkasyanchuk)
|
@@ -11,5 +11,8 @@ RailsLiveReload.configure do |config|
|
|
11
11
|
# config.watch %r{app/helpers/.+\.rb}, reload: :always
|
12
12
|
# config.watch %r{config/locales/.+\.yml}, reload: :always
|
13
13
|
|
14
|
+
# Ignored folders & files
|
15
|
+
# config.ignore %r{node_modules/}
|
16
|
+
|
14
17
|
# config.enabled = Rails.env.development?
|
15
18
|
end if defined?(RailsLiveReload)
|
@@ -12,13 +12,17 @@ module RailsLiveReload
|
|
12
12
|
config.patterns
|
13
13
|
end
|
14
14
|
|
15
|
+
def ignore_patterns
|
16
|
+
config.ignore_patterns
|
17
|
+
end
|
18
|
+
|
15
19
|
def enabled?
|
16
20
|
config.enabled
|
17
21
|
end
|
18
22
|
end
|
19
23
|
|
20
24
|
class Config
|
21
|
-
attr_reader :patterns
|
25
|
+
attr_reader :patterns, :ignore_patterns
|
22
26
|
attr_accessor :url, :watcher, :files, :enabled
|
23
27
|
|
24
28
|
def initialize
|
@@ -33,6 +37,8 @@ module RailsLiveReload
|
|
33
37
|
%r{(app|vendor)/(assets|javascript)/\w+/(.+\.(css|js|html|png|jpg|ts|jsx)).*} => :always
|
34
38
|
}
|
35
39
|
@default_patterns_changed = false
|
40
|
+
|
41
|
+
@ignore_patterns = []
|
36
42
|
end
|
37
43
|
|
38
44
|
def root_path
|
@@ -48,6 +54,10 @@ module RailsLiveReload
|
|
48
54
|
patterns[pattern] = reload
|
49
55
|
end
|
50
56
|
|
57
|
+
def ignore(pattern)
|
58
|
+
@ignore_patterns << pattern
|
59
|
+
end
|
60
|
+
|
51
61
|
def socket_path
|
52
62
|
root_path.join('tmp/sockets/rails_live_reload.sock').then do |path|
|
53
63
|
break path if path.to_s.size <= 104 # 104 is the max length of a socket path
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require "fileutils"
|
2
|
+
|
1
3
|
module RailsLiveReload
|
2
4
|
class Watcher
|
3
5
|
attr_reader :files, :sockets
|
@@ -21,13 +23,14 @@ module RailsLiveReload
|
|
21
23
|
end
|
22
24
|
|
23
25
|
build_tree
|
26
|
+
create_socket_directory
|
24
27
|
start_socket
|
25
28
|
start_listener
|
26
29
|
end
|
27
30
|
|
28
31
|
def start_listener
|
29
32
|
Thread.new do
|
30
|
-
listener = Listen.to(root) do |modified, added, removed|
|
33
|
+
listener = Listen.to(root, ignore: RailsLiveReload.ignore_patterns) do |modified, added, removed|
|
31
34
|
all = modified + added + removed
|
32
35
|
all.each do |file|
|
33
36
|
files[file] = File.mtime(file).to_i rescue nil
|
@@ -55,6 +58,10 @@ module RailsLiveReload
|
|
55
58
|
end
|
56
59
|
end
|
57
60
|
|
61
|
+
def create_socket_directory
|
62
|
+
FileUtils.mkdir_p File.dirname(RailsLiveReload.config.socket_path)
|
63
|
+
end
|
64
|
+
|
58
65
|
def start_socket
|
59
66
|
Thread.new do
|
60
67
|
Socket.unix_server_socket(RailsLiveReload.config.socket_path.to_s) do |sock|
|
metadata
CHANGED
@@ -1,15 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_live_reload
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Igor Kasyanchuk
|
8
8
|
- Liubomyr Manastyretskyi
|
9
|
-
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2025-05-28 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: railties
|
@@ -118,7 +117,6 @@ homepage: https://github.com/railsjazz/rails_live_reload
|
|
118
117
|
licenses:
|
119
118
|
- MIT
|
120
119
|
metadata: {}
|
121
|
-
post_install_message:
|
122
120
|
rdoc_options: []
|
123
121
|
require_paths:
|
124
122
|
- lib
|
@@ -133,8 +131,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
133
131
|
- !ruby/object:Gem::Version
|
134
132
|
version: '0'
|
135
133
|
requirements: []
|
136
|
-
rubygems_version: 3.
|
137
|
-
signing_key:
|
134
|
+
rubygems_version: 3.6.3
|
138
135
|
specification_version: 4
|
139
136
|
summary: Ruby on Rails Live Reload
|
140
137
|
test_files: []
|