minigems 0.9.0 → 0.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Rakefile +3 -3
- data/lib/minigems.rb +76 -32
- data/spec/fixtures/cache/CamelCasedGem-0.0.1.gem +0 -0
- data/spec/fixtures/cache/awesome-gem-0.0.2.gem +0 -0
- data/spec/fixtures/gems/CamelCasedGem-0.0.1/LICENSE +20 -0
- data/spec/fixtures/gems/CamelCasedGem-0.0.1/README +4 -0
- data/spec/fixtures/gems/CamelCasedGem-0.0.1/Rakefile +46 -0
- data/spec/fixtures/gems/CamelCasedGem-0.0.1/TODO +4 -0
- data/spec/fixtures/gems/CamelCasedGem-0.0.1/lib/camel_cased_gem.rb +5 -0
- data/spec/fixtures/gems/awesome-gem-0.0.2/LICENSE +20 -0
- data/spec/fixtures/gems/awesome-gem-0.0.2/README +4 -0
- data/spec/fixtures/gems/awesome-gem-0.0.2/Rakefile +46 -0
- data/spec/fixtures/gems/awesome-gem-0.0.2/TODO +4 -0
- data/spec/fixtures/gems/awesome-gem-0.0.2/lib/awesome-gem.rb +5 -0
- data/spec/fixtures/gems/awesome-gem-0.0.2/lib/super_sonic.rb +4 -0
- data/spec/fixtures/gems/awesome-gem-0.0.2/pkg/awesome-gem-0.0.2.gem +0 -0
- data/spec/fixtures/gems/gem_with_lib-0.0.1/Rakefile +0 -1
- data/spec/fixtures/gems/gem_with_lib-0.0.2/Rakefile +0 -1
- data/spec/fixtures/specifications/CamelCasedGem-0.0.1.gemspec +29 -0
- data/spec/fixtures/specifications/awesome-gem-0.0.2.gemspec +29 -0
- data/spec/fixtures/specifications/gem_with_lib-0.0.1.gemspec +0 -1
- data/spec/fixtures/specifications/gem_with_lib-0.0.2.gemspec +0 -1
- data/spec/minigems_spec.rb +34 -8
- metadata +23 -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.
|
18
|
+
GEM_VERSION = (Gem::MiniGems::VERSION || "0.9.1") + PKG_BUILD
|
19
19
|
|
20
20
|
RELEASE_NAME = "REL #{GEM_VERSION}"
|
21
21
|
|
@@ -63,14 +63,14 @@ end
|
|
63
63
|
|
64
64
|
desc "create a gemspec file"
|
65
65
|
task :make_spec do
|
66
|
-
File.open("#{
|
66
|
+
File.open("#{GEM_NAME}.gemspec", "w") do |file|
|
67
67
|
file.puts spec.to_ruby
|
68
68
|
end
|
69
69
|
end
|
70
70
|
|
71
71
|
desc "Install the gem"
|
72
72
|
task :install => [:clean, :package] do
|
73
|
-
sh %{#{sudo} gem install #{install_home} pkg/#{GEM_NAME}-#{GEM_VERSION} --no-wrapper --no-update-sources --no-rdoc --no-ri}
|
73
|
+
sh %{#{sudo} #{Gem.ruby} -S gem install #{install_home} pkg/#{GEM_NAME}-#{GEM_VERSION} --no-wrapper --no-update-sources --no-rdoc --no-ri}
|
74
74
|
end
|
75
75
|
|
76
76
|
namespace :jruby do
|
data/lib/minigems.rb
CHANGED
@@ -1,10 +1,15 @@
|
|
1
1
|
module Gem
|
2
2
|
module MiniGems
|
3
|
-
VERSION = "0.9.
|
3
|
+
VERSION = "0.9.1"
|
4
4
|
|
5
5
|
# The next line needs to be kept exactly as shown; it's being replaced
|
6
6
|
# during minigems installation.
|
7
7
|
FULL_RUBYGEMS_METHODS = []
|
8
|
+
|
9
|
+
def self.camel_case(str)
|
10
|
+
return str if str !~ /_/ && str =~ /[A-Z]+.*/
|
11
|
+
str.split('_').map{|e| e.capitalize}.join
|
12
|
+
end
|
8
13
|
|
9
14
|
end
|
10
15
|
end
|
@@ -103,32 +108,11 @@ unless $LOADED_FEATURES.include?("rubygems.rb")
|
|
103
108
|
# Gem::Requirement and Gem::Version documentation.
|
104
109
|
def self.activate(gem, *version_requirements)
|
105
110
|
if match = find(gem, *version_requirements)
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
#
|
111
|
-
if (already_loaded = self.loaded_gems[gem_spec.name]) && gem_spec.full_name != already_loaded
|
112
|
-
raise Gem::Exception, "can't activate #{gem_spec.name}, already activated #{already_loaded}"
|
113
|
-
# If it's an identical match, we're done activating
|
114
|
-
elsif already_loaded
|
115
|
-
return false
|
116
|
-
end
|
117
|
-
|
118
|
-
# Keep track of loaded gems - by name instead of full specs (memory!)
|
119
|
-
self.loaded_gems[gem_spec.name] = gem_spec.full_name
|
120
|
-
|
121
|
-
# Load dependent gems first
|
122
|
-
gem_spec.runtime_dependencies.each { |dep_gem| activate(dep_gem) }
|
123
|
-
|
124
|
-
# bin directory must come before library directories
|
125
|
-
gem_spec.require_paths.unshift(gem_spec.bindir) if gem_spec.bindir
|
126
|
-
|
127
|
-
# Add gem require paths to $LOAD_PATH
|
128
|
-
gem_spec.require_paths.reverse.each do |require_path|
|
129
|
-
$LOAD_PATH.unshift File.join(gem_spec.full_gem_path, require_path)
|
130
|
-
end
|
131
|
-
return true
|
111
|
+
activate_gem_from_path(match.first)
|
112
|
+
elsif match = find(MiniGems.camel_case(gem), *version_requirements)
|
113
|
+
activate_gem_from_path(match.first)
|
114
|
+
elsif activate_from_source_path(gem)
|
115
|
+
true # The gem for the specified file was loaded correctly
|
132
116
|
else
|
133
117
|
unless gem.respond_to?(:name) && gem.respond_to?(:version_requirements)
|
134
118
|
gem = Gem::Dependency.new(gem, version_requirements)
|
@@ -176,9 +160,12 @@ unless $LOADED_FEATURES.include?("rubygems.rb")
|
|
176
160
|
@default_path ||= if defined? RUBY_FRAMEWORK_VERSION then
|
177
161
|
File.join File.dirname(RbConfig::CONFIG["sitedir"]), 'Gems',
|
178
162
|
RbConfig::CONFIG["ruby_version"]
|
179
|
-
elsif defined?
|
180
|
-
File.join
|
181
|
-
RbConfig::CONFIG["ruby_version"]
|
163
|
+
elsif defined?(RUBY_ENGINE) && File.directory?(
|
164
|
+
File.join(RbConfig::CONFIG["libdir"], RUBY_ENGINE, 'gems',
|
165
|
+
RbConfig::CONFIG["ruby_version"])
|
166
|
+
)
|
167
|
+
File.join RbConfig::CONFIG["libdir"], RUBY_ENGINE, 'gems',
|
168
|
+
RbConfig::CONFIG["ruby_version"]
|
182
169
|
else
|
183
170
|
File.join RbConfig::CONFIG["libdir"], 'ruby', 'gems',
|
184
171
|
RbConfig::CONFIG["ruby_version"]
|
@@ -213,8 +200,66 @@ unless $LOADED_FEATURES.include?("rubygems.rb")
|
|
213
200
|
end
|
214
201
|
|
215
202
|
protected
|
203
|
+
|
204
|
+
# Activate a gem by specifying a path to a gemspec.
|
205
|
+
def self.activate_gem_from_path(gem_path, gem_spec = nil)
|
206
|
+
# Load and initialize the gemspec
|
207
|
+
gem_spec ||= Gem::Specification.load(gem_path)
|
208
|
+
gem_spec.loaded_from = gem_path
|
209
|
+
|
210
|
+
# Raise an exception if the same spec has already been loaded - except for identical matches
|
211
|
+
if (already_loaded = self.loaded_gems[gem_spec.name]) && gem_spec.full_name != already_loaded
|
212
|
+
raise Gem::Exception, "can't activate #{gem_spec.name}, already activated #{already_loaded}"
|
213
|
+
# If it's an identical match, we're done activating
|
214
|
+
elsif already_loaded
|
215
|
+
return false
|
216
|
+
end
|
217
|
+
|
218
|
+
# Keep track of loaded gems - by name instead of full specs (memory!)
|
219
|
+
self.loaded_gems[gem_spec.name] = gem_spec.full_name
|
220
|
+
|
221
|
+
# Load dependent gems first
|
222
|
+
gem_spec.runtime_dependencies.each { |dep_gem| activate(dep_gem) }
|
223
|
+
|
224
|
+
# bin directory must come before library directories
|
225
|
+
gem_spec.require_paths.unshift(gem_spec.bindir) if gem_spec.bindir
|
226
|
+
|
227
|
+
# Add gem require paths to $LOAD_PATH
|
228
|
+
gem_spec.require_paths.reverse.each do |require_path|
|
229
|
+
$LOAD_PATH.unshift File.join(gem_spec.full_gem_path, require_path)
|
230
|
+
end
|
231
|
+
return true
|
232
|
+
end
|
233
|
+
|
234
|
+
# Find a file in the source path and activate its gem (best/highest match).
|
235
|
+
def self.activate_from_source_path(name)
|
236
|
+
matched_paths = self.path.map do |path|
|
237
|
+
[Pathname.new("#{path}/gems"), Dir["#{path}/gems/**/#{name}.rb"]]
|
238
|
+
end
|
239
|
+
versions = matched_paths.inject([]) do |versions, (root_path, paths)|
|
240
|
+
paths.each do |matched_path|
|
241
|
+
dir_name = Pathname.new(matched_path).relative_path_from(root_path).to_s.split('/').first
|
242
|
+
gemspec_path = File.join(File.dirname(root_path), 'specifications', "#{dir_name}.gemspec")
|
243
|
+
if File.exists?(gemspec_path)
|
244
|
+
# Now check if the file was in a valid require_path
|
245
|
+
gem_spec = Gem::Specification.load(gemspec_path)
|
246
|
+
gem_spec.loaded_from = gemspec_path
|
247
|
+
gem_dir = Pathname.new("#{root_path}/#{dir_name}")
|
248
|
+
relative_file_path = Pathname.new(matched_path).relative_path_from(gem_dir).to_s
|
249
|
+
if gem_spec.require_paths.any? { |req| relative_file_path.index(req) == 0 }
|
250
|
+
versions << gem_spec
|
251
|
+
end
|
252
|
+
end
|
253
|
+
end
|
254
|
+
versions
|
255
|
+
end
|
256
|
+
unless versions.empty?
|
257
|
+
spec = versions.max { |a, b| a.version <=> b.version }
|
258
|
+
activate_gem_from_path(spec.loaded_from, spec)
|
259
|
+
end
|
260
|
+
end
|
216
261
|
|
217
|
-
# Find
|
262
|
+
# Find the best (highest) matching gem version.
|
218
263
|
def self.find(gem, *version_requirements)
|
219
264
|
version_requirements = Gem::Requirement.default if version_requirements.empty?
|
220
265
|
unless gem.respond_to?(:name) && gem.respond_to?(:version_requirements)
|
@@ -233,7 +278,6 @@ unless $LOADED_FEATURES.include?("rubygems.rb")
|
|
233
278
|
end
|
234
279
|
versions
|
235
280
|
end
|
236
|
-
# Find the best (highest) matching gem version
|
237
281
|
versions.max { |a, b| a.last <=> b.last }
|
238
282
|
end
|
239
283
|
|
Binary file
|
Binary file
|
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2008 YOUR NAME
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake/gempackagetask'
|
3
|
+
require 'rubygems/specification'
|
4
|
+
require 'date'
|
5
|
+
|
6
|
+
GEM = "CamelCasedGem"
|
7
|
+
GEM_VERSION = "0.0.1"
|
8
|
+
AUTHOR = "Your Name"
|
9
|
+
EMAIL = "Your Email"
|
10
|
+
HOMEPAGE = "http://example.com"
|
11
|
+
SUMMARY = "A gem that provides..."
|
12
|
+
|
13
|
+
spec = Gem::Specification.new do |s|
|
14
|
+
s.name = GEM
|
15
|
+
s.version = GEM_VERSION
|
16
|
+
s.platform = Gem::Platform::RUBY
|
17
|
+
s.has_rdoc = true
|
18
|
+
s.extra_rdoc_files = ["README", "LICENSE", 'TODO']
|
19
|
+
s.summary = SUMMARY
|
20
|
+
s.description = s.summary
|
21
|
+
s.author = AUTHOR
|
22
|
+
s.email = EMAIL
|
23
|
+
s.homepage = HOMEPAGE
|
24
|
+
|
25
|
+
# Uncomment this to add a dependency
|
26
|
+
# s.add_dependency "foo"
|
27
|
+
|
28
|
+
s.require_path = 'lib'
|
29
|
+
s.files = %w(LICENSE README Rakefile TODO) + Dir.glob("{lib,specs}/**/*")
|
30
|
+
end
|
31
|
+
|
32
|
+
Rake::GemPackageTask.new(spec) do |pkg|
|
33
|
+
pkg.gem_spec = spec
|
34
|
+
end
|
35
|
+
|
36
|
+
desc "install the gem locally"
|
37
|
+
task :install => [:package] do
|
38
|
+
sh %{sudo gem install pkg/#{GEM}-#{GEM_VERSION}}
|
39
|
+
end
|
40
|
+
|
41
|
+
desc "create a gemspec file"
|
42
|
+
task :make_spec do
|
43
|
+
File.open("#{GEM}.gemspec", "w") do |file|
|
44
|
+
file.puts spec.to_ruby
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2008 YOUR NAME
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake/gempackagetask'
|
3
|
+
require 'rubygems/specification'
|
4
|
+
require 'date'
|
5
|
+
|
6
|
+
GEM = "awesome-gem"
|
7
|
+
GEM_VERSION = "0.0.2"
|
8
|
+
AUTHOR = "Your Name"
|
9
|
+
EMAIL = "Your Email"
|
10
|
+
HOMEPAGE = "http://example.com"
|
11
|
+
SUMMARY = "A gem that provides..."
|
12
|
+
|
13
|
+
spec = Gem::Specification.new do |s|
|
14
|
+
s.name = GEM
|
15
|
+
s.version = GEM_VERSION
|
16
|
+
s.platform = Gem::Platform::RUBY
|
17
|
+
s.has_rdoc = true
|
18
|
+
s.extra_rdoc_files = ["README", "LICENSE", 'TODO']
|
19
|
+
s.summary = SUMMARY
|
20
|
+
s.description = s.summary
|
21
|
+
s.author = AUTHOR
|
22
|
+
s.email = EMAIL
|
23
|
+
s.homepage = HOMEPAGE
|
24
|
+
|
25
|
+
# Uncomment this to add a dependency
|
26
|
+
# s.add_dependency "foo"
|
27
|
+
|
28
|
+
s.require_path = 'lib'
|
29
|
+
s.files = %w(LICENSE README Rakefile TODO) + Dir.glob("{lib,specs}/**/*")
|
30
|
+
end
|
31
|
+
|
32
|
+
Rake::GemPackageTask.new(spec) do |pkg|
|
33
|
+
pkg.gem_spec = spec
|
34
|
+
end
|
35
|
+
|
36
|
+
desc "install the gem locally"
|
37
|
+
task :install => [:package] do
|
38
|
+
sh %{sudo gem install pkg/#{GEM}-#{GEM_VERSION}}
|
39
|
+
end
|
40
|
+
|
41
|
+
desc "create a gemspec file"
|
42
|
+
task :make_spec do
|
43
|
+
File.open("#{GEM}.gemspec", "w") do |file|
|
44
|
+
file.puts spec.to_ruby
|
45
|
+
end
|
46
|
+
end
|
Binary file
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = %q{CamelCasedGem}
|
5
|
+
s.version = "0.0.1"
|
6
|
+
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
|
+
s.authors = ["Your Name"]
|
9
|
+
s.date = %q{2008-09-23}
|
10
|
+
s.description = %q{A gem that provides...}
|
11
|
+
s.email = %q{Your Email}
|
12
|
+
s.extra_rdoc_files = ["README", "LICENSE", "TODO"]
|
13
|
+
s.files = ["LICENSE", "README", "Rakefile", "TODO", "lib/camel_cased_gem.rb"]
|
14
|
+
s.has_rdoc = true
|
15
|
+
s.homepage = %q{http://example.com}
|
16
|
+
s.require_paths = ["lib"]
|
17
|
+
s.rubygems_version = %q{1.2.0.1874}
|
18
|
+
s.summary = %q{A gem that provides...}
|
19
|
+
|
20
|
+
if s.respond_to? :specification_version then
|
21
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
22
|
+
s.specification_version = 2
|
23
|
+
|
24
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
25
|
+
else
|
26
|
+
end
|
27
|
+
else
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = %q{awesome-gem}
|
5
|
+
s.version = "0.0.2"
|
6
|
+
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
|
+
s.authors = ["Your Name"]
|
9
|
+
s.date = %q{2008-09-23}
|
10
|
+
s.description = %q{A gem that provides...}
|
11
|
+
s.email = %q{Your Email}
|
12
|
+
s.extra_rdoc_files = ["README", "LICENSE", "TODO"]
|
13
|
+
s.files = ["LICENSE", "README", "Rakefile", "TODO", "lib/awesome-gem.rb"]
|
14
|
+
s.has_rdoc = true
|
15
|
+
s.homepage = %q{http://example.com}
|
16
|
+
s.require_paths = ["lib"]
|
17
|
+
s.rubygems_version = %q{1.2.0.1874}
|
18
|
+
s.summary = %q{A gem that provides...}
|
19
|
+
|
20
|
+
if s.respond_to? :specification_version then
|
21
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
22
|
+
s.specification_version = 2
|
23
|
+
|
24
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
25
|
+
else
|
26
|
+
end
|
27
|
+
else
|
28
|
+
end
|
29
|
+
end
|
@@ -4,7 +4,6 @@ Gem::Specification.new do |s|
|
|
4
4
|
|
5
5
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
6
6
|
s.authors = ["Your Name"]
|
7
|
-
s.autorequire = %q{gem_with_lib}
|
8
7
|
s.date = %q{2008-08-17}
|
9
8
|
s.description = %q{A gem that provides...}
|
10
9
|
s.email = %q{Your Email}
|
@@ -4,7 +4,6 @@ Gem::Specification.new do |s|
|
|
4
4
|
|
5
5
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
6
6
|
s.authors = ["Your Name"]
|
7
|
-
s.autorequire = %q{gem_with_lib}
|
8
7
|
s.date = %q{2008-08-19}
|
9
8
|
s.description = %q{A gem that provides...}
|
10
9
|
s.email = %q{Your Email}
|
data/spec/minigems_spec.rb
CHANGED
@@ -75,22 +75,48 @@ describe Gem::MiniGems do
|
|
75
75
|
$LOAD_PATH.should include(gem_lib_path)
|
76
76
|
end
|
77
77
|
|
78
|
-
it "
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
78
|
+
it "returns all the latest gem versions' paths" do
|
79
|
+
Gem.latest_gem_paths.should == [
|
80
|
+
File.join(@gem_dir, "gems", "CamelCasedGem-0.0.1"),
|
81
|
+
File.join(@gem_dir, "gems", "awesome-gem-0.0.2"),
|
82
|
+
File.join(@gem_dir, "gems", "gem_with_lib-0.0.2")
|
83
|
+
]
|
83
84
|
end
|
84
85
|
|
85
|
-
|
86
|
-
|
86
|
+
describe "correctly requires a file from the load path" do
|
87
|
+
|
88
|
+
it "for gems following the normal naming conventions (underscore)" do
|
89
|
+
require("gem_with_lib").should be_true
|
90
|
+
lambda { GemWithLib::Awesome }.should_not raise_error(NameError)
|
91
|
+
GemWithLib::VERSION.should == "0.0.2"
|
92
|
+
end
|
93
|
+
|
94
|
+
it "for gems following the normal naming conventions (hyphen)" do
|
95
|
+
require("awesome-gem").should be_true
|
96
|
+
lambda { AwesomeGem::Awesome }.should_not raise_error(NameError)
|
97
|
+
AwesomeGem::VERSION.should == "0.0.2"
|
98
|
+
end
|
99
|
+
|
100
|
+
it "for gems with a CamelCased package name" do
|
101
|
+
require("camel_cased_gem").should be_true
|
102
|
+
lambda { CamelCasedGem::Awesome }.should_not raise_error(NameError)
|
103
|
+
CamelCasedGem::VERSION.should == "0.0.1"
|
104
|
+
end
|
105
|
+
|
106
|
+
it "for files in a gems' load path" do
|
107
|
+
require("super_sonic").should be_true
|
108
|
+
lambda { AwesomeGem::SuperSonic }.should_not raise_error(NameError)
|
109
|
+
end
|
110
|
+
|
87
111
|
end
|
88
112
|
|
89
113
|
# The following specs can only be run in isolation as they load up the
|
90
114
|
# full rubygems library - which cannot really be undone!
|
91
115
|
# Comment out the specs above, including before/after setup.
|
92
|
-
|
116
|
+
#
|
93
117
|
# it "should load full rubygems if an unimplemented method is called" do
|
118
|
+
# # will only work if pre-installed minigems.rb is used!
|
119
|
+
# # so use: require 'minigems'
|
94
120
|
# Gem.should be_minigems
|
95
121
|
# lambda { Gem.source_index }.should_not raise_error(NoMethodError)
|
96
122
|
# Gem.should_not be_minigems
|
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
|
+
version: 0.9.1
|
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-09-
|
12
|
+
date: 2008-09-23 00:00:00 +02:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -33,9 +33,28 @@ files:
|
|
33
33
|
- bin/minigem
|
34
34
|
- spec/fixtures
|
35
35
|
- spec/fixtures/cache
|
36
|
+
- spec/fixtures/cache/awesome-gem-0.0.2.gem
|
37
|
+
- spec/fixtures/cache/CamelCasedGem-0.0.1.gem
|
36
38
|
- spec/fixtures/cache/gem_with_lib-0.0.1.gem
|
37
39
|
- spec/fixtures/cache/gem_with_lib-0.0.2.gem
|
38
40
|
- spec/fixtures/gems
|
41
|
+
- spec/fixtures/gems/awesome-gem-0.0.2
|
42
|
+
- spec/fixtures/gems/awesome-gem-0.0.2/lib
|
43
|
+
- spec/fixtures/gems/awesome-gem-0.0.2/lib/awesome-gem.rb
|
44
|
+
- spec/fixtures/gems/awesome-gem-0.0.2/lib/super_sonic.rb
|
45
|
+
- spec/fixtures/gems/awesome-gem-0.0.2/LICENSE
|
46
|
+
- spec/fixtures/gems/awesome-gem-0.0.2/pkg
|
47
|
+
- spec/fixtures/gems/awesome-gem-0.0.2/pkg/awesome-gem-0.0.2.gem
|
48
|
+
- spec/fixtures/gems/awesome-gem-0.0.2/Rakefile
|
49
|
+
- spec/fixtures/gems/awesome-gem-0.0.2/README
|
50
|
+
- spec/fixtures/gems/awesome-gem-0.0.2/TODO
|
51
|
+
- spec/fixtures/gems/CamelCasedGem-0.0.1
|
52
|
+
- spec/fixtures/gems/CamelCasedGem-0.0.1/lib
|
53
|
+
- spec/fixtures/gems/CamelCasedGem-0.0.1/lib/camel_cased_gem.rb
|
54
|
+
- spec/fixtures/gems/CamelCasedGem-0.0.1/LICENSE
|
55
|
+
- spec/fixtures/gems/CamelCasedGem-0.0.1/Rakefile
|
56
|
+
- spec/fixtures/gems/CamelCasedGem-0.0.1/README
|
57
|
+
- spec/fixtures/gems/CamelCasedGem-0.0.1/TODO
|
39
58
|
- spec/fixtures/gems/gem_with_lib-0.0.1
|
40
59
|
- spec/fixtures/gems/gem_with_lib-0.0.1/lib
|
41
60
|
- spec/fixtures/gems/gem_with_lib-0.0.1/lib/gem_with_lib.rb
|
@@ -53,6 +72,8 @@ files:
|
|
53
72
|
- spec/fixtures/gems/gem_with_lib-0.0.2/README
|
54
73
|
- spec/fixtures/gems/gem_with_lib-0.0.2/TODO
|
55
74
|
- spec/fixtures/specifications
|
75
|
+
- spec/fixtures/specifications/awesome-gem-0.0.2.gemspec
|
76
|
+
- spec/fixtures/specifications/CamelCasedGem-0.0.1.gemspec
|
56
77
|
- spec/fixtures/specifications/gem_with_lib-0.0.1.gemspec
|
57
78
|
- spec/fixtures/specifications/gem_with_lib-0.0.2.gemspec
|
58
79
|
- spec/minigems_spec.rb
|