rubygems-update 0.8.10 → 0.8.11
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 +66 -0
- data/README +17 -3
- data/Rakefile +29 -11
- data/bin/gem_mirror +67 -0
- data/examples/application/an-app.gemspec +2 -0
- data/lib/rubygems.rb +18 -3
- data/lib/rubygems/builder.rb +14 -1
- data/lib/rubygems/cmd_manager.rb +2 -0
- data/lib/rubygems/command.rb +26 -2
- data/lib/rubygems/custom_require.rb +30 -21
- data/lib/rubygems/format.rb +4 -4
- data/lib/rubygems/gem_commands.rb +161 -9
- data/lib/rubygems/gem_openssl.rb +34 -0
- data/lib/rubygems/gem_runner.rb +5 -1
- data/lib/rubygems/installer.rb +117 -38
- data/lib/rubygems/package.rb +135 -25
- data/lib/rubygems/remote_installer.rb +59 -29
- data/lib/rubygems/rubygems_version.rb +1 -1
- data/lib/rubygems/security.rb +478 -0
- data/lib/rubygems/specification.rb +48 -28
- data/post-install.rb +2 -1
- data/scripts/gemdoc.rb +2 -2
- data/scripts/specdoc.rb +25 -24
- data/scripts/upload_gemdoc.rb +134 -0
- data/setup.rb +1 -1
- data/test/data/a-0.0.1.gem +0 -0
- data/test/data/a-0.0.2.gem +0 -0
- data/test/data/b-0.0.2.gem +0 -0
- data/test/data/c-1.2.gem +0 -0
- data/test/data/gemhome/cache/a-0.0.1.gem +0 -0
- data/test/data/gemhome/cache/a-0.0.2.gem +0 -0
- data/test/data/gemhome/cache/b-0.0.2.gem +0 -0
- data/test/data/gemhome/cache/c-1.2.gem +0 -0
- data/test/data/gemhome/specifications/a-0.0.1.gemspec +1 -1
- data/test/data/gemhome/specifications/a-0.0.2.gemspec +1 -1
- data/test/data/gemhome/specifications/b-0.0.2.gemspec +1 -1
- data/test/data/gemhome/specifications/c-1.2.gemspec +1 -1
- data/test/data/one/one-0.0.1.gem +0 -0
- data/test/fake_certlib/openssl.rb +1 -0
- data/test/functional.rb +49 -14
- data/test/gemutilities.rb +69 -5
- data/test/test_cached_fetcher.rb +5 -7
- data/test/test_file_list.rb +96 -0
- data/test/test_gempaths.rb +36 -34
- data/test/test_installer.rb +214 -0
- data/test/test_local_cache.rb +45 -102
- data/test/test_parse_commands.rb +3 -1
- data/test/test_remote_installer.rb +24 -5
- data/test/test_specific_extras.rb +40 -0
- data/test/test_specification.rb +106 -16
- metadata +14 -3
@@ -0,0 +1,214 @@
|
|
1
|
+
$TESTING = true
|
2
|
+
require 'fileutils'
|
3
|
+
require 'tmpdir'
|
4
|
+
require 'test/unit'
|
5
|
+
require 'rubygems'
|
6
|
+
require 'test/gemutilities'
|
7
|
+
Gem::manage_gems
|
8
|
+
|
9
|
+
class Gem::Installer
|
10
|
+
attr_accessor :options, :directory
|
11
|
+
end
|
12
|
+
|
13
|
+
class TestInstaller < RubyGemTestCase
|
14
|
+
|
15
|
+
def setup
|
16
|
+
super
|
17
|
+
@spec = quick_gem("a")
|
18
|
+
@installer = Gem::Installer.new false, {}
|
19
|
+
end
|
20
|
+
|
21
|
+
def util_gem_dir(version = '0.0.2')
|
22
|
+
File.join "gems", "a-#{version}" # HACK
|
23
|
+
end
|
24
|
+
|
25
|
+
def util_gem_bindir(version = '0.0.2')
|
26
|
+
File.join util_gem_dir(version), "bin"
|
27
|
+
end
|
28
|
+
|
29
|
+
def util_inst_bindir
|
30
|
+
File.join @gemhome, "bin"
|
31
|
+
end
|
32
|
+
|
33
|
+
def util_make_exec(version = '0.0.2')
|
34
|
+
@spec.executables = ["my_exec"]
|
35
|
+
write_file(File.join(util_gem_bindir(version), "my_exec")) do |f|
|
36
|
+
f.puts "#!/bin/ruby"
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def test_generate_bin_scripts
|
41
|
+
@installer.options[:wrappers] = true
|
42
|
+
util_make_exec
|
43
|
+
|
44
|
+
@installer.generate_bin @spec, @gemhome
|
45
|
+
assert_equal true, File.directory?(util_inst_bindir)
|
46
|
+
installed_exec = File.join(util_inst_bindir, "my_exec")
|
47
|
+
assert_equal true, File.exist?(installed_exec)
|
48
|
+
assert_equal 0100755, File.stat(installed_exec).mode
|
49
|
+
|
50
|
+
wrapper = File.read installed_exec
|
51
|
+
assert_match(/generated by RubyGems/, wrapper)
|
52
|
+
end
|
53
|
+
|
54
|
+
def test_generate_bin_scripts_no_execs
|
55
|
+
@installer.options[:wrappers] = true
|
56
|
+
@installer.generate_bin @spec, @gemhome
|
57
|
+
assert_equal false, File.exist?(util_inst_bindir)
|
58
|
+
end
|
59
|
+
|
60
|
+
def test_generate_bin_scripts_no_perms
|
61
|
+
@installer.options[:wrappers] = true
|
62
|
+
util_make_exec
|
63
|
+
|
64
|
+
Dir.mkdir util_inst_bindir
|
65
|
+
File.chmod 0000, util_inst_bindir
|
66
|
+
|
67
|
+
assert_raises Gem::FilePermissionError do
|
68
|
+
@installer.generate_bin @spec, @gemhome
|
69
|
+
end
|
70
|
+
|
71
|
+
ensure
|
72
|
+
File.chmod 0700, util_inst_bindir unless $DEBUG
|
73
|
+
end
|
74
|
+
|
75
|
+
def test_generate_bin_symlinks
|
76
|
+
@installer.options[:wrappers] = false
|
77
|
+
util_make_exec
|
78
|
+
@installer.directory = util_gem_dir
|
79
|
+
|
80
|
+
@installer.generate_bin @spec, @gemhome
|
81
|
+
assert_equal true, File.directory?(util_inst_bindir)
|
82
|
+
installed_exec = File.join(util_inst_bindir, "my_exec")
|
83
|
+
assert_equal true, File.symlink?(installed_exec)
|
84
|
+
assert_equal(File.join(util_gem_dir, "bin", "my_exec"),
|
85
|
+
File.readlink(installed_exec))
|
86
|
+
end
|
87
|
+
|
88
|
+
def test_generate_bin_symlinks_no_execs
|
89
|
+
@installer.options[:wrappers] = false
|
90
|
+
@installer.generate_bin @spec, @gemhome
|
91
|
+
assert_equal false, File.exist?(util_inst_bindir)
|
92
|
+
end
|
93
|
+
|
94
|
+
def test_generate_bin_symlinks_no_perms
|
95
|
+
@installer.options[:wrappers] = false
|
96
|
+
util_make_exec
|
97
|
+
@installer.directory = util_gem_dir
|
98
|
+
|
99
|
+
Dir.mkdir util_inst_bindir
|
100
|
+
File.chmod 0000, util_inst_bindir
|
101
|
+
|
102
|
+
assert_raises Gem::FilePermissionError do
|
103
|
+
@installer.generate_bin @spec, @gemhome
|
104
|
+
end
|
105
|
+
|
106
|
+
ensure
|
107
|
+
File.chmod 0700, util_inst_bindir unless $DEBUG
|
108
|
+
end
|
109
|
+
|
110
|
+
def test_generate_bin_symlinks_update_newer
|
111
|
+
@installer.options[:wrappers] = false
|
112
|
+
util_make_exec
|
113
|
+
@installer.directory = File.join @gemhome, util_gem_dir
|
114
|
+
|
115
|
+
@installer.generate_bin @spec, @gemhome
|
116
|
+
installed_exec = File.join(util_inst_bindir, "my_exec")
|
117
|
+
assert_equal(File.join(@gemhome, util_gem_dir, "bin", "my_exec"),
|
118
|
+
File.readlink(installed_exec))
|
119
|
+
|
120
|
+
@spec = Gem::Specification.new do |s|
|
121
|
+
s.files = ['lib/code.rb']
|
122
|
+
s.name = "a"
|
123
|
+
s.version = "0.0.3"
|
124
|
+
s.summary = "summary"
|
125
|
+
s.description = "desc"
|
126
|
+
s.require_path = 'lib'
|
127
|
+
end
|
128
|
+
|
129
|
+
util_make_exec '0.0.3'
|
130
|
+
@installer.directory = File.join @gemhome, util_gem_dir('0.0.3')
|
131
|
+
@installer.generate_bin @spec, @gemhome
|
132
|
+
installed_exec = File.join(util_inst_bindir, "my_exec")
|
133
|
+
assert_equal(File.join(@gemhome, util_gem_dir('0.0.3'), "bin", "my_exec"),
|
134
|
+
File.readlink(installed_exec),
|
135
|
+
"Ensure symlink moved to latest version")
|
136
|
+
end
|
137
|
+
|
138
|
+
def test_generate_bin_symlinks_update_older
|
139
|
+
@installer.options[:wrappers] = false
|
140
|
+
util_make_exec
|
141
|
+
@installer.directory = File.join @gemhome, util_gem_dir
|
142
|
+
|
143
|
+
@installer.generate_bin @spec, @gemhome
|
144
|
+
installed_exec = File.join(util_inst_bindir, "my_exec")
|
145
|
+
assert_equal(File.join(@gemhome, util_gem_dir, "bin", "my_exec"),
|
146
|
+
File.readlink(installed_exec))
|
147
|
+
|
148
|
+
@spec = Gem::Specification.new do |s|
|
149
|
+
s.files = ['lib/code.rb']
|
150
|
+
s.name = "a"
|
151
|
+
s.version = "0.0.1"
|
152
|
+
s.summary = "summary"
|
153
|
+
s.description = "desc"
|
154
|
+
s.require_path = 'lib'
|
155
|
+
end
|
156
|
+
|
157
|
+
util_make_exec '0.0.1'
|
158
|
+
@installer.directory = File.join @gemhome, util_gem_dir('0.0.1')
|
159
|
+
@installer.generate_bin @spec, @gemhome
|
160
|
+
installed_exec = File.join(util_inst_bindir, "my_exec")
|
161
|
+
assert_equal(File.join(@gemhome, util_gem_dir('0.0.2'), "bin", "my_exec"),
|
162
|
+
File.readlink(installed_exec),
|
163
|
+
"Ensure symlink not moved")
|
164
|
+
end
|
165
|
+
|
166
|
+
def test_generate_bin_symlinks_update_remove_wrapper
|
167
|
+
@installer.options[:wrappers] = true
|
168
|
+
util_make_exec
|
169
|
+
@installer.directory = util_gem_dir
|
170
|
+
|
171
|
+
@installer.generate_bin @spec, @gemhome
|
172
|
+
installed_exec = File.join(util_inst_bindir, "my_exec")
|
173
|
+
assert_equal true, File.exists?(installed_exec)
|
174
|
+
|
175
|
+
@spec = Gem::Specification.new do |s|
|
176
|
+
s.files = ['lib/code.rb']
|
177
|
+
s.name = "a"
|
178
|
+
s.version = "0.0.3"
|
179
|
+
s.summary = "summary"
|
180
|
+
s.description = "desc"
|
181
|
+
s.require_path = 'lib'
|
182
|
+
end
|
183
|
+
|
184
|
+
@installer.options[:wrappers] = false
|
185
|
+
util_make_exec '0.0.3'
|
186
|
+
@installer.directory = util_gem_dir '0.0.3'
|
187
|
+
@installer.generate_bin @spec, @gemhome
|
188
|
+
installed_exec = File.join(util_inst_bindir, "my_exec")
|
189
|
+
assert_equal(File.join(util_gem_dir('0.0.3'), "bin", "my_exec"),
|
190
|
+
File.readlink(installed_exec),
|
191
|
+
"Ensure symlink moved to latest version")
|
192
|
+
end
|
193
|
+
|
194
|
+
def test_generate_bin_symlinks_win32
|
195
|
+
old_arch = Config::CONFIG["arch"]
|
196
|
+
Config::CONFIG["arch"] = "win32"
|
197
|
+
@installer.options[:wrappers] = false
|
198
|
+
util_make_exec
|
199
|
+
@installer.directory = util_gem_dir
|
200
|
+
|
201
|
+
@installer.generate_bin @spec, @gemhome
|
202
|
+
assert_equal true, File.directory?(util_inst_bindir)
|
203
|
+
installed_exec = File.join(util_inst_bindir, "my_exec")
|
204
|
+
assert_equal true, File.exist?(installed_exec)
|
205
|
+
assert_equal 0100755, File.stat(installed_exec).mode
|
206
|
+
|
207
|
+
wrapper = File.read installed_exec
|
208
|
+
assert_match(/generated by RubyGems/, wrapper)
|
209
|
+
ensure
|
210
|
+
Config::CONFIG["arch"] = old_arch
|
211
|
+
end
|
212
|
+
|
213
|
+
end
|
214
|
+
|
data/test/test_local_cache.rb
CHANGED
@@ -1,157 +1,100 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
require 'test/unit'
|
4
|
-
require 'rubygems/remote_installer'
|
5
3
|
require 'test/gemutilities'
|
4
|
+
require 'rubygems/remote_installer'
|
5
|
+
require 'test/unit'
|
6
6
|
|
7
|
-
class TestLocalCache <
|
8
|
-
GEMHOME = "test/temp/gemhome"
|
9
|
-
GEMCACHE = File.join(GEMHOME, "source_cache")
|
10
|
-
USRCACHE = "test/temp/.gem/user_cache"
|
7
|
+
class TestLocalCache < RubyGemTestCase
|
11
8
|
|
12
9
|
def setup
|
13
|
-
|
14
|
-
Gem.
|
15
|
-
|
16
|
-
|
17
|
-
def teardown
|
18
|
-
FileUtils.chmod(0644, GEMCACHE) if File.exist? GEMCACHE
|
19
|
-
FileUtils.chmod(0644, USRCACHE) if File.exist? USRCACHE
|
20
|
-
ENV['GEMCACHE'] = nil
|
21
|
-
Gem.clear_paths
|
10
|
+
super
|
11
|
+
@lc = Gem::LocalSourceInfoCache.new
|
12
|
+
prep_cache_files(@lc)
|
22
13
|
end
|
23
14
|
|
24
15
|
def test_file_names
|
25
|
-
|
26
|
-
assert_equal
|
27
|
-
assert_equal USRCACHE, lc.user_cache_file
|
16
|
+
assert_equal File.join(Gem.dir, "source_cache"), @lc.system_cache_file
|
17
|
+
assert_equal @usrcache, @lc.user_cache_file
|
28
18
|
end
|
29
19
|
|
30
20
|
def test_gem_cache_env_variable
|
31
|
-
|
32
|
-
assert_equal USRCACHE, lc.user_cache_file
|
21
|
+
assert_equal @usrcache, @lc.user_cache_file
|
33
22
|
end
|
34
23
|
|
35
24
|
def test_use_system_by_default
|
36
|
-
|
37
|
-
prep_cache_files(lc)
|
38
|
-
assert_equal "sys", lc.cache_data['key']
|
25
|
+
assert_equal "sys", @lc.cache_data['key']
|
39
26
|
end
|
40
27
|
|
41
28
|
def test_use_user_cache_when_sys_no_writable
|
42
|
-
|
43
|
-
prep_cache_files(lc)
|
44
|
-
FileUtils.chmod 0544, lc.system_cache_file
|
29
|
+
FileUtils.chmod 0544, @lc.system_cache_file
|
45
30
|
|
46
|
-
lc = Gem::LocalSourceInfoCache.new
|
47
|
-
assert_equal "usr", lc.cache_data['key']
|
31
|
+
@lc = Gem::LocalSourceInfoCache.new
|
32
|
+
assert_equal "usr", @lc.cache_data['key']
|
48
33
|
end
|
49
34
|
|
50
35
|
def test_write_system_cache
|
51
|
-
lc =
|
52
|
-
|
53
|
-
|
54
|
-
lc.cache_data['key'] = 'new'
|
55
|
-
lc.write_cache
|
36
|
+
@lc.cache_data['key'] = 'new'
|
37
|
+
@lc.write_cache
|
56
38
|
|
57
|
-
assert_equal [['key', 'new']].sort, read_cache(lc.system_cache_file).to_a.sort
|
58
|
-
assert_equal [['key', 'usr']].sort, read_cache(lc.user_cache_file).to_a.sort
|
39
|
+
assert_equal [['key', 'new']].sort, read_cache(@lc.system_cache_file).to_a.sort
|
40
|
+
assert_equal [['key', 'usr']].sort, read_cache(@lc.user_cache_file).to_a.sort
|
59
41
|
end
|
60
42
|
|
61
43
|
def test_flush
|
62
|
-
lc =
|
63
|
-
|
44
|
+
@lc.cache_data['key'] = 'new'
|
45
|
+
@lc.update
|
46
|
+
@lc.flush
|
64
47
|
|
65
|
-
|
66
|
-
lc.update
|
67
|
-
lc.flush
|
68
|
-
|
69
|
-
assert_equal [['key','new']].sort, read_cache(lc.system_cache_file).to_a.sort
|
48
|
+
assert_equal [['key','new']].sort, read_cache(@lc.system_cache_file).to_a.sort
|
70
49
|
end
|
71
50
|
|
72
51
|
def test_write_user_cache
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
lc.
|
78
|
-
|
79
|
-
assert_equal [['key', 'sys']].sort, read_cache(lc.system_cache_file).to_a.sort
|
80
|
-
assert_equal [['key', 'new']].sort, read_cache(lc.user_cache_file).to_a.sort
|
52
|
+
FileUtils.chmod 0544, @lc.system_cache_file
|
53
|
+
@lc.cache_data['key'] = 'new'
|
54
|
+
@lc.write_cache
|
55
|
+
|
56
|
+
assert_equal [['key', 'sys']].sort, read_cache(@lc.system_cache_file).to_a.sort
|
57
|
+
assert_equal [['key', 'new']].sort, read_cache(@lc.user_cache_file).to_a.sort
|
81
58
|
end
|
82
59
|
|
83
60
|
def test_write_user_cache_from_scratch
|
84
|
-
lc
|
85
|
-
|
86
|
-
FileUtils.rm_rf lc.user_cache_file
|
87
|
-
FileUtils.chmod 0544, lc.system_cache_file
|
61
|
+
FileUtils.rm_rf @lc.user_cache_file
|
62
|
+
FileUtils.chmod 0544, @lc.system_cache_file
|
88
63
|
|
89
|
-
lc.cache_data['key'] = 'new'
|
90
|
-
lc.write_cache
|
64
|
+
@lc.cache_data['key'] = 'new'
|
65
|
+
@lc.write_cache
|
91
66
|
|
92
|
-
assert_equal [['key', 'sys']].sort, read_cache(lc.system_cache_file).to_a.sort
|
93
|
-
assert_equal [['key', 'new']].sort, read_cache(lc.user_cache_file).to_a.sort
|
67
|
+
assert_equal [['key', 'sys']].sort, read_cache(@lc.system_cache_file).to_a.sort
|
68
|
+
assert_equal [['key', 'new']].sort, read_cache(@lc.user_cache_file).to_a.sort
|
94
69
|
end
|
95
70
|
|
96
71
|
def test_write_user_directory_and_cache_from_scratch
|
97
|
-
|
98
|
-
|
99
|
-
FileUtils.rm_rf File.dirname(lc.user_cache_file)
|
100
|
-
FileUtils.chmod 0544, lc.system_cache_file
|
72
|
+
FileUtils.rm_rf File.dirname(@lc.user_cache_file)
|
73
|
+
FileUtils.chmod 0544, @lc.system_cache_file
|
101
74
|
|
102
|
-
lc.cache_data['key'] = 'new'
|
103
|
-
lc.write_cache
|
75
|
+
@lc.cache_data['key'] = 'new'
|
76
|
+
@lc.write_cache
|
104
77
|
|
105
|
-
assert_equal [['key','sys']].sort, read_cache(lc.system_cache_file).to_a.sort
|
106
|
-
assert_equal [['key','new']].sort, read_cache(lc.user_cache_file).to_a.sort
|
78
|
+
assert_equal [['key','sys']].sort, read_cache(@lc.system_cache_file).to_a.sort
|
79
|
+
assert_equal [['key','new']].sort, read_cache(@lc.user_cache_file).to_a.sort
|
107
80
|
end
|
108
81
|
|
109
82
|
def test_read_system_cache
|
110
|
-
|
111
|
-
prep_cache_files(lc)
|
112
|
-
|
113
|
-
assert_equal [['key','sys']].sort, lc.cache_data.to_a.sort
|
83
|
+
assert_equal [['key','sys']].sort, @lc.cache_data.to_a.sort
|
114
84
|
end
|
115
85
|
|
116
86
|
def test_read_user_cache
|
117
|
-
|
118
|
-
prep_cache_files(lc)
|
119
|
-
FileUtils.chmod 0544, lc.system_cache_file
|
87
|
+
FileUtils.chmod 0544, @lc.system_cache_file
|
120
88
|
|
121
|
-
assert_equal [['key','usr']].sort, lc.cache_data.to_a.sort
|
89
|
+
assert_equal [['key','usr']].sort, @lc.cache_data.to_a.sort
|
122
90
|
end
|
123
91
|
|
124
92
|
def test_no_writable_cache
|
125
|
-
|
126
|
-
|
127
|
-
FileUtils.chmod 0544, lc.system_cache_file
|
128
|
-
FileUtils.chmod 0544, lc.user_cache_file
|
93
|
+
FileUtils.chmod 0544, @lc.system_cache_file
|
94
|
+
FileUtils.chmod 0544, @lc.user_cache_file
|
129
95
|
assert_raise(RuntimeError) {
|
130
|
-
lc.cache_data
|
96
|
+
@lc.cache_data
|
131
97
|
}
|
132
98
|
end
|
133
|
-
|
134
|
-
private
|
135
|
-
|
136
|
-
def prep_cache_files(lc)
|
137
|
-
[ [lc.system_cache_file, 'sys'],
|
138
|
-
[lc.user_cache_file, 'usr'],
|
139
|
-
].each do |fn, data|
|
140
|
-
FileUtils.mkdir_p File.dirname(fn)
|
141
|
-
open(fn, "w") { |f| f.puts(Marshal.dump({'key' => data})) }
|
142
|
-
end
|
143
|
-
end
|
144
|
-
|
145
|
-
def age_file(file_to_age, ref_file)
|
146
|
-
while File.stat(file_to_age).mtime <= File.stat(ref_file).mtime
|
147
|
-
sleep 0.2
|
148
|
-
FileUtils.touch(file_to_age)
|
149
|
-
end
|
150
|
-
end
|
151
|
-
|
152
|
-
def read_cache(fn)
|
153
|
-
open(fn) { |f| Marshal.load(f) }
|
154
|
-
end
|
155
|
-
|
156
99
|
end
|
157
100
|
|
data/test/test_parse_commands.rb
CHANGED
@@ -35,17 +35,19 @@ class TestParseCommands < Test::Unit::TestCase
|
|
35
35
|
assert_equal true, check_options[:generate_rdoc]
|
36
36
|
assert_equal false, check_options[:force]
|
37
37
|
assert_equal :both, check_options[:domain]
|
38
|
+
assert_equal true, check_options[:wrappers]
|
38
39
|
assert_equal "> 0", check_options[:version]
|
39
40
|
assert_equal Gem.dir, check_options[:install_dir]
|
40
41
|
|
41
42
|
#check settings
|
42
43
|
check_options = nil
|
43
44
|
@cmd_manager.process_args(
|
44
|
-
"install --force --test --local --rdoc --install-dir . --version 3.0")
|
45
|
+
"install --force --test --local --rdoc --install-dir . --version 3.0 --no-wrapper")
|
45
46
|
assert_equal true, check_options[:test]
|
46
47
|
assert_equal true, check_options[:generate_rdoc]
|
47
48
|
assert_equal true, check_options[:force]
|
48
49
|
assert_equal :local, check_options[:domain]
|
50
|
+
assert_equal false, check_options[:wrappers]
|
49
51
|
assert_equal '3.0', check_options[:version]
|
50
52
|
assert_equal '.', check_options[:install_dir]
|
51
53
|
|
@@ -17,14 +17,24 @@ class MockFetcher
|
|
17
17
|
def source_index
|
18
18
|
if @uri =~ /non.existent.url/
|
19
19
|
fail Gem::RemoteSourceException,
|
20
|
-
|
20
|
+
"Error fetching remote gem cache: Mock Socket Exception"
|
21
21
|
end
|
22
22
|
result = {
|
23
23
|
'foo-1.2.3' => Gem::Specification.new do |s|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
end
|
24
|
+
s.name = 'foo'
|
25
|
+
s.version = "1.2.3"
|
26
|
+
s.summary = "This is a cool package"
|
27
|
+
end,
|
28
|
+
'foo-tools-2.0.0' => Gem::Specification.new do |s|
|
29
|
+
s.name = 'foo-tools'
|
30
|
+
s.version = "2.0.0"
|
31
|
+
s.summary = "This is an even cooler package"
|
32
|
+
end,
|
33
|
+
'foo-2-2.0.0' => Gem::Specification.new do |s|
|
34
|
+
s.name = 'foo-2'
|
35
|
+
s.version = "2.0.0"
|
36
|
+
s.summary = "This is the coolest package evar!~!"
|
37
|
+
end,
|
28
38
|
}
|
29
39
|
result
|
30
40
|
end
|
@@ -72,6 +82,15 @@ class TestRemoteInstaller < Test::Unit::TestCase
|
|
72
82
|
info = @installer.source_index_hash
|
73
83
|
}
|
74
84
|
end
|
85
|
+
|
86
|
+
def test_find_gem_to_install
|
87
|
+
version = Gem::Version::Requirement.new "> 0.0.0"
|
88
|
+
gems = @installer.find_gem_to_install("foo", version,
|
89
|
+
@installer.source_index_hash)
|
90
|
+
|
91
|
+
assert_equal "foo-1.2.3", gems.first.full_name
|
92
|
+
end
|
93
|
+
|
75
94
|
end
|
76
95
|
|
77
96
|
# This test suite has a number of TODOs in the test cases. The
|