auto_reloader 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -1
- data/lib/auto_reloader.rb +13 -10
- data/lib/auto_reloader/version.rb +1 -1
- 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: 99632ea44296a699ee7b09919b575b5170664b2f
|
4
|
+
data.tar.gz: 098842b34c4c6b1e88ac52cb643b699e808cfa3d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c8828483df4f252c89d444e0a2ad5fba7e9c69b79c502a5ecf7a493046993aee31b7530bfabaeda441f5943f387d2acf161ee40b49d97688bcd4bc1ef3e2f6e1
|
7
|
+
data.tar.gz: 085e65d7b86d11b772d8c2c7ceee53c1bbf90dbc816a710d6de88a12d97effac035c4d87fcc9a5e772bbbc0f2621c675452cc8ee56f8d58dad316ff142a5543b
|
data/.travis.yml
CHANGED
data/lib/auto_reloader.rb
CHANGED
@@ -56,24 +56,27 @@ class AutoReloader
|
|
56
56
|
end
|
57
57
|
|
58
58
|
def require(path, &block)
|
59
|
-
was_required = false
|
59
|
+
was_required = error = false
|
60
60
|
@require_lock.synchronize do
|
61
61
|
@top_level_consts_stack << Set.new
|
62
62
|
old_consts = Object.constants
|
63
63
|
prev_consts = new_top_level_constants = nil
|
64
64
|
begin
|
65
65
|
was_required = yield
|
66
|
+
rescue Exception
|
67
|
+
error = true
|
66
68
|
ensure
|
67
69
|
prev_consts = @top_level_consts_stack.pop
|
68
|
-
if was_required
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
70
|
+
return false if !error && !was_required # was required already, do nothing
|
71
|
+
|
72
|
+
new_top_level_constants = Object.constants - old_consts - prev_consts.to_a
|
73
|
+
|
74
|
+
(new_top_level_constants.each{|c| safe_remove_constant c }; raise) if error
|
75
|
+
|
76
|
+
@top_level_consts_stack.each{|c| c.merge new_top_level_constants }
|
77
|
+
|
78
|
+
full_loaded_path = $LOADED_FEATURES.last
|
79
|
+
return was_required unless reloadable? full_loaded_path, path
|
77
80
|
@reload_lock.synchronize do
|
78
81
|
@unload_constants.merge new_top_level_constants
|
79
82
|
@unload_files << full_loaded_path
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: auto_reloader
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rodrigo Rosenfeld Rosas
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-08-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|