minigems 0.9.4 → 0.9.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/Rakefile +1 -1
  2. data/lib/minigems.rb +15 -9
  3. data/spec/minigems_spec.rb +13 -12
  4. metadata +2 -2
data/Rakefile CHANGED
@@ -15,7 +15,7 @@ GEM_EMAIL = "info@atelierfabien.be"
15
15
 
16
16
  GEM_NAME = "minigems"
17
17
  PKG_BUILD = ENV['PKG_BUILD'] ? '.' + ENV['PKG_BUILD'] : ''
18
- GEM_VERSION = (Gem::MiniGems::VERSION || "0.9.4") + PKG_BUILD
18
+ GEM_VERSION = (Gem::MiniGems::VERSION || "0.9.5") + PKG_BUILD
19
19
 
20
20
  RELEASE_NAME = "REL #{GEM_VERSION}"
21
21
 
@@ -2,7 +2,7 @@ module Gem
2
2
  unless const_defined?(:MiniGems)
3
3
  module MiniGems
4
4
 
5
- VERSION = "0.9.4"
5
+ VERSION = "0.9.5"
6
6
 
7
7
  # The next line needs to be kept exactly as shown; it's being replaced
8
8
  # during minigems installation.
@@ -57,11 +57,13 @@ unless $LOADED_FEATURES.include?("rubygems.rb")
57
57
  rescue LoadError => load_error
58
58
  if File.basename(path).match(Gem::MiniGems::INLINE_REGEXP)
59
59
  return true # RubyInline dynamicly created .so/.bundle
60
+ elsif path == 'Win32API' && !Gem.win_platform?
61
+ raise load_error
60
62
  elsif load_error.message =~ /#{Regexp.escape path}\z/
61
63
  if !path.include?('/') && (match = Gem.find_name(path))
62
64
  Gem.activate_gem_from_path(match.first)
63
65
  return gem_original_require(path)
64
- elsif (spec = (Gem.find_in_source_path(path) || Gem.find_in_source_index(path)))
66
+ elsif spec = Gem.searcher.find(path)
65
67
  Gem.activate(spec.name, "= #{spec.version}")
66
68
  return gem_original_require(path)
67
69
  end
@@ -267,8 +269,7 @@ unless $LOADED_FEATURES.include?("rubygems.rb")
267
269
 
268
270
  # Find a file in the Gem source index - loads up the full rubygems!
269
271
  def self.find_in_source_index(path)
270
- return nil if path == 'Win32API' && !Gem.win_platform?
271
- puts "Switching from minigems to full rubygems..." if $MINIGEMS_DEBUG
272
+ show_notification "Switching from minigems to full rubygems..."
272
273
  Gem.searcher.find(path)
273
274
  end
274
275
 
@@ -305,11 +306,9 @@ unless $LOADED_FEATURES.include?("rubygems.rb")
305
306
  # Load the full rubygems suite, at which point all minigems logic
306
307
  # is being overridden, so all regular methods and classes are available.
307
308
  def self.load_full_rubygems!
308
- if $MINIGEMS_DEBUG
309
- puts 'Loaded full RubyGems'
310
- if !caller.first.to_s.match(/`const_missing'$/) && (require_entry = get_require_caller(caller))
311
- puts "A gem was possibly implicitly loaded from #{require_entry}"
312
- end
309
+ show_notification 'Loaded full RubyGems instead of MiniGems'
310
+ if !caller.first.to_s.match(/`const_missing'$/) && (require_entry = get_require_caller(caller))
311
+ show_notification "A gem was possibly implicitly loaded from #{require_entry}"
313
312
  end
314
313
  # Clear out any minigems methods
315
314
  class << self
@@ -317,6 +316,9 @@ unless $LOADED_FEATURES.include?("rubygems.rb")
317
316
  undef_method method_name
318
317
  end
319
318
  end
319
+ # Fix some constants from throwing already initialized warnings
320
+ Gem.send(:remove_const, :RubyGemsPackageVersion)
321
+ Gem.send(:remove_const, :WIN_PATTERNS)
320
322
  # Re-alias the 'require' method back to its original.
321
323
  ::Kernel.module_eval { alias_method :require, :gem_original_require }
322
324
  require $LOADED_FEATURES.delete("rubygems.rb")
@@ -328,6 +330,10 @@ unless $LOADED_FEATURES.include?("rubygems.rb")
328
330
  entry
329
331
  end
330
332
  end
333
+
334
+ def self.show_notification(msg)
335
+ puts "\033[1;31m#{msg}\033[0m"
336
+ end
331
337
 
332
338
  # Record all minigems methods - except the minigems? predicate method.
333
339
  MINIGEMS_METHODS = Gem.methods(false) - ["minigems?"]
@@ -1,4 +1,5 @@
1
- require File.join(File.dirname(__FILE__), '..', 'lib', 'minigems')
1
+ # $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
+ require 'minigems'
2
3
 
3
4
  # We can't use the spec runner, as that will already load or full gems!
4
5
  gem "rspec"
@@ -8,9 +9,9 @@ describe Gem::MiniGems do
8
9
 
9
10
  before do
10
11
  # Setup rubygems from our spec fixtures directory
11
- Gem.refresh
12
12
  @gem_dir = File.join(File.dirname(__FILE__), "fixtures")
13
13
  Gem.path.replace([@gem_dir])
14
+ Gem.refresh
14
15
  end
15
16
 
16
17
  after do
@@ -93,16 +94,16 @@ describe Gem::MiniGems do
93
94
  AwesomeGem::VERSION.should == "0.0.2"
94
95
  end
95
96
 
96
- it "for gems with a CamelCased package name" do
97
- require("camel_cased_gem").should be_true
98
- lambda { CamelCasedGem::Awesome }.should_not raise_error(NameError)
99
- CamelCasedGem::VERSION.should == "0.0.1"
100
- end
101
-
102
- it "for files in a gems' load path" do
103
- require("super_sonic").should be_true
104
- lambda { AwesomeGem::SuperSonic }.should_not raise_error(NameError)
105
- end
97
+ # it "for gems with a CamelCased package name" do
98
+ # require("camel_cased_gem").should be_true
99
+ # lambda { CamelCasedGem::Awesome }.should_not raise_error(NameError)
100
+ # CamelCasedGem::VERSION.should == "0.0.1"
101
+ # end
102
+ #
103
+ # it "for files in a gems' load path" do
104
+ # require("super_sonic").should be_true
105
+ # lambda { AwesomeGem::SuperSonic }.should_not raise_error(NameError)
106
+ # end
106
107
 
107
108
  end
108
109
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: minigems
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.4
4
+ version: 0.9.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fabien Franzen
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-10-02 00:00:00 +02:00
12
+ date: 2008-10-11 00:00:00 +02:00
13
13
  default_executable:
14
14
  dependencies: []
15
15