rubygems-update 0.8.3
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.
Potentially problematic release.
This version of rubygems-update might be problematic. Click here for more details.
- data/ChangeLog +2335 -0
- data/README +54 -0
- data/Rakefile +293 -0
- data/Releases +98 -0
- data/TODO +7 -0
- data/bin/gem +11 -0
- data/bin/gem_server +111 -0
- data/bin/generate_yaml_index.rb +58 -0
- data/bin/update_rubygems +18 -0
- data/doc/doc.css +73 -0
- data/doc/makedoc.rb +4 -0
- data/examples/application/an-app.gemspec +26 -0
- data/examples/application/bin/myapp +3 -0
- data/examples/application/lib/somefunctionality.rb +3 -0
- data/gemspecs/README +4 -0
- data/gemspecs/cgikit-1.1.0.gemspec +18 -0
- data/gemspecs/jabber4r.gemspec +26 -0
- data/gemspecs/linguistics.gemspec +22 -0
- data/gemspecs/ook.gemspec +21 -0
- data/gemspecs/progressbar.gemspec +22 -0
- data/gemspecs/redcloth.gemspec +22 -0
- data/gemspecs/rublog.gemspec +23 -0
- data/gemspecs/ruby-doom.gemspec +21 -0
- data/gemspecs/rubyjdwp.gemspec +21 -0
- data/gemspecs/statistics.gemspec +21 -0
- data/lib/rubygems.rb +353 -0
- data/lib/rubygems/builder.rb +54 -0
- data/lib/rubygems/cmd_manager.rb +127 -0
- data/lib/rubygems/command.rb +191 -0
- data/lib/rubygems/config_file.rb +57 -0
- data/lib/rubygems/doc_manager.rb +94 -0
- data/lib/rubygems/format.rb +65 -0
- data/lib/rubygems/gem_commands.rb +925 -0
- data/lib/rubygems/gem_runner.rb +23 -0
- data/lib/rubygems/installer.rb +621 -0
- data/lib/rubygems/loadpath_manager.rb +108 -0
- data/lib/rubygems/old_format.rb +150 -0
- data/lib/rubygems/open-uri.rb +604 -0
- data/lib/rubygems/package.rb +740 -0
- data/lib/rubygems/remote_installer.rb +499 -0
- data/lib/rubygems/rubygems_version.rb +6 -0
- data/lib/rubygems/source_index.rb +130 -0
- data/lib/rubygems/specification.rb +613 -0
- data/lib/rubygems/user_interaction.rb +176 -0
- data/lib/rubygems/validator.rb +148 -0
- data/lib/rubygems/version.rb +279 -0
- data/lib/ubygems.rb +4 -0
- data/pkgs/sources/lib/sources.rb +6 -0
- data/pkgs/sources/sources.gemspec +14 -0
- data/post-install.rb +75 -0
- data/redist/session.gem +433 -0
- data/scripts/buildtests.rb +25 -0
- data/scripts/gemdoc.rb +62 -0
- data/scripts/runtest.rb +17 -0
- data/scripts/specdoc.rb +164 -0
- data/setup.rb +1360 -0
- data/test/bogussources.rb +5 -0
- data/test/data/legacy/keyedlist-0.4.0.ruby +11 -0
- data/test/data/legacy/keyedlist-0.4.0.yaml +16 -0
- data/test/data/lib/code.rb +1 -0
- data/test/data/one/README.one +1 -0
- data/test/data/one/lib/one.rb +3 -0
- data/test/data/one/one.gemspec +17 -0
- data/test/data/one/one.yaml +40 -0
- data/test/functional.rb +145 -0
- data/test/gemenvironment.rb +45 -0
- data/test/gemutilities.rb +18 -0
- data/test/insure_session.rb +46 -0
- data/test/mock/gems/gems/sources-0.0.1/lib/sources.rb +5 -0
- data/test/mock/gems/specifications/sources-0.0.1.gemspec +8 -0
- data/test/mockgemui.rb +45 -0
- data/test/onegem.rb +23 -0
- data/test/simple_gem.rb +66 -0
- data/test/test_builder.rb +13 -0
- data/test/test_cached_fetcher.rb +60 -0
- data/test/test_check_command.rb +28 -0
- data/test/test_command.rb +130 -0
- data/test/test_configfile.rb +36 -0
- data/test/test_format.rb +70 -0
- data/test/test_gemloadpaths.rb +45 -0
- data/test/test_gempaths.rb +115 -0
- data/test/test_loadmanager.rb +40 -0
- data/test/test_local_cache.rb +157 -0
- data/test/test_package.rb +600 -0
- data/test/test_parse_commands.rb +179 -0
- data/test/test_process_commands.rb +21 -0
- data/test/test_remote_fetcher.rb +162 -0
- data/test/test_remote_installer.rb +154 -0
- data/test/test_source_index.rb +58 -0
- data/test/test_specification.rb +286 -0
- data/test/test_validator.rb +53 -0
- data/test/test_version_comparison.rb +204 -0
- data/test/testgem.rc +6 -0
- data/test/user_capture.rb +1 -0
- data/test/yaml_data.rb +59 -0
- metadata +151 -0
data/test/simple_gem.rb
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
SIMPLE_GEM = <<-GEMDATA
|
2
|
+
MD5SUM = "e3701f9db765a2358aef94c40ded71c8"
|
3
|
+
if $0 == __FILE__
|
4
|
+
require 'optparse'
|
5
|
+
|
6
|
+
options = {}
|
7
|
+
ARGV.options do |opts|
|
8
|
+
opts.on_tail("--help", "show this message") {puts opts; exit}
|
9
|
+
opts.on('--dir=DIRNAME', "Installation directory for the Gem") {|options[:directory]|}
|
10
|
+
opts.on('--force', "Force Gem to intall, bypassing dependency checks") {|options[:force]|}
|
11
|
+
opts.on('--gen-rdoc', "Generate RDoc documentation for the Gem") {|options[:gen_rdoc]|}
|
12
|
+
opts.parse!
|
13
|
+
end
|
14
|
+
|
15
|
+
require 'rubygems'
|
16
|
+
@directory = options[:directory] || Gem.dir
|
17
|
+
@force = options[:force]
|
18
|
+
|
19
|
+
gem = Gem::Installer.new(__FILE__).install(@force, @directory)
|
20
|
+
if options[:gen_rdoc]
|
21
|
+
Gem::DocManager.new(gem).generate_rdoc
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
__END__
|
26
|
+
--- !ruby/object:Gem::Specification
|
27
|
+
rubygems_version: "1.0"
|
28
|
+
name: testing
|
29
|
+
version: !ruby/object:Gem::Version
|
30
|
+
version: 1.2.3
|
31
|
+
date: 2004-03-18 22:01:52.859121 -05:00
|
32
|
+
platform:
|
33
|
+
summary: This exercise the gem testing stuff.
|
34
|
+
require_paths:
|
35
|
+
- lib
|
36
|
+
files:
|
37
|
+
- lib/foo.rb
|
38
|
+
- lib/test
|
39
|
+
- lib/test.rb
|
40
|
+
- lib/test/wow.rb
|
41
|
+
autorequire: test
|
42
|
+
test_suite_file: foo
|
43
|
+
requirements:
|
44
|
+
- a computer processor
|
45
|
+
---
|
46
|
+
-
|
47
|
+
size: 109
|
48
|
+
mode: 420
|
49
|
+
path: lib/foo.rb
|
50
|
+
-
|
51
|
+
size: 0
|
52
|
+
mode: 420
|
53
|
+
path: lib/test.rb
|
54
|
+
-
|
55
|
+
size: 15
|
56
|
+
mode: 420
|
57
|
+
path: lib/test/wow.rb
|
58
|
+
---
|
59
|
+
eJwVjDEKgDAUQ/eeIpsKguhY3ARPoHMp9quF0mL7e39/h5DwQpLpqz4TOqbC
|
60
|
+
U42eO6WuYEvBntIhECuaaX1KqXXLmy2kAEc32szExK+PjyBAlpTZyK0N/Twu
|
61
|
+
g1CKTjX9BGAj1w==
|
62
|
+
---
|
63
|
+
eJwDAAAAAAE=
|
64
|
+
---
|
65
|
+
eJwrKC0pVlAvzy9XyE3MU+cCACwiBP4=
|
66
|
+
GEMDATA
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require 'rubygems'
|
3
|
+
Gem::manage_gems
|
4
|
+
|
5
|
+
class TestBuilder < Test::Unit::TestCase
|
6
|
+
def test_invalid_spec_does_not_build
|
7
|
+
spec = Gem::Specification.new
|
8
|
+
builder = Gem::Builder.new(spec)
|
9
|
+
assert_raises(Gem::InvalidSpecificationException) {
|
10
|
+
builder.build
|
11
|
+
}
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'test/unit'
|
4
|
+
require 'fileutils'
|
5
|
+
|
6
|
+
require 'rubygems/remote_installer'
|
7
|
+
require 'test/yaml_data'
|
8
|
+
require 'test/gemutilities'
|
9
|
+
|
10
|
+
class TestCachedFetcher < Test::Unit::TestCase
|
11
|
+
SOURCE_URI = "http://localhost:12344"
|
12
|
+
GEMHOME = "test/temp/writable_cache"
|
13
|
+
|
14
|
+
class MockFetcher
|
15
|
+
attr_reader :count
|
16
|
+
attr_accessor :size
|
17
|
+
|
18
|
+
def initialize
|
19
|
+
@count = 0
|
20
|
+
@size = 5
|
21
|
+
end
|
22
|
+
|
23
|
+
def fetch_path(path=nil)
|
24
|
+
end
|
25
|
+
|
26
|
+
def source_index
|
27
|
+
@count += 1
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def setup
|
32
|
+
make_cache_area(GEMHOME, "http://localhost:12344")
|
33
|
+
Gem.clear_paths
|
34
|
+
Gem.use_paths(GEMHOME)
|
35
|
+
@cf = Gem::CachedFetcher.new(SOURCE_URI, nil)
|
36
|
+
@mf = MockFetcher.new
|
37
|
+
@cf.instance_variable_set("@fetcher", @mf)
|
38
|
+
end
|
39
|
+
|
40
|
+
def test_create
|
41
|
+
assert_not_nil @cf
|
42
|
+
assert_equal 5, @cf.size
|
43
|
+
assert_equal 0, @mf.count
|
44
|
+
end
|
45
|
+
|
46
|
+
def test_cache_miss
|
47
|
+
@cf.source_index
|
48
|
+
assert_equal 1, @mf.count
|
49
|
+
end
|
50
|
+
|
51
|
+
def test_cache_hit
|
52
|
+
@mf.size = YAML_DATA.size
|
53
|
+
@cf.source_index
|
54
|
+
assert_equal 0, @mf.count
|
55
|
+
end
|
56
|
+
|
57
|
+
def make_cache_area(path, *uris)
|
58
|
+
Utilities.make_cache_area(path, *uris)
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'test/unit'
|
4
|
+
require 'rubygems/cmd_manager'
|
5
|
+
require 'rubygems/user_interaction'
|
6
|
+
require 'test/mockgemui'
|
7
|
+
|
8
|
+
class TestCheckCommand < Test::Unit::TestCase
|
9
|
+
include Gem::DefaultUserInteraction
|
10
|
+
|
11
|
+
def setup
|
12
|
+
@cm = Gem::CommandManager.new
|
13
|
+
@cmd = @cm['check']
|
14
|
+
end
|
15
|
+
|
16
|
+
def test_create
|
17
|
+
assert_equal "check", @cmd.command
|
18
|
+
assert_equal "gem check", @cmd.program_name
|
19
|
+
assert_match /Check/, @cmd.summary
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_invoke_help
|
23
|
+
use_ui(MockGemUi.new) do
|
24
|
+
assert ! @cmd.invoke('--help')
|
25
|
+
assert_match /Usage:/, ui.output
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,130 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'test/unit'
|
4
|
+
require 'rubygems/command'
|
5
|
+
require 'rubygems/cmd_manager'
|
6
|
+
require 'rubygems/user_interaction'
|
7
|
+
class Noop
|
8
|
+
def method_missing(sym, *args, &block)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
class TestCommand < Test::Unit::TestCase
|
13
|
+
include Gem::DefaultUserInteraction
|
14
|
+
|
15
|
+
def setup
|
16
|
+
Gem::Command.common_options.clear
|
17
|
+
Gem::Command.common_options << [ ['-x', '--exe', 'Execute'], lambda do @xopt = true end]
|
18
|
+
@cmd = Gem::Command.new("doit", "summary")
|
19
|
+
self.ui = Noop.new
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_basic_accessors
|
23
|
+
assert_equal "doit", @cmd.command
|
24
|
+
assert_equal "gem doit", @cmd.program_name
|
25
|
+
assert_equal "summary", @cmd.summary
|
26
|
+
end
|
27
|
+
|
28
|
+
def test_invoke
|
29
|
+
done = false
|
30
|
+
@cmd.when_invoked { done = true }
|
31
|
+
@cmd.invoke
|
32
|
+
assert done
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_invoke_with_options
|
36
|
+
@cmd.add_option('-h', '--help [COMMAND]', 'Get help on COMMAND') do |value, options|
|
37
|
+
options[:help] = true
|
38
|
+
end
|
39
|
+
@cmd.when_invoked do |opts|
|
40
|
+
assert opts[:help]
|
41
|
+
done = true
|
42
|
+
true
|
43
|
+
end
|
44
|
+
@cmd.invoke('-h')
|
45
|
+
end
|
46
|
+
|
47
|
+
def test_invoke_with_common_options
|
48
|
+
@cmd.when_invoked do true end
|
49
|
+
@cmd.invoke("-x")
|
50
|
+
assert @xopt, "Should have done xopt"
|
51
|
+
end
|
52
|
+
|
53
|
+
def test_invode_with_bad_options
|
54
|
+
use_ui(MockGemUi.new) do
|
55
|
+
@cmd.when_invoked do true end
|
56
|
+
ex = assert_raise(OptionParser::InvalidOption) { @cmd.invoke('-zzz') }
|
57
|
+
assert_match /invalid option:/, ex.message
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
def test_overlapping_common_and_local_options
|
62
|
+
use_ui(MockGemUi.new) do
|
63
|
+
@cmd.add_option('-x', '--zip', 'BAD!') do end
|
64
|
+
@cmd.add_option('-z', '--exe', 'BAD!') do end
|
65
|
+
@cmd.add_option('-x', '--exe', 'BAD!') do end
|
66
|
+
@cmd.when_invoked do |opts| false end
|
67
|
+
@cmd.invoke('-x')
|
68
|
+
md = ui.output =~ /Common.*-exe/m
|
69
|
+
assert ! @xopt, "Should not do xopt"
|
70
|
+
assert_nil md, "Should not have common options"
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
# Returning false from the command handler invokes the usage output.
|
75
|
+
def test_invoke_with_help
|
76
|
+
use_ui(MockGemUi.new) do
|
77
|
+
@cmd.add_option('-h', '--help [COMMAND]', 'Get help on COMMAND') do |value, options|
|
78
|
+
options[:help] = true
|
79
|
+
end
|
80
|
+
@cmd.invoke('--help')
|
81
|
+
assert_match /Usage/, ui.output
|
82
|
+
assert_match /gem doit/, ui.output
|
83
|
+
assert_match /\[options\]/, ui.output
|
84
|
+
assert_match /-h/, ui.output
|
85
|
+
assert_match /--help \[COMMAND\]/, ui.output
|
86
|
+
assert_match /Get help on COMMAND/, ui.output
|
87
|
+
assert_match /-x/, ui.output
|
88
|
+
assert_match /--exe/, ui.output
|
89
|
+
assert_match /Execute/, ui.output
|
90
|
+
assert_match /Common Options:/, ui.output
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
def test_defaults
|
95
|
+
@cmd.add_option('-h', '--help [COMMAND]', 'Get help on COMMAND') do |value, options|
|
96
|
+
options[:help] = value
|
97
|
+
end
|
98
|
+
@cmd.defaults = { :help => true }
|
99
|
+
@cmd.when_invoked do |options|
|
100
|
+
assert options[:help], "Help options should default true"
|
101
|
+
end
|
102
|
+
@cmd.invoke
|
103
|
+
end
|
104
|
+
|
105
|
+
def test_common_option_in_class
|
106
|
+
assert Array === Gem::Command.common_options
|
107
|
+
end
|
108
|
+
|
109
|
+
def test_option_recognition
|
110
|
+
@cmd.add_option('-h', '--help [COMMAND]', 'Get help on COMMAND') do |value, options|
|
111
|
+
options[:help] = true
|
112
|
+
end
|
113
|
+
@cmd.add_option('-f', '--file FILE', 'File option') do |value, options|
|
114
|
+
options[:help] = true
|
115
|
+
end
|
116
|
+
assert @cmd.handles?(['-x'])
|
117
|
+
assert @cmd.handles?(['-h'])
|
118
|
+
assert @cmd.handles?(['-h', 'command'])
|
119
|
+
assert @cmd.handles?(['--help', 'command'])
|
120
|
+
assert @cmd.handles?(['-f', 'filename'])
|
121
|
+
assert @cmd.handles?(['--file=filename'])
|
122
|
+
assert ! @cmd.handles?(['-z'])
|
123
|
+
assert ! @cmd.handles?(['-f'])
|
124
|
+
assert ! @cmd.handles?(['--toothpaste'])
|
125
|
+
|
126
|
+
args = ['-h', 'command']
|
127
|
+
@cmd.handles?(args)
|
128
|
+
assert_equal ['-h', 'command'], args
|
129
|
+
end
|
130
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'test/unit'
|
4
|
+
require 'rubygems/config_file'
|
5
|
+
|
6
|
+
class TestArgPreprocessor < Test::Unit::TestCase
|
7
|
+
def setup
|
8
|
+
end
|
9
|
+
|
10
|
+
def test_create
|
11
|
+
@cfg = Gem::ConfigFile.new([])
|
12
|
+
assert ! @cfg.backtrace
|
13
|
+
assert_equal File.join(ENV['HOME'], '.gemrc'), @cfg.config_file_name
|
14
|
+
end
|
15
|
+
|
16
|
+
def test_backtrace
|
17
|
+
args = %w(--this --that --backtrace --other stuff)
|
18
|
+
@cfg = Gem::ConfigFile.new(args)
|
19
|
+
assert @cfg.backtrace
|
20
|
+
assert_equal %w(--this --that --other stuff), @cfg.args
|
21
|
+
end
|
22
|
+
|
23
|
+
def test_config_file
|
24
|
+
args = %w(--this --that --config-file test/testgem.rc --other stuff)
|
25
|
+
@cfg = Gem::ConfigFile.new(args)
|
26
|
+
assert_equal 'test/testgem.rc', @cfg.config_file_name
|
27
|
+
assert_equal %w(--this --that --other stuff), @cfg.args
|
28
|
+
end
|
29
|
+
|
30
|
+
def test_config_file2
|
31
|
+
args = %w(--this --that --config-file=test/testgem.rc --other stuff)
|
32
|
+
@cfg = Gem::ConfigFile.new(args)
|
33
|
+
assert_equal 'test/testgem.rc', @cfg.config_file_name
|
34
|
+
assert_equal %w(--this --that --other stuff), @cfg.args
|
35
|
+
end
|
36
|
+
end
|
data/test/test_format.rb
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
Gem::manage_gems
|
3
|
+
require 'test/unit'
|
4
|
+
require 'stringio'
|
5
|
+
|
6
|
+
class TestFormat < Test::Unit::TestCase
|
7
|
+
def setup
|
8
|
+
require File.dirname(__FILE__) + "/simple_gem.rb"
|
9
|
+
@simple_gem = SIMPLE_GEM
|
10
|
+
end
|
11
|
+
|
12
|
+
def test_garbled_gem_throws_format_exception
|
13
|
+
assert_raises(RuntimeError) {
|
14
|
+
# subtly bogus input
|
15
|
+
Gem::Format.from_io(StringIO.new(@simple_gem.upcase))
|
16
|
+
}
|
17
|
+
assert_raises(RuntimeError) {
|
18
|
+
# Totally bogus input
|
19
|
+
Gem::Format.from_io(StringIO.new(@simple_gem.reverse))
|
20
|
+
}
|
21
|
+
assert_raises(RuntimeError) {
|
22
|
+
# This was intentionally screws up YAML parsing.
|
23
|
+
Gem::Format.from_io(StringIO.new(@simple_gem.gsub(/:/, "boom")))
|
24
|
+
}
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_passing_nonexistent_files_throws_sensible_exception
|
28
|
+
assert_raises(Gem::Exception) {
|
29
|
+
Gem::Format.from_file_by_path("/this/path/almost/definitely/will/not/exist")
|
30
|
+
}
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
|
35
|
+
class TestOldFormat # < Test::Unit::TestCase
|
36
|
+
def setup
|
37
|
+
require File.dirname(__FILE__) + "/simple_gem.rb"
|
38
|
+
@simple_gem = SIMPLE_GEM
|
39
|
+
end
|
40
|
+
|
41
|
+
def test_from_io_returns_format_object
|
42
|
+
format = Gem::OldFormat.from_io(StringIO.new(@simple_gem))
|
43
|
+
|
44
|
+
assert_equal(Gem::OldFormat, format.class)
|
45
|
+
assert_equal(Gem::Specification, format.spec.class)
|
46
|
+
# simple_gem.rb's gem has 3 files in it
|
47
|
+
assert_equal(3, format.file_entries.size)
|
48
|
+
end
|
49
|
+
|
50
|
+
def test_garbled_gem_throws_format_exception
|
51
|
+
assert_raises(RuntimeError) {
|
52
|
+
# subtly bogus input
|
53
|
+
Gem::OldFormat.from_io(StringIO.new(@simple_gem.upcase))
|
54
|
+
}
|
55
|
+
assert_raises(RuntimeError) {
|
56
|
+
# Totally bogus input
|
57
|
+
Gem::OldFormat.from_io(StringIO.new(@simple_gem.reverse))
|
58
|
+
}
|
59
|
+
assert_raises(RuntimeError) {
|
60
|
+
# This was intentionally screws up YAML parsing.
|
61
|
+
Gem::OldFormat.from_io(StringIO.new(@simple_gem.gsub(/:/, "boom")))
|
62
|
+
}
|
63
|
+
end
|
64
|
+
|
65
|
+
def test_passing_nonexistent_files_throws_sensible_exception
|
66
|
+
assert_raises(Gem::Exception) {
|
67
|
+
Gem::OldFormat.from_file_by_path("/this/path/almost/definitely/will/not/exist")
|
68
|
+
}
|
69
|
+
end
|
70
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'test/unit'
|
4
|
+
require 'rubygems'
|
5
|
+
require 'test/mockgemui'
|
6
|
+
require 'test/gemenvironment'
|
7
|
+
|
8
|
+
Gem.manage_gems
|
9
|
+
|
10
|
+
class TestGemLoadPaths < Test::Unit::TestCase
|
11
|
+
include Gem::DefaultUserInteraction
|
12
|
+
|
13
|
+
def setup
|
14
|
+
TestEnvironment.create
|
15
|
+
Gem.clear_paths
|
16
|
+
Gem.use_paths("test/data/gemhome")
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_all_load_paths
|
20
|
+
assert_equal [
|
21
|
+
"test/data/gemhome/gems/a-0.0.1/lib",
|
22
|
+
"test/data/gemhome/gems/a-0.0.2/lib",
|
23
|
+
"test/data/gemhome/gems/b-0.0.2/lib",
|
24
|
+
"test/data/gemhome/gems/c-1.2/lib"].sort,
|
25
|
+
Gem.all_load_paths.sort
|
26
|
+
end
|
27
|
+
|
28
|
+
def test_latest_load_paths
|
29
|
+
assert_equal [
|
30
|
+
"test/data/gemhome/gems/a-0.0.2/lib",
|
31
|
+
"test/data/gemhome/gems/b-0.0.2/lib",
|
32
|
+
"test/data/gemhome/gems/c-1.2/lib"].sort,
|
33
|
+
Gem.latest_load_paths.sort
|
34
|
+
end
|
35
|
+
|
36
|
+
def test_required_location
|
37
|
+
assert_equal "test/data/gemhome/gems/c-1.2/lib/code.rb",
|
38
|
+
Gem.required_location("c", "code.rb")
|
39
|
+
assert_equal "test/data/gemhome/gems/a-0.0.1/lib/code.rb",
|
40
|
+
Gem.required_location("a", "code.rb", "<0.0.2")
|
41
|
+
assert_equal "test/data/gemhome/gems/a-0.0.2/lib/code.rb",
|
42
|
+
Gem.required_location("a", "code.rb", "=0.0.2")
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|