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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: feb71c3d0ec8e2a360b148d65768c855f37ce7b5
4
- data.tar.gz: 91ea374ea7eeeacf2b94ae520fc550521db55aca
3
+ metadata.gz: 99632ea44296a699ee7b09919b575b5170664b2f
4
+ data.tar.gz: 098842b34c4c6b1e88ac52cb643b699e808cfa3d
5
5
  SHA512:
6
- metadata.gz: b8763aad06e1b64d02921ed6565151bf4335c5dfc590e000215993ecc8f82c44dae50e98c95af474b71b47727419a7592d51c91250b496465c12894ea5566cc5
7
- data.tar.gz: ac7e93fbfa390bc686dd5cea7bf8b4dc0adc71e3b3062cf791af493bba4d98eeec8c572946c32d38adc948a478d9f943d64d7a80ab204161e4d90a30a7e89520
6
+ metadata.gz: c8828483df4f252c89d444e0a2ad5fba7e9c69b79c502a5ecf7a493046993aee31b7530bfabaeda441f5943f387d2acf161ee40b49d97688bcd4bc1ef3e2f6e1
7
+ data.tar.gz: 085e65d7b86d11b772d8c2c7ceee53c1bbf90dbc816a710d6de88a12d97effac035c4d87fcc9a5e772bbbc0f2621c675452cc8ee56f8d58dad316ff142a5543b
data/.travis.yml CHANGED
@@ -4,4 +4,4 @@ rvm:
4
4
  - jruby-9.1.2.0
5
5
  before_install: gem install bundler -v 1.11.2
6
6
  env:
7
- - WATCH_SLEEP_TIME=3
7
+ - SKIP_WATCH=1
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
- new_top_level_constants = Object.constants - old_consts - prev_consts.to_a
70
- @top_level_consts_stack.each{|c| c.merge new_top_level_constants }
71
- end
72
- end
73
- return false unless was_required # was required already, do nothing
74
- full_loaded_path = $LOADED_FEATURES.last
75
- reloadable = reloadable?(full_loaded_path, path)
76
- if reloadable
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
@@ -1,3 +1,3 @@
1
1
  class AutoReloader
2
- VERSION = '0.2.2'
2
+ VERSION = '0.2.3'
3
3
  end
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.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-07-20 00:00:00.000000000 Z
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