rack-unreloader 1.3.0 → 1.4.0

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: 1c8f1734dc2b5c882473017b36c57ebd8ec83ce9
4
- data.tar.gz: 77139686abfd0970924657fd236717be42b70da5
3
+ metadata.gz: d9318a0edd80ea0c0bae830750c33a607ef0146a
4
+ data.tar.gz: d85653f1770a69dcde0e4c15dd32db9b43ff8686
5
5
  SHA512:
6
- metadata.gz: 15eb8fac861e37af6c853b115ab64c38d0ec270273fb13a09f0aa72fc94fe5007b884541f6c5732de1146564342a8b69d05435f22fd076c2fdd842564ebf22b7
7
- data.tar.gz: b43aad4ee73d6218cad149d523aaa1e1f086bb7020719b78ec7b14e028e4f8530fb4c8e90429a3463344737f4dc4d6332431eecbd6e13d4cbec911f836a00c8c
6
+ metadata.gz: ac585d0650959361e75a940f12b677062247ae88c9bc8811146e1808183abb907465ffc786dfffb98372ae9aaac4f5d578dd140d762c39b10ac9d76c51caf6f7
7
+ data.tar.gz: 299ffb392c1d525c8037855f353209669bf06fca106af0b745fda6b84175d3f60d8e2cc3e0de0e6e8ed22a5e22bf36756678d47015a7969f62b0c214a97a88ab
data/CHANGELOG CHANGED
@@ -1,3 +1,7 @@
1
+ = 1.4.0 (2016-01-15)
2
+
3
+ * Avoid use of Thread.exclusive, preventing warnings on ruby 2.3 (celsworth, jeremyevans) (#6)
4
+
1
5
  = 1.3.0 (2015-04-06)
2
6
 
3
7
  * Log when specified constant exists before loading file or does not exist after loading (jeremyevans)
@@ -50,14 +50,14 @@ constants, as it will unload those constants first. This is why the example
50
50
  code requires the +roda+ library normally before requiring +app.rb+ using
51
51
  <tt>Rack::Unreloader</tt>.
52
52
 
53
- However, if +app.rb+ requires more than a single file, it is more
53
+ However, if +app.rb+ requires more than a single file, it is more
54
54
  practical to tell <tt>Rack::Unreloader</tt> to only unload specific subclasses:
55
55
 
56
56
  require 'rack/unreloader'
57
57
  Unreloader = Rack::Unreloader.new(:subclasses=>%w'Roda'){App}
58
58
  Unreloader.require './app.rb'
59
59
  run Unreloader
60
-
60
+
61
61
  When the +:subclasses+ option is given, only subclasses of the given classes
62
62
  will be unloaded before reloading the file. It is recommended that
63
63
  you use a +:subclasses+ option when using <tt>Rack::Unreloader</tt>.
@@ -133,14 +133,14 @@ module or superclass.
133
133
 
134
134
  You can specify the file dependencies when using rack-unreloader:
135
135
 
136
- Unreload.record_dependency('lib/module_file.rb', %w'models/mod1.rb models/mod2.rb')
136
+ Unreloader.record_dependency('lib/module_file.rb', %w'models/mod1.rb models/mod2.rb')
137
137
 
138
138
  If lib/module_file.rb is changed, rack-unreloader will reload models/mod1.rb
139
139
  and models/mod2.rb after reloading lib/module_file.rb.
140
140
 
141
141
  You can provide directories when requiring dependencies. For example:
142
142
 
143
- Unreload.record_dependency('helpers', %w'app.rb')
143
+ Unreloader.record_dependency('helpers', %w'app.rb')
144
144
 
145
145
  will make it so the addition of any ruby files to the helpers directory
146
146
  will trigger a reload of +app.rb+, and future changes to any of those files
@@ -149,7 +149,7 @@ in the helpers directory will also trigger a reload of +app.rb+.
149
149
 
150
150
  You can also use a directory as the second argument:
151
151
 
152
- Unreload.record_dependency('mod.rb', 'models')
152
+ Unreloader.record_dependency('mod.rb', 'models')
153
153
 
154
154
  With this, any change to +mod.rb+ will trigger a reload of all ruby files in
155
155
  the models directory, even if such files are added later.
data/Rakefile CHANGED
@@ -10,37 +10,13 @@ end
10
10
 
11
11
  ### Specs
12
12
 
13
- begin
14
- begin
15
- raise LoadError if ENV['RSPEC1']
16
- # RSpec 2
17
- require "rspec/core/rake_task"
18
- spec_class = RSpec::Core::RakeTask
19
- spec_files_meth = :pattern=
20
- rescue LoadError
21
- # RSpec 1
22
- require "spec/rake/spectask"
23
- spec_class = Spec::Rake::SpecTask
24
- spec_files_meth = :spec_files=
25
- end
26
-
27
- spec = lambda do |name, files, d|
28
- lib_dir = File.join(File.dirname(File.expand_path(__FILE__)), 'lib')
29
- ENV['RUBYLIB'] ? (ENV['RUBYLIB'] += ":#{lib_dir}") : (ENV['RUBYLIB'] = lib_dir)
30
- desc d
31
- spec_class.new(name) do |t|
32
- t.send(spec_files_meth, files)
33
- end
34
- end
35
-
36
- task :default => [:spec]
37
- spec.call("spec", Dir["spec/*_spec.rb"], "Run specs")
38
- rescue LoadError
39
- task :default do
40
- puts "Must install rspec to run the default task (which runs specs)"
41
- end
13
+ desc "Run specs"
14
+ task :spec do
15
+ sh "#{FileUtils::RUBY} -rubygems -I lib spec/unreloader_spec.rb"
42
16
  end
43
17
 
18
+ task :default => :spec
19
+
44
20
  ### RDoc
45
21
 
46
22
  RDOC_DEFAULT_OPTS = ["--quiet", "--line-numbers", "--inline-source", '--title', 'Rack::Unreloader: Reload application when files change, unloading constants first']
@@ -1,9 +1,13 @@
1
1
  require 'find'
2
+ require 'monitor'
2
3
 
3
4
  module Rack
4
5
  # Reloading application that unloads constants before reloading the relevant
5
6
  # files, calling the new rack app if it gets reloaded.
6
7
  class Unreloader
8
+ # Mutex used to synchronize reloads
9
+ MUTEX = Monitor.new
10
+
7
11
  # Reference to ::File as File would return Rack::File by default.
8
12
  F = ::File
9
13
 
@@ -67,7 +71,7 @@ module Rack
67
71
  # Call the app with the environment.
68
72
  def call(env)
69
73
  if @cooldown && Time.now > @last + @cooldown
70
- Thread.respond_to?(:exclusive) ? Thread.exclusive{reload!} : reload!
74
+ MUTEX.synchronize{reload!}
71
75
  @last = Time.now
72
76
  end
73
77
  @app_block.call.call(env)
@@ -1,15 +1,7 @@
1
1
  require File.join(File.dirname(File.expand_path(__FILE__)), '../lib/rack/unreloader')
2
-
3
- if defined?(RSpec)
4
- require 'rspec/version'
5
- if RSpec::Version::STRING >= '2.11.0'
6
- RSpec.configure do |config|
7
- config.expect_with :rspec do |c|
8
- c.syntax = :should
9
- end
10
- end
11
- end
12
- end
2
+ gem 'minitest'
3
+ require 'minitest/autorun'
4
+ require 'minitest/hooks'
13
5
 
14
6
  module ModifiedAt
15
7
  def set_modified_time(file, time)
@@ -62,8 +54,8 @@ describe Rack::Unreloader do
62
54
  end
63
55
 
64
56
  def log_match(*logs)
65
- @logger.length.should == logs.length
66
- logs.zip(@logger).each{|l, log| l.is_a?(String) ? log.should == l : log.should =~ l}
57
+ @logger.length.must_equal logs.length
58
+ logs.zip(@logger).each{|l, log| l.is_a?(String) ? log.must_equal(l) : log.must_match(l)}
67
59
  end
68
60
 
69
61
  before do
@@ -80,26 +72,26 @@ describe Rack::Unreloader do
80
72
  end
81
73
 
82
74
  it "should not reload files automatically if cooldown option is nil" do
83
- ru(:cooldown => nil).call({}).should == [1]
75
+ ru(:cooldown => nil).call({}).must_equal [1]
84
76
  update_app(code(2))
85
- ru.call({}).should == [1]
77
+ ru.call({}).must_equal [1]
86
78
  @ru.reload!
87
- ru.call({}).should == [2]
79
+ ru.call({}).must_equal [2]
88
80
  end
89
81
 
90
82
  it "should not setup a reloader if reload option is false" do
91
83
  @filename = 'spec/app_no_reload.rb'
92
- ru(:reload => false).call({}).should == [1]
84
+ ru(:reload => false).call({}).must_equal [1]
93
85
  file = 'spec/app_no_reload2.rb'
94
86
  File.open(file, 'wb'){|f| f.write('ANR2 = 2')}
95
87
  ru.require 'spec/app_no_*2.rb'
96
- ANR2.should == 2
88
+ ANR2.must_equal 2
97
89
  end
98
90
 
99
91
  it "should unload constants contained in file and reload file if file changes" do
100
- ru.call({}).should == [1]
92
+ ru.call({}).must_equal [1]
101
93
  update_app(code(2))
102
- ru.call({}).should == [2]
94
+ ru.call({}).must_equal [2]
103
95
  log_match %r{\ALoading.*spec/app\.rb\z},
104
96
  %r{\ANew classes in .*spec/app\.rb: App\z},
105
97
  %r{\AUnloading.*spec/app\.rb\z},
@@ -112,9 +104,9 @@ describe Rack::Unreloader do
112
104
  base_ru
113
105
  update_app(code(1))
114
106
  @ru.require(@filename){|f| :ObjectSpace}
115
- ru.call({}).should == [1]
107
+ ru.call({}).must_equal [1]
116
108
  update_app(code(2))
117
- ru.call({}).should == [2]
109
+ ru.call({}).must_equal [2]
118
110
  log_match %r{\ALoading.*spec/app\.rb\z},
119
111
  %r{\ANew classes in .*spec/app\.rb: App\z},
120
112
  %r{\AUnloading.*spec/app\.rb\z},
@@ -124,12 +116,12 @@ describe Rack::Unreloader do
124
116
  end
125
117
 
126
118
  it "should pickup files added as dependencies" do
127
- ru.call({}).should == [1]
119
+ ru.call({}).must_equal [1]
128
120
  update_app("RU.require 'spec/app2.rb'; class App; def self.call(env) [@a, App2.call(env)] end; @a ||= []; @a << 2; end")
129
121
  update_app("class App2; def self.call(env) @a end; @a ||= []; @a << 3; end", 'spec/app2.rb')
130
- ru.call({}).should == [[2], [3]]
122
+ ru.call({}).must_equal [[2], [3]]
131
123
  update_app("class App2; def self.call(env) @a end; @a ||= []; @a << 4; end", 'spec/app2.rb')
132
- ru.call({}).should == [[2], [4]]
124
+ ru.call({}).must_equal [[2], [4]]
133
125
  log_match %r{\ALoading.*spec/app\.rb\z},
134
126
  %r{\ANew classes in .*spec/app\.rb: App\z},
135
127
  %r{\AUnloading.*spec/app\.rb\z},
@@ -146,12 +138,12 @@ describe Rack::Unreloader do
146
138
  end
147
139
 
148
140
  it "should support :subclasses option and only unload subclasses of given class" do
149
- ru(:subclasses=>'App').call({}).should == [1]
141
+ ru(:subclasses=>'App').call({}).must_equal [1]
150
142
  update_app("RU.require 'spec/app2.rb'; class App; def self.call(env) [@a, App2.call(env)] end; @a ||= []; @a << 2; end")
151
143
  update_app("class App2 < App; def self.call(env) @a end; @a ||= []; @a << 3; end", 'spec/app2.rb')
152
- ru.call({}).should == [[1, 2], [3]]
144
+ ru.call({}).must_equal [[1, 2], [3]]
153
145
  update_app("class App2 < App; def self.call(env) @a end; @a ||= []; @a << 4; end", 'spec/app2.rb')
154
- ru.call({}).should == [[1, 2], [4]]
146
+ ru.call({}).must_equal [[1, 2], [4]]
155
147
  update_app("RU.require 'spec/app2.rb'; class App; def self.call(env) [@a, App2.call(env)] end; @a ||= []; @a << 2; end")
156
148
  log_match %r{\ALoading.*spec/app\.rb\z},
157
149
  %r{\AUnloading.*spec/app\.rb\z},
@@ -167,7 +159,7 @@ describe Rack::Unreloader do
167
159
  end
168
160
 
169
161
  it "should log invalid constant names in :subclasses options" do
170
- ru(:subclasses=>%w'1 Object').call({}).should == [1]
162
+ ru(:subclasses=>%w'1 Object').call({}).must_equal [1]
171
163
  logger.uniq!
172
164
  log_match 'Invalid constant name: 1',
173
165
  %r{\ALoading.*spec/app\.rb\z},
@@ -175,9 +167,9 @@ describe Rack::Unreloader do
175
167
  end
176
168
 
177
169
  it "should unload modules before reloading similar to classes" do
178
- ru(:code=>"module App; def self.call(env) @a end; @a ||= []; @a << 1; end").call({}).should == [1]
170
+ ru(:code=>"module App; def self.call(env) @a end; @a ||= []; @a << 1; end").call({}).must_equal [1]
179
171
  update_app("module App; def self.call(env) @a end; @a ||= []; @a << 2; end")
180
- ru.call({}).should == [2]
172
+ ru.call({}).must_equal [2]
181
173
  log_match %r{\ALoading.*spec/app\.rb\z},
182
174
  %r{\ANew classes in .*spec/app\.rb: App\z},
183
175
  %r{\AUnloading.*spec/app\.rb\z},
@@ -187,9 +179,9 @@ describe Rack::Unreloader do
187
179
  end
188
180
 
189
181
  it "should unload specific modules by name via :subclasses option" do
190
- ru(:subclasses=>'App', :code=>"module App; def self.call(env) @a end; @a ||= []; @a << 1; end").call({}).should == [1]
182
+ ru(:subclasses=>'App', :code=>"module App; def self.call(env) @a end; @a ||= []; @a << 1; end").call({}).must_equal [1]
191
183
  update_app("module App; def self.call(env) @a end; @a ||= []; @a << 2; end")
192
- ru.call({}).should == [2]
184
+ ru.call({}).must_equal [2]
193
185
  log_match %r{\ALoading.*spec/app\.rb\z},
194
186
  %r{\ANew classes in .*spec/app\.rb: App\z},
195
187
  %r{\AUnloading.*spec/app\.rb\z},
@@ -199,21 +191,21 @@ describe Rack::Unreloader do
199
191
  end
200
192
 
201
193
  it "should not unload modules by name if :subclasses option used and module not present" do
202
- ru(:subclasses=>'Foo', :code=>"module App; def self.call(env) @a end; @a ||= []; @a << 1; end").call({}).should == [1]
194
+ ru(:subclasses=>'Foo', :code=>"module App; def self.call(env) @a end; @a ||= []; @a << 1; end").call({}).must_equal [1]
203
195
  update_app("module App; def self.call(env) @a end; @a ||= []; @a << 2; end")
204
- ru.call({}).should == [1, 2]
196
+ ru.call({}).must_equal [1, 2]
205
197
  log_match %r{\ALoading.*spec/app\.rb\z},
206
198
  %r{\AUnloading.*spec/app\.rb\z},
207
199
  %r{\ALoading.*spec/app\.rb\z}
208
200
  end
209
201
 
210
202
  it "should unload partially loaded modules if loading fails, and allow future loading" do
211
- ru.call({}).should == [1]
203
+ ru.call({}).must_equal [1]
212
204
  update_app("module App; def self.call(env) @a end; @a ||= []; raise 'foo'; end")
213
- proc{ru.call({})}.should raise_error
214
- defined?(::App).should == nil
205
+ proc{ru.call({})}.must_raise RuntimeError
206
+ defined?(::App).must_equal nil
215
207
  update_app(code(2))
216
- ru.call({}).should == [2]
208
+ ru.call({}).must_equal [2]
217
209
  log_match %r{\ALoading.*spec/app\.rb\z},
218
210
  %r{\ANew classes in .*spec/app\.rb: App\z},
219
211
  %r{\AUnloading.*spec/app\.rb\z},
@@ -226,9 +218,9 @@ describe Rack::Unreloader do
226
218
  end
227
219
 
228
220
  it "should unload classes in namespaces" do
229
- ru(:code=>"class Array::App; def self.call(env) @a end; @a ||= []; @a << 1; end", :block=>proc{Array::App}).call({}).should == [1]
221
+ ru(:code=>"class Array::App; def self.call(env) @a end; @a ||= []; @a << 1; end", :block=>proc{Array::App}).call({}).must_equal [1]
230
222
  update_app("class Array::App; def self.call(env) @a end; @a ||= []; @a << 2; end")
231
- ru.call({}).should == [2]
223
+ ru.call({}).must_equal [2]
232
224
  log_match %r{\ALoading.*spec/app\.rb\z},
233
225
  %r{\ANew classes in .*spec/app\.rb: Array::App\z},
234
226
  %r{\AUnloading.*spec/app\.rb\z},
@@ -242,11 +234,11 @@ describe Rack::Unreloader do
242
234
  update_app("class App; def self.call(env) @a end; @a ||= []; @a << 2; RU.require 'spec/app2.rb'; end")
243
235
  update_app("class App; @a << 3 end", 'spec/app2.rb')
244
236
  @ru.require 'spec/app.rb'
245
- ru.call({}).should == [2, 3]
237
+ ru.call({}).must_equal [2, 3]
246
238
  update_app("class App; @a << 4 end", 'spec/app2.rb')
247
- ru.call({}).should == [2, 3, 4]
239
+ ru.call({}).must_equal [2, 3, 4]
248
240
  update_app("class App; def self.call(env) @a end; @a ||= []; @a << 2; RU.require 'spec/app2.rb'; end")
249
- ru.call({}).should == [2, 4]
241
+ ru.call({}).must_equal [2, 4]
250
242
  log_match %r{\ALoading.*spec/app\.rb\z},
251
243
  %r{\ALoading.*spec/app2\.rb\z},
252
244
  %r{\ANew classes in .*spec/app\.rb: App\z},
@@ -266,9 +258,9 @@ describe Rack::Unreloader do
266
258
  base_ru
267
259
  update_app("class App; def self.call(env) [@a, App2.a] end; @a ||= []; @a << 1; end; class App2; def self.a; @a end; @a ||= []; @a << 2; end")
268
260
  @ru.require('spec/app.rb'){|f| File.basename(f).sub(/\.rb/, '').capitalize}
269
- ru.call({}).should == [[1], [2]]
261
+ ru.call({}).must_equal [[1], [2]]
270
262
  update_app("class App; def self.call(env) [@a, App2.a] end; @a ||= []; @a << 3; end; class App2; def self.a; @a end; @a ||= []; @a << 4; end")
271
- ru.call({}).should == [[3], [2, 4]]
263
+ ru.call({}).must_equal [[3], [2, 4]]
272
264
  log_match %r{\ALoading.*spec/app\.rb\z},
273
265
  %r{\ANew classes in .*spec/app\.rb: App\z},
274
266
  %r{\AUnloading.*spec/app\.rb\z},
@@ -281,9 +273,9 @@ describe Rack::Unreloader do
281
273
  base_ru(:block=>proc{$app})
282
274
  update_app("$app = Class.new do def self.call(env) @a end; @a ||= []; @a << 1; end")
283
275
  @ru.require('spec/app.rb')
284
- ru.call({}).should == [1]
276
+ ru.call({}).must_equal [1]
285
277
  update_app("$app = Class.new do def self.call(env) @a end; @a ||= []; @a << 2; end")
286
- ru.call({}).should == [2]
278
+ ru.call({}).must_equal [2]
287
279
  log_match %r{\ALoading.*spec/app\.rb\z},
288
280
  %r{\AUnloading.*spec/app\.rb\z},
289
281
  %r{\ALoading.*spec/app\.rb\z}
@@ -293,9 +285,9 @@ describe Rack::Unreloader do
293
285
  base_ru
294
286
  update_app(code(1))
295
287
  @ru.require('spec/app.rb'){|f| 'Foo'}
296
- ru.call({}).should == [1]
288
+ ru.call({}).must_equal [1]
297
289
  update_app(code(2))
298
- ru.call({}).should == [1, 2]
290
+ ru.call({}).must_equal [1, 2]
299
291
  log_match %r{\ALoading.*spec/app\.rb\z},
300
292
  %r{\AConstants not defined after loading .*spec/app\.rb: Foo\z},
301
293
  %r{\AUnloading.*spec/app\.rb\z},
@@ -309,7 +301,7 @@ describe Rack::Unreloader do
309
301
  update_app(code(1))
310
302
  ::App2 = 1
311
303
  @ru.require('spec/app.rb'){|f| 'App2'}
312
- ru.call({}).should == [1]
304
+ ru.call({}).must_equal [1]
313
305
  log_match %r{\AConstants already defined before loading .*spec/app\.rb: App2\z},
314
306
  %r{\ALoading.*spec/app\.rb\z},
315
307
  %r{\ANew classes in .*spec/app\.rb: App2\z}
@@ -322,19 +314,21 @@ describe Rack::Unreloader do
322
314
  ru.require 'spec/app_mod.rb'
323
315
  ru.require 'spec/app.rb'
324
316
  ru.record_dependency 'spec/app_mod.rb', 'spec/app.rb'
325
- ru.call({}).should == 1
317
+ ru.call({}).must_equal 1
326
318
  update_app("module A; B = 2; end", 'spec/app_mod.rb')
327
- ru.call({}).should == 2
319
+ ru.call({}).must_equal 2
328
320
  update_app("module A; include C; end", 'spec/app_mod.rb')
329
321
  update_app("module C; B = 3; end", 'spec/app_mod2.rb')
330
322
  ru.record_dependency 'spec/app_mod2.rb', 'spec/app_mod.rb'
331
323
  ru.require 'spec/app_mod2.rb'
332
- ru.call({}).should == 3
324
+ ru.call({}).must_equal 3
333
325
  update_app("module C; B = 4; end", 'spec/app_mod2.rb')
334
- ru.call({}).should == 4
326
+ ru.call({}).must_equal 4
335
327
  end
336
328
 
337
329
  describe "with a directory" do
330
+ include Minitest::Hooks
331
+
338
332
  before(:all) do
339
333
  Dir.mkdir('spec/dir')
340
334
  Dir.mkdir('spec/dir/subdir')
@@ -356,7 +350,7 @@ describe Rack::Unreloader do
356
350
  File.open(file, 'wb'){|f| f.write('ANR3 = 3')}
357
351
  base_ru(:reload => false)
358
352
  ru.require 'spec/dir'
359
- ANR3.should == 3
353
+ ANR3.must_equal 3
360
354
  end
361
355
 
362
356
  it "should handle recorded dependencies in directories" do
@@ -366,16 +360,16 @@ describe Rack::Unreloader do
366
360
  ru.require 'spec/dir/subdir'
367
361
  ru.require 'spec/app.rb'
368
362
  ru.record_dependency 'spec/dir/subdir', 'spec/app.rb'
369
- ru.call({}).should == 1
363
+ ru.call({}).must_equal 1
370
364
  update_app("module A; B = 2; end", 'spec/dir/subdir/app_mod.rb')
371
- ru.call({}).should == 2
365
+ ru.call({}).must_equal 2
372
366
  update_app("module A; include C; end", 'spec/dir/subdir/app_mod.rb')
373
367
  update_app("module C; B = 3; end", 'spec/dir/subdir2/app_mod2.rb')
374
368
  ru.require 'spec/dir/subdir2/app_mod2.rb'
375
369
  ru.record_dependency 'spec/dir/subdir2/app_mod2.rb', 'spec/dir/subdir'
376
- ru.call({}).should == 3
370
+ ru.call({}).must_equal 3
377
371
  update_app("module C; B = 4; end", 'spec/dir/subdir2/app_mod2.rb')
378
- ru.call({}).should == 4
372
+ ru.call({}).must_equal 4
379
373
  end
380
374
 
381
375
  it "should handle recorded dependencies in directories when files are added or removed later" do
@@ -386,19 +380,19 @@ describe Rack::Unreloader do
386
380
  ru.require 'spec/app.rb'
387
381
  ru.require 'spec/dir/subdir'
388
382
  ru.require 'spec/dir/subdir2'
389
- ru.call({}).should == 0
383
+ ru.call({}).must_equal 0
390
384
  update_app("module A; B = 1; end", 'spec/dir/subdir/app_mod.rb')
391
- ru.call({}).should == 1
385
+ ru.call({}).must_equal 1
392
386
  update_app("module A; B = 2; end", 'spec/dir/subdir/app_mod.rb')
393
- ru.call({}).should == 2
387
+ ru.call({}).must_equal 2
394
388
  update_app("module C; B = 3; end", 'spec/dir/subdir2/app_mod2.rb')
395
- ru.call({}).should == 2
389
+ ru.call({}).must_equal 2
396
390
  update_app("module A; include C; end", 'spec/dir/subdir/app_mod.rb')
397
- ru.call({}).should == 3
391
+ ru.call({}).must_equal 3
398
392
  update_app("module C; B = 4; end", 'spec/dir/subdir2/app_mod2.rb')
399
- ru.call({}).should == 4
393
+ ru.call({}).must_equal 4
400
394
  File.delete 'spec/dir/subdir/app_mod.rb'
401
- ru.call({}).should == 0
395
+ ru.call({}).must_equal 0
402
396
  end
403
397
 
404
398
  it "should handle classes split into multiple files" do
@@ -406,20 +400,20 @@ describe Rack::Unreloader do
406
400
  update_app("class App; RU.require('spec/dir'); def self.call(env) \"\#{a if respond_to?(:a)}\#{b if respond_to?(:b)}1\".to_i end; end")
407
401
  ru.require 'spec/app.rb'
408
402
  ru.record_split_class 'spec/app.rb', 'spec/dir'
409
- ru.call({}).should == 1
403
+ ru.call({}).must_equal 1
410
404
  update_app("class App; def self.a; 2 end end", 'spec/dir/appa.rb')
411
- ru.call({}).should == 21
405
+ ru.call({}).must_equal 21
412
406
  update_app("class App; def self.a; 3 end end", 'spec/dir/appa.rb')
413
- ru.call({}).should == 31
407
+ ru.call({}).must_equal 31
414
408
  update_app("class App; def self.b; 4 end end", 'spec/dir/appb.rb')
415
- ru.call({}).should == 341
409
+ ru.call({}).must_equal 341
416
410
  update_app("class App; def self.a; 5 end end", 'spec/dir/appa.rb')
417
411
  update_app("class App; def self.b; 6 end end", 'spec/dir/appb.rb')
418
- ru.call({}).should == 561
412
+ ru.call({}).must_equal 561
419
413
  update_app("class App; end", 'spec/dir/appa.rb')
420
- ru.call({}).should == 61
414
+ ru.call({}).must_equal 61
421
415
  File.delete 'spec/dir/appb.rb'
422
- ru.call({}).should == 1
416
+ ru.call({}).must_equal 1
423
417
  end
424
418
 
425
419
  it "should pick up changes to files in that directory" do
@@ -427,9 +421,9 @@ describe Rack::Unreloader do
427
421
  update_app("class App; @a = {}; def self.call(env=nil) @a end; end; RU.require 'spec/dir'")
428
422
  update_app("App.call[:foo] = 1", 'spec/dir/a.rb')
429
423
  @ru.require('spec/app.rb')
430
- ru.call({}).should == {:foo=>1}
424
+ ru.call({}).must_equal(:foo=>1)
431
425
  update_app("App.call[:foo] = 2", 'spec/dir/a.rb')
432
- ru.call({}).should == {:foo=>2}
426
+ ru.call({}).must_equal(:foo=>2)
433
427
  log_match %r{\ALoading.*spec/app\.rb\z},
434
428
  %r{\ALoading.*spec/dir/a\.rb\z},
435
429
  %r{\ANew classes in .*spec/app\.rb: App\z},
@@ -443,9 +437,9 @@ describe Rack::Unreloader do
443
437
  update_app("class App; @a = {}; def self.call(env=nil) @a end; end; RU.require 'spec/dir'")
444
438
  update_app("App.call[:foo] = 1", 'spec/dir/subdir/a.rb')
445
439
  @ru.require('spec/app.rb')
446
- ru.call({}).should == {:foo=>1}
440
+ ru.call({}).must_equal(:foo=>1)
447
441
  update_app("App.call[:foo] = 2", 'spec/dir/subdir/a.rb')
448
- ru.call({}).should == {:foo=>2}
442
+ ru.call({}).must_equal(:foo=>2)
449
443
  log_match %r{\ALoading.*spec/app\.rb\z},
450
444
  %r{\ALoading.*spec/dir/subdir/a\.rb\z},
451
445
  %r{\ANew classes in .*spec/app\.rb: App\z},
@@ -458,9 +452,9 @@ describe Rack::Unreloader do
458
452
  base_ru
459
453
  update_app("class App; @a = {}; def self.call(env=nil) @a end; end; RU.require 'spec/dir'")
460
454
  @ru.require('spec/app.rb')
461
- ru.call({}).should == {}
455
+ ru.call({}).must_equal({})
462
456
  update_app("App.call[:foo] = 2", 'spec/dir/a.rb')
463
- ru.call({}).should == {:foo=>2}
457
+ ru.call({}).must_equal(:foo=>2)
464
458
  log_match %r{\ALoading.*spec/app\.rb\z},
465
459
  %r{\ANew classes in .*spec/app\.rb: App\z},
466
460
  %r{\ALoading.*spec/dir/a\.rb\z}
@@ -470,9 +464,9 @@ describe Rack::Unreloader do
470
464
  base_ru
471
465
  update_app("class App; @a = {}; def self.call(env=nil) @a end; end; RU.require 'spec/dir'")
472
466
  @ru.require('spec/app.rb')
473
- ru.call({}).should == {}
467
+ ru.call({}).must_equal({})
474
468
  update_app("App.call[:foo] = 2", 'spec/dir/subdir/a.rb')
475
- ru.call({}).should == {:foo=>2}
469
+ ru.call({}).must_equal(:foo=>2)
476
470
  log_match %r{\ALoading.*spec/app\.rb\z},
477
471
  %r{\ANew classes in .*spec/app\.rb: App\z},
478
472
  %r{\ALoading.*spec/dir/subdir/a\.rb\z}
@@ -483,10 +477,10 @@ describe Rack::Unreloader do
483
477
  update_app("class App; @a = {}; def self.call(env=nil) @a end; end; RU.require 'spec/dir'")
484
478
  update_app("App.call[:foo] = 1", 'spec/dir/a.rb')
485
479
  @ru.require('spec/app.rb')
486
- ru.call({}).should == {:foo=>1}
480
+ ru.call({}).must_equal(:foo=>1)
487
481
  File.delete('spec/dir/a.rb')
488
482
  update_app("App.call[:foo] = 2", 'spec/dir/b.rb')
489
- ru.call({}).should == {:foo=>2}
483
+ ru.call({}).must_equal(:foo=>2)
490
484
  log_match %r{\ALoading.*spec/app\.rb\z},
491
485
  %r{\ALoading.*spec/dir/a\.rb\z},
492
486
  %r{\ANew classes in .*spec/app\.rb: App\z},
@@ -500,10 +494,10 @@ describe Rack::Unreloader do
500
494
  update_app("class App; @a = {}; def self.call(env=nil) @a end; end; RU.require 'spec/dir'")
501
495
  update_app("App.call[:foo] = 1", 'spec/dir/subdir/a.rb')
502
496
  @ru.require('spec/app.rb')
503
- ru.call({}).should == {:foo=>1}
497
+ ru.call({}).must_equal(:foo=>1)
504
498
  File.delete('spec/dir/subdir/a.rb')
505
499
  update_app("App.call[:foo] = 2", 'spec/dir/subdir/b.rb')
506
- ru.call({}).should == {:foo=>2}
500
+ ru.call({}).must_equal(:foo=>2)
507
501
  log_match %r{\ALoading.*spec/app\.rb\z},
508
502
  %r{\ALoading.*spec/dir/subdir/a\.rb\z},
509
503
  %r{\ANew classes in .*spec/app\.rb: App\z},
metadata CHANGED
@@ -1,15 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-unreloader
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.4.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: 2015-04-06 00:00:00.000000000 Z
12
- dependencies: []
11
+ date: 2016-01-15 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: minitest
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 5.6.1
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 5.6.1
27
+ - !ruby/object:Gem::Dependency
28
+ name: minitest-hooks
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
13
41
  description: |
14
42
  Rack::Unreloader is a rack middleware that reloads application files when it
15
43
  detects changes, unloading constants defined in those files before reloading.
@@ -55,7 +83,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
55
83
  version: '0'
56
84
  requirements: []
57
85
  rubyforge_project:
58
- rubygems_version: 2.4.5
86
+ rubygems_version: 2.5.1
59
87
  signing_key:
60
88
  specification_version: 4
61
89
  summary: Reload application when files change, unloading constants first