remix 0.4.5 → 0.4.6

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,4 +1,6 @@
1
- 12/11/2010 versino 0.4.5
1
+ 12/11/2010 version 0.4.6
2
+ * fixed segfault in replace_module when trying to replace root module
3
+ 12/11/2010 version 0.4.5
2
4
  * added tests to swap_module and replace_module to prevent
3
5
  mod1 and mod2 being the same module
4
6
  * fixed bug in swap_module when ancestor chains were huge
data/Rakefile CHANGED
@@ -56,12 +56,30 @@ namespace :ruby do
56
56
  end
57
57
  end
58
58
 
59
+ task :compile do
60
+ build_for = proc do |pik_ver, ver|
61
+ sh %{ \
62
+ pik #{pik_ver} && \
63
+ ruby extconf.rb && \
64
+ make clean && \
65
+ make && \
66
+ cp *.so #{direc}/lib/#{ver} \
67
+ }
68
+ end
69
+
70
+ chdir("#{direc}/ext/remix") do
71
+ build_for.call("187", "1.8")
72
+ build_for.call("default", "1.9")
73
+ end
74
+ end
75
+
59
76
  desc "build all platform gems at once"
60
77
  task :gems => [:rmgems, "mingw32:gem", "mswin32:gem", "ruby:gem"]
61
78
 
62
79
  desc "remove all platform gems"
63
80
  task :rmgems => ["ruby:clobber_package"]
64
81
 
82
+ desc "build and push latest gems"
65
83
  task :pushgems => :gems do
66
84
  chdir("#{direc}/pkg") do
67
85
  Dir["*.gem"].each do |gemfile|
@@ -70,5 +88,5 @@ task :pushgems => :gems do
70
88
  end
71
89
  end
72
90
 
73
-
91
+
74
92
 
data/ext/remix/remix.c CHANGED
@@ -331,6 +331,8 @@ rb_replace_module(VALUE self, VALUE mod1, VALUE mod2)
331
331
  {
332
332
  rb_prepare_for_remix(self);
333
333
 
334
+ if (mod1 == self) rb_raise(rb_eRuntimeError, "can't replace root module.");
335
+
334
336
  if (rb_classmod_include_p(self, mod2))
335
337
  return rb_swap_modules(self, mod1, mod2);
336
338
 
data/lib/remix/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Remix
2
- VERSION = "0.4.5"
2
+ VERSION = "0.4.6"
3
3
  end
4
4
 
data/test/test.rb CHANGED
@@ -182,6 +182,14 @@ describe 'Test basic remix functionality' do
182
182
  M.ancestors[1..2].should == [B, A]
183
183
  end
184
184
 
185
+ it 'should do a no-op when source/dest modules are the same' do
186
+ M.ancestors[1..2].should == [A, B]
187
+ M.swap_modules A, A
188
+ M.ancestors[1..2].should == [A, B]
189
+ M.swap_modules B, B
190
+ M.ancestors[1..2].should == [A, B]
191
+ end
192
+
185
193
  it 'should handle huge ancestor chains without crashing or returning the wrong result' do
186
194
  size = 100
187
195
  m = Module.new
@@ -243,12 +251,18 @@ describe 'Test basic remix functionality' do
243
251
  M.replace_module B, C
244
252
  M.ancestors[1..2].should == [A, C]
245
253
  end
254
+
246
255
 
247
256
  it 'should replace a class with a module' do
248
257
  C2.ancestors[0..2].should == [C2, A, C1]
249
258
  C2.replace_module C1, B
250
259
  C2.ancestors[0..2].should == [C2, A, B]
251
260
  end
261
+
262
+ it 'should raise when replace_module target is the root module of the chain' do
263
+ M.ancestors[0..2].should == [M, A, B]
264
+ lambda { M.replace_module M, J }.should.raise RuntimeError
265
+ end
252
266
  end
253
267
  end
254
268
  end
metadata CHANGED
@@ -1,13 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: remix
3
3
  version: !ruby/object:Gem::Version
4
- hash: 5
5
4
  prerelease: false
6
5
  segments:
7
6
  - 0
8
7
  - 4
9
- - 5
10
- version: 0.4.5
8
+ - 6
9
+ version: 0.4.6
11
10
  platform: ruby
12
11
  authors:
13
12
  - John Mair (banisterfiend)
@@ -53,7 +52,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
53
52
  requirements:
54
53
  - - ">="
55
54
  - !ruby/object:Gem::Version
56
- hash: 3
57
55
  segments:
58
56
  - 0
59
57
  version: "0"
@@ -62,7 +60,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
62
60
  requirements:
63
61
  - - ">="
64
62
  - !ruby/object:Gem::Version
65
- hash: 3
66
63
  segments:
67
64
  - 0
68
65
  version: "0"