rack-unreloader 1.4.0 → 1.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +4 -0
- data/lib/rack/unreloader/reloader.rb +23 -9
- data/spec/unreloader_spec.rb +10 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d64b1a401d4679d7a1811a008c2cc5bb951b8722
|
4
|
+
data.tar.gz: ef510ae0a796be3d5f11e9d80ba842c9f351e764
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9791a0b04d89506251c8fbe9e16cc873f33b581b6927b029b08574170e1dd850048043b97f0e6e15760b5e3961d149132c7b9f7bb4f0ca082bc2be64635b464f
|
7
|
+
data.tar.gz: a6eefba4399f58d591bb474c027eefec4bacf633641736806d9f3f13127239107ea29bc5c25e9adad173e5c80f5e2827663b669ce530e6b8a496d71230bca405
|
data/CHANGELOG
CHANGED
@@ -94,12 +94,20 @@ module Rack
|
|
94
94
|
check_monitor_dir(dir, changed_files)
|
95
95
|
end
|
96
96
|
|
97
|
-
|
98
|
-
|
99
|
-
|
97
|
+
removed_files = []
|
98
|
+
|
99
|
+
@monitor_files.to_a.each do |file, time|
|
100
|
+
if F.file?(file)
|
101
|
+
if file_changed?(file, time)
|
102
|
+
changed_files << file
|
103
|
+
end
|
104
|
+
else
|
105
|
+
removed_files << file
|
100
106
|
end
|
101
107
|
end
|
102
108
|
|
109
|
+
remove_files(removed_files)
|
110
|
+
|
103
111
|
return if changed_files.empty?
|
104
112
|
|
105
113
|
unless @dependencies.empty?
|
@@ -200,12 +208,7 @@ module Rack
|
|
200
208
|
changed_files.concat(dependency_files(removed_files))
|
201
209
|
end
|
202
210
|
|
203
|
-
removed_files
|
204
|
-
remove(f)
|
205
|
-
@monitor_files.delete(f)
|
206
|
-
@dependencies.delete(f)
|
207
|
-
@dependency_order.delete(f)
|
208
|
-
end
|
211
|
+
remove_files(removed_files)
|
209
212
|
|
210
213
|
require_dependencies(new_files, &block)
|
211
214
|
|
@@ -222,6 +225,17 @@ module Rack
|
|
222
225
|
files.replace(cur_files)
|
223
226
|
end
|
224
227
|
|
228
|
+
# Remove all files in removed_files from the internal data structures,
|
229
|
+
# because the file no longer exists.
|
230
|
+
def remove_files(removed_files)
|
231
|
+
removed_files.each do |f|
|
232
|
+
remove(f)
|
233
|
+
@monitor_files.delete(f)
|
234
|
+
@dependencies.delete(f)
|
235
|
+
@dependency_order.delete(f)
|
236
|
+
end
|
237
|
+
end
|
238
|
+
|
225
239
|
# Requires the given file, logging which constants or features are added
|
226
240
|
# by the require, and rolling back the constants and features if there
|
227
241
|
# are any errors.
|
data/spec/unreloader_spec.rb
CHANGED
@@ -100,6 +100,16 @@ describe Rack::Unreloader do
|
|
100
100
|
%r{\ANew classes in .*spec/app\.rb: App\z}
|
101
101
|
end
|
102
102
|
|
103
|
+
it "should stop monitoring file for changes if it is deleted constants contained in file and reload file if file changes" do
|
104
|
+
ru.call({}).must_equal [1]
|
105
|
+
File.delete('spec/app.rb')
|
106
|
+
proc{ru.call({})}.must_raise NameError
|
107
|
+
log_match %r{\ALoading.*spec/app\.rb\z},
|
108
|
+
%r{\ANew classes in .*spec/app\.rb: App\z},
|
109
|
+
%r{\AUnloading.*spec/app\.rb\z},
|
110
|
+
"Removed constant App"
|
111
|
+
end
|
112
|
+
|
103
113
|
it "should check constants using ObjectSpace if require proc returns :ObjectSpace" do
|
104
114
|
base_ru
|
105
115
|
update_app(code(1))
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack-unreloader
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeremy Evans
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-03-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|