minigems 0.9.7 → 0.9.8

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 +11 -9
  3. data/spec/minigems_spec.rb +6 -6
  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.7") + PKG_BUILD
18
+ GEM_VERSION = (Gem::MiniGems::VERSION || "0.9.8") + 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.7"
5
+ VERSION = "0.9.8"
6
6
 
7
7
  # The next line needs to be kept exactly as shown; it's being replaced
8
8
  # during minigems installation.
@@ -64,8 +64,7 @@ unless $LOADED_FEATURES.include?("rubygems.rb")
64
64
  elsif path == 'Win32API' && !Gem.win_platform?
65
65
  raise load_error
66
66
  elsif load_error.message =~ /#{Regexp.escape path}\z/
67
- if !path.include?('/') && (match = Gem.find_name(path))
68
- Gem.activate_gem_from_path(match.first)
67
+ if !path.include?('/') && Gem.activate(path)
69
68
  return gem_original_require(path)
70
69
  elsif $MINIGEMS_SKIPPABLE.include?(path)
71
70
  raise load_error
@@ -122,7 +121,8 @@ unless $LOADED_FEATURES.include?("rubygems.rb")
122
121
  def self.activate(gem, *version_requirements)
123
122
  if match = find_name(gem, *version_requirements)
124
123
  activate_gem_from_path(match.first)
125
- elsif match = find_name(MiniGems.camel_case(gem), *version_requirements)
124
+ elsif gem.is_a?(String) &&
125
+ (match = find_name(MiniGems.camel_case(gem), *version_requirements))
126
126
  activate_gem_from_path(match.first)
127
127
  else
128
128
  unless gem.respond_to?(:name) && gem.respond_to?(:version_requirements)
@@ -282,16 +282,18 @@ unless $LOADED_FEATURES.include?("rubygems.rb")
282
282
  # Find the best (highest) matching gem version.
283
283
  def self.find_name(gem, *version_requirements)
284
284
  version_requirements = Gem::Requirement.default if version_requirements.empty?
285
- unless gem.respond_to?(:name) && gem.respond_to?(:version_requirements)
286
- gem = Gem::Dependency.new(gem, version_requirements)
285
+ if gem.respond_to?(:name) && gem.respond_to?(:version_requirements)
286
+ dependency = gem
287
+ else
288
+ dependency = Gem::Dependency.new(gem.to_s, version_requirements)
287
289
  end
288
-
289
- gemspec_sets = self.path.map { |path| [path, Dir["#{path}/specifications/#{gem.name}-*.gemspec"]] }
290
+
291
+ gemspec_sets = self.path.map { |path| [path, Dir["#{path}/specifications/#{dependency.name}-*.gemspec"]] }
290
292
  versions = gemspec_sets.inject([]) do |versions, (root_path, gems)|
291
293
  unless gems.empty?
292
294
  gems.each do |gemspec_path|
293
295
  if (version_no = gemspec_path[/-([\d\.]+)\.gemspec$/, 1]) &&
294
- gem.version_requirements.satisfied_by?(version = Gem::Version.new(version_no))
296
+ dependency.version_requirements.satisfied_by?(version = Gem::Version.new(version_no))
295
297
  versions << [gemspec_path, version]
296
298
  end
297
299
  end
@@ -94,12 +94,12 @@ describe Gem::MiniGems do
94
94
  AwesomeGem::VERSION.should == "0.0.2"
95
95
  end
96
96
 
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
- #
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
103
  # it "for files in a gems' load path" do
104
104
  # require("super_sonic").should be_true
105
105
  # lambda { AwesomeGem::SuperSonic }.should_not raise_error(NameError)
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.7
4
+ version: 0.9.8
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-13 00:00:00 +02:00
12
+ date: 2008-10-21 00:00:00 +02:00
13
13
  default_executable:
14
14
  dependencies: []
15
15