impromptu 1.5.1 → 1.5.2

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.5.1
1
+ 1.5.2
data/impromptu.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{impromptu}
8
- s.version = "1.5.1"
8
+ s.version = "1.5.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Will Cannings"]
12
- s.date = %q{2011-03-10}
12
+ s.date = %q{2011-03-11}
13
13
  s.description = %q{Component and dependency manager for Ruby}
14
14
  s.email = %q{me@willcannings.com}
15
15
  s.extra_rdoc_files = [
@@ -36,8 +36,10 @@ Gem::Specification.new do |s|
36
36
  "lib/impromptu/symbol.rb",
37
37
  "test/framework/copies/extra_klass2.rb",
38
38
  "test/framework/copies/new_klass.rb",
39
+ "test/framework/copies/new_sub_klass.rb",
39
40
  "test/framework/copies/new_unseen.rb",
40
41
  "test/framework/copies/original_klass.rb",
42
+ "test/framework/copies/original_sub_klass.rb",
41
43
  "test/framework/ext/extensions.rb",
42
44
  "test/framework/ext/extensions/blog.rb",
43
45
  "test/framework/folder_namespace/stream.rb",
@@ -75,8 +77,10 @@ Gem::Specification.new do |s|
75
77
  s.test_files = [
76
78
  "test/framework/copies/extra_klass2.rb",
77
79
  "test/framework/copies/new_klass.rb",
80
+ "test/framework/copies/new_sub_klass.rb",
78
81
  "test/framework/copies/new_unseen.rb",
79
82
  "test/framework/copies/original_klass.rb",
83
+ "test/framework/copies/original_sub_klass.rb",
80
84
  "test/framework/ext/extensions.rb",
81
85
  "test/framework/ext/extensions/blog.rb",
82
86
  "test/framework/folder_namespace/stream.rb",
@@ -90,6 +90,11 @@ module Impromptu
90
90
  end
91
91
  end
92
92
 
93
+ # remove from the parent's descendants list
94
+ if reference.respond_to?(:superclass) && reference.superclass.respond_to?(:descendants)
95
+ reference.superclass.descendants.delete(reference)
96
+ end
97
+
93
98
  unless @dont_undef
94
99
  @parent.reference.send(:remove_const, @base_symbol)
95
100
  @reference = nil
@@ -0,0 +1,7 @@
1
+ module Framework
2
+ class SubKlass < Klass
3
+ def self.new_sub_method
4
+ true
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,4 @@
1
+ module Framework
2
+ class SubKlass < Klass
3
+ end
4
+ end
@@ -323,6 +323,36 @@ class TestIntegration < Test::Unit::TestCase
323
323
  end
324
324
  end
325
325
 
326
+ context "and changing the definition of sub klass" do
327
+ setup do
328
+ Impromptu.root_resource.child(:'Framework::SubKlass').reload
329
+ new_sub_klass = File.open('test/framework/copies/new_sub_klass.rb').read
330
+ File.open('test/framework/lib/sub_klass.rb', 'w') do |file|
331
+ file.write new_sub_klass
332
+ end
333
+ end
334
+
335
+ teardown do
336
+ original_sub_klass = File.open('test/framework/copies/original_sub_klass.rb').read
337
+ File.open('test/framework/lib/sub_klass.rb', 'w') do |file|
338
+ file.write original_sub_klass
339
+ end
340
+ sleep 1 # because file mod times are in seconds, delay by 1s so further tests so an updated timestamp
341
+ end
342
+
343
+ should "reload sub klass's definition from disk correctly" do
344
+ assert_equal false, Framework::SubKlass.respond_to?(:new_sub_method)
345
+ Impromptu.update
346
+ assert_respond_to Framework::SubKlass, :new_sub_method
347
+ end
348
+
349
+ should "ensure stale references to sub klass don't persist in klass's descendants list" do
350
+ assert_equal 1, Framework::Klass.descendants.size
351
+ Impromptu.update
352
+ assert_equal 1, Framework::Klass.descendants.size
353
+ end
354
+ end
355
+
326
356
 
327
357
  # ----------------------------------------
328
358
  # Adding files
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 1
7
7
  - 5
8
- - 1
9
- version: 1.5.1
8
+ - 2
9
+ version: 1.5.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - Will Cannings
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-03-10 00:00:00 +11:00
17
+ date: 2011-03-11 00:00:00 +11:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -59,8 +59,10 @@ files:
59
59
  - lib/impromptu/symbol.rb
60
60
  - test/framework/copies/extra_klass2.rb
61
61
  - test/framework/copies/new_klass.rb
62
+ - test/framework/copies/new_sub_klass.rb
62
63
  - test/framework/copies/new_unseen.rb
63
64
  - test/framework/copies/original_klass.rb
65
+ - test/framework/copies/original_sub_klass.rb
64
66
  - test/framework/ext/extensions.rb
65
67
  - test/framework/ext/extensions/blog.rb
66
68
  - test/framework/folder_namespace/stream.rb
@@ -125,8 +127,10 @@ summary: Component and dependency manager for Ruby
125
127
  test_files:
126
128
  - test/framework/copies/extra_klass2.rb
127
129
  - test/framework/copies/new_klass.rb
130
+ - test/framework/copies/new_sub_klass.rb
128
131
  - test/framework/copies/new_unseen.rb
129
132
  - test/framework/copies/original_klass.rb
133
+ - test/framework/copies/original_sub_klass.rb
130
134
  - test/framework/ext/extensions.rb
131
135
  - test/framework/ext/extensions/blog.rb
132
136
  - test/framework/folder_namespace/stream.rb