rubygems-update 3.0.3 → 3.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -0
- data/.travis.yml +2 -0
- data/CODE_OF_CONDUCT.md +10 -8
- data/CONTRIBUTING.md +7 -0
- data/History.txt +152 -0
- data/Manifest.txt +5 -3
- data/README.md +6 -0
- data/Rakefile +27 -7
- data/bundler/lib/bundler/build_metadata.rb +2 -2
- data/lib/rubygems.rb +7 -12
- data/lib/rubygems/command_manager.rb +6 -0
- data/lib/rubygems/commands/build_command.rb +28 -13
- data/lib/rubygems/commands/owner_command.rb +2 -0
- data/lib/rubygems/commands/push_command.rb +2 -0
- data/lib/rubygems/commands/setup_command.rb +9 -11
- data/lib/rubygems/commands/uninstall_command.rb +16 -6
- data/lib/rubygems/commands/which_command.rb +1 -3
- data/lib/rubygems/defaults.rb +1 -8
- data/lib/rubygems/dependency.rb +1 -1
- data/lib/rubygems/dependency_installer.rb +1 -2
- data/lib/rubygems/dependency_list.rb +1 -1
- data/lib/rubygems/exceptions.rb +0 -4
- data/lib/rubygems/gemcutter_utilities.rb +9 -5
- data/lib/rubygems/installer.rb +8 -5
- data/lib/rubygems/installer_test_case.rb +2 -2
- data/lib/rubygems/package/tar_header.rb +11 -2
- data/lib/rubygems/rdoc.rb +2 -2
- data/lib/rubygems/remote_fetcher.rb +15 -54
- data/lib/rubygems/request.rb +1 -1
- data/lib/rubygems/request_set/gem_dependency_api.rb +11 -10
- data/lib/rubygems/requirement.rb +0 -4
- data/lib/rubygems/resolver.rb +4 -1
- data/lib/rubygems/s3_uri_signer.rb +183 -0
- data/lib/rubygems/security_option.rb +0 -1
- data/lib/rubygems/specification.rb +21 -23
- data/lib/rubygems/ssl_certs/{index.rubygems.org → rubygems.org}/GlobalSignRootCA.pem +0 -0
- data/lib/rubygems/ssl_certs/rubygems.org/GlobalSignRootCA_R3.pem +21 -0
- data/lib/rubygems/stub_specification.rb +1 -2
- data/lib/rubygems/test_case.rb +22 -12
- data/lib/rubygems/uninstaller.rb +1 -1
- data/lib/rubygems/util.rb +12 -0
- data/rubygems-update.gemspec +1 -1
- data/test/rubygems/ca_cert.pem +74 -65
- data/test/rubygems/client.pem +103 -45
- data/test/rubygems/ssl_cert.pem +78 -17
- data/test/rubygems/ssl_key.pem +25 -13
- data/test/rubygems/test_bundled_ca.rb +8 -5
- data/test/rubygems/test_gem.rb +45 -11
- data/test/rubygems/test_gem_bundler_version_finder.rb +4 -0
- data/test/rubygems/test_gem_command_manager.rb +10 -0
- data/test/rubygems/test_gem_commands_build_command.rb +1 -0
- data/test/rubygems/test_gem_commands_push_command.rb +15 -0
- data/test/rubygems/test_gem_commands_setup_command.rb +11 -7
- data/test/rubygems/test_gem_commands_uninstall_command.rb +80 -1
- data/test/rubygems/test_gem_ext_cmake_builder.rb +1 -1
- data/test/rubygems/test_gem_indexer.rb +15 -8
- data/test/rubygems/test_gem_installer.rb +85 -22
- data/test/rubygems/test_gem_package_tar_header.rb +41 -0
- data/test/rubygems/test_gem_rdoc.rb +1 -135
- data/test/rubygems/test_gem_remote_fetcher.rb +133 -14
- data/test/rubygems/test_gem_request.rb +4 -4
- data/test/rubygems/test_gem_request_set_gem_dependency_api.rb +80 -57
- data/test/rubygems/test_gem_security_policy.rb +1 -1
- data/test/rubygems/test_gem_specification.rb +29 -0
- data/test/rubygems/test_gem_stream_ui.rb +2 -2
- data/test/rubygems/test_gem_uninstaller.rb +21 -2
- data/test/rubygems/test_gem_util.rb +8 -0
- data/util/ci +6 -1
- data/util/cops/deprecations.rb +52 -0
- data/util/create_certs.sh +27 -0
- data/util/create_encrypted_key.rb +4 -4
- data/util/update_bundled_ca_certificates.rb +1 -3
- metadata +12 -57
- data/bundler/man/bundle-add.1 +0 -58
- data/bundler/man/bundle-binstubs.1 +0 -40
- data/bundler/man/bundle-check.1 +0 -31
- data/bundler/man/bundle-clean.1 +0 -24
- data/bundler/man/bundle-config.1 +0 -497
- data/bundler/man/bundle-doctor.1 +0 -44
- data/bundler/man/bundle-exec.1 +0 -165
- data/bundler/man/bundle-gem.1 +0 -80
- data/bundler/man/bundle-info.1 +0 -20
- data/bundler/man/bundle-init.1 +0 -25
- data/bundler/man/bundle-inject.1 +0 -33
- data/bundler/man/bundle-install.1 +0 -308
- data/bundler/man/bundle-list.1 +0 -50
- data/bundler/man/bundle-lock.1 +0 -84
- data/bundler/man/bundle-open.1 +0 -32
- data/bundler/man/bundle-outdated.1 +0 -155
- data/bundler/man/bundle-package.1 +0 -55
- data/bundler/man/bundle-platform.1 +0 -61
- data/bundler/man/bundle-pristine.1 +0 -34
- data/bundler/man/bundle-remove.1 +0 -31
- data/bundler/man/bundle-show.1 +0 -23
- data/bundler/man/bundle-update.1 +0 -394
- data/bundler/man/bundle-viz.1 +0 -39
- data/bundler/man/bundle.1 +0 -136
- data/lib/rubygems/ssl_certs/rubygems.global.ssl.fastly.net/DigiCertHighAssuranceEVRootCA.pem +0 -23
- data/lib/rubygems/ssl_certs/rubygems.org/AddTrustExternalCARoot.pem +0 -25
@@ -37,7 +37,7 @@ if ENV["CI"] || ENV["TEST_SSL"]
|
|
37
37
|
http.verify_mode = OpenSSL::SSL::VERIFY_PEER
|
38
38
|
http.cert_store = bundled_certificate_store
|
39
39
|
http.get('/')
|
40
|
-
rescue Errno::ENOENT, Errno::ETIMEDOUT
|
40
|
+
rescue Errno::ENOENT, Errno::ETIMEDOUT, SocketError
|
41
41
|
skip "#{host} seems offline, I can't tell whether ssl would work."
|
42
42
|
rescue OpenSSL::SSL::SSLError => e
|
43
43
|
# Only fail for certificate verification errors
|
@@ -51,13 +51,16 @@ if ENV["CI"] || ENV["TEST_SSL"]
|
|
51
51
|
assert_https('rubygems.org')
|
52
52
|
end
|
53
53
|
|
54
|
-
def
|
55
|
-
assert_https('rubygems.
|
54
|
+
def test_accessing_www_rubygems
|
55
|
+
assert_https('www.rubygems.org')
|
56
56
|
end
|
57
57
|
|
58
|
-
def
|
59
|
-
assert_https('
|
58
|
+
def test_accessing_staging
|
59
|
+
assert_https('staging.rubygems.org')
|
60
60
|
end
|
61
61
|
|
62
|
+
def test_accessing_new_index
|
63
|
+
assert_https('index.rubygems.org')
|
64
|
+
end
|
62
65
|
end
|
63
66
|
end
|
data/test/rubygems/test_gem.rb
CHANGED
@@ -156,7 +156,7 @@ class TestGem < Gem::TestCase
|
|
156
156
|
end
|
157
157
|
|
158
158
|
def assert_self_install_permissions
|
159
|
-
mask =
|
159
|
+
mask = win_platform? ? 0700 : 0777
|
160
160
|
options = {
|
161
161
|
:dir_mode => 0500,
|
162
162
|
:prog_mode => 0510,
|
@@ -166,15 +166,12 @@ class TestGem < Gem::TestCase
|
|
166
166
|
}
|
167
167
|
Dir.chdir @tempdir do
|
168
168
|
Dir.mkdir 'bin'
|
169
|
-
File.open 'bin/foo.cmd', 'w' do |fp|
|
170
|
-
fp.chmod(0755)
|
171
|
-
fp.puts 'p'
|
172
|
-
end
|
173
|
-
|
174
169
|
Dir.mkdir 'data'
|
175
|
-
|
176
|
-
|
177
|
-
|
170
|
+
|
171
|
+
File.write 'bin/foo.cmd', "p\n"
|
172
|
+
File.chmod 0755, 'bin/foo.cmd'
|
173
|
+
|
174
|
+
File.write 'data/foo.txt', "blah\n"
|
178
175
|
|
179
176
|
spec_fetcher do |f|
|
180
177
|
f.gem 'foo', 1 do |s|
|
@@ -198,6 +195,9 @@ class TestGem < Gem::TestCase
|
|
198
195
|
'gems/foo-1/bin/foo.cmd' => prog_mode,
|
199
196
|
'gems/foo-1/data/foo.txt' => data_mode,
|
200
197
|
}
|
198
|
+
# below is for intermittent errors on Appveyor & Travis 2019-01,
|
199
|
+
# see https://github.com/rubygems/rubygems/pull/2568
|
200
|
+
sleep 0.2
|
201
201
|
result = {}
|
202
202
|
Dir.chdir @gemhome do
|
203
203
|
expected.each_key do |n|
|
@@ -323,6 +323,40 @@ class TestGem < Gem::TestCase
|
|
323
323
|
refute_includes e.message, "can't find gem bundler (>= 0.a) with executable bundle"
|
324
324
|
end
|
325
325
|
|
326
|
+
def test_activate_bin_path_respects_underscore_selection_if_given
|
327
|
+
bundler_latest = util_spec 'bundler', '2.0.1' do |s|
|
328
|
+
s.executables = ['bundle']
|
329
|
+
end
|
330
|
+
|
331
|
+
bundler_previous = util_spec 'bundler', '1.17.3' do |s|
|
332
|
+
s.executables = ['bundle']
|
333
|
+
end
|
334
|
+
|
335
|
+
install_specs bundler_latest, bundler_previous
|
336
|
+
|
337
|
+
File.open("Gemfile.lock", "w") do |f|
|
338
|
+
f.write <<-L.gsub(/ {8}/, "")
|
339
|
+
GEM
|
340
|
+
remote: https://rubygems.org/
|
341
|
+
specs:
|
342
|
+
|
343
|
+
PLATFORMS
|
344
|
+
ruby
|
345
|
+
|
346
|
+
DEPENDENCIES
|
347
|
+
|
348
|
+
BUNDLED WITH
|
349
|
+
2.0.1
|
350
|
+
L
|
351
|
+
end
|
352
|
+
|
353
|
+
File.open("Gemfile", "w") { |f| f.puts('source "https://rubygems.org"') }
|
354
|
+
|
355
|
+
load Gem.activate_bin_path("bundler", "bundle", "= 1.17.3")
|
356
|
+
|
357
|
+
assert_equal %w(bundler-1.17.3), loaded_spec_names
|
358
|
+
end
|
359
|
+
|
326
360
|
def test_self_bin_path_no_exec_name
|
327
361
|
e = assert_raises ArgumentError do
|
328
362
|
Gem.bin_path 'a'
|
@@ -544,7 +578,7 @@ class TestGem < Gem::TestCase
|
|
544
578
|
|
545
579
|
Gem.ensure_gem_subdirectories @gemhome, 0750
|
546
580
|
|
547
|
-
|
581
|
+
assert_directory_exists File.join(@gemhome, "cache")
|
548
582
|
|
549
583
|
assert_equal 0750, File::Stat.new(@gemhome).mode & 0777
|
550
584
|
assert_equal 0750, File::Stat.new(File.join(@gemhome, "cache")).mode & 0777
|
@@ -573,7 +607,7 @@ class TestGem < Gem::TestCase
|
|
573
607
|
|
574
608
|
Gem.ensure_gem_subdirectories gemdir
|
575
609
|
|
576
|
-
|
610
|
+
assert_directory_exists util_cache_dir
|
577
611
|
end
|
578
612
|
|
579
613
|
unless win_platform? || Process.uid.zero? # only for FS that support write protection
|
@@ -3,6 +3,8 @@ require 'rubygems/test_case'
|
|
3
3
|
|
4
4
|
class TestGemBundlerVersionFinder < Gem::TestCase
|
5
5
|
def setup
|
6
|
+
super
|
7
|
+
|
6
8
|
@argv = ARGV.dup
|
7
9
|
@env = ENV.to_hash.clone
|
8
10
|
ENV.delete("BUNDLER_VERSION")
|
@@ -13,6 +15,8 @@ class TestGemBundlerVersionFinder < Gem::TestCase
|
|
13
15
|
ARGV.replace @argv
|
14
16
|
ENV.replace @env
|
15
17
|
$0 = @dollar_0
|
18
|
+
|
19
|
+
super
|
16
20
|
end
|
17
21
|
|
18
22
|
def bvf
|
@@ -103,6 +103,16 @@ class TestGemCommandManager < Gem::TestCase
|
|
103
103
|
assert_match(/invalid option: --bad-arg/i, @ui.error)
|
104
104
|
end
|
105
105
|
|
106
|
+
def test_process_args_bad_no_ri
|
107
|
+
use_ui @ui do
|
108
|
+
assert_raises Gem::MockGemUi::TermError do
|
109
|
+
@command_manager.process_args %w[--no-ri]
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
assert_match(/invalid option: --no-ri. Use --no-document instead./i, @ui.error)
|
114
|
+
end
|
115
|
+
|
106
116
|
# HACK move to install command test
|
107
117
|
def test_process_args_install
|
108
118
|
#capture all install options
|
@@ -199,6 +199,21 @@ class TestGemCommandsPushCommand < Gem::TestCase
|
|
199
199
|
send_battery
|
200
200
|
end
|
201
201
|
|
202
|
+
def test_sending_gem_with_env_var_api_key
|
203
|
+
@host = "http://privategemserver.example"
|
204
|
+
|
205
|
+
@spec, @path = util_gem "freebird", "1.0.1" do |spec|
|
206
|
+
spec.metadata['allowed_push_host'] = @host
|
207
|
+
end
|
208
|
+
|
209
|
+
@api_key = "PRIVKEY"
|
210
|
+
ENV["GEM_HOST_API_KEY"] = "PRIVKEY"
|
211
|
+
|
212
|
+
@response = "Successfully registered gem: freebird (1.0.1)"
|
213
|
+
@fetcher.data["#{@host}/api/v1/gems"] = [@response, 200, 'OK']
|
214
|
+
send_battery
|
215
|
+
end
|
216
|
+
|
202
217
|
def test_sending_gem_to_allowed_push_host_with_basic_credentials
|
203
218
|
@sanitized_host = "http://privategemserver.example"
|
204
219
|
@host = "http://user:password@privategemserver.example"
|
@@ -38,6 +38,7 @@ class TestGemCommandsSetupCommand < Gem::TestCase
|
|
38
38
|
FileUtils.mkdir_p 'default/gems'
|
39
39
|
|
40
40
|
gemspec = Gem::Specification.new
|
41
|
+
gemspec.author = "Us"
|
41
42
|
gemspec.name = "bundler"
|
42
43
|
gemspec.version = BUNDLER_VERS
|
43
44
|
gemspec.bindir = "exe"
|
@@ -166,16 +167,19 @@ class TestGemCommandsSetupCommand < Gem::TestCase
|
|
166
167
|
def test_install_default_bundler_gem
|
167
168
|
@cmd.extend FileUtils
|
168
169
|
|
169
|
-
@
|
170
|
+
bin_dir = File.join(@gemhome, 'bin')
|
171
|
+
@cmd.install_default_bundler_gem bin_dir
|
170
172
|
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
spec = Gem::Specification.load(default_spec_path)
|
173
|
+
bundler_spec = Gem::Specification.load("bundler/bundler.gemspec")
|
174
|
+
default_spec_path = File.join(Gem::Specification.default_specifications_dir, "#{bundler_spec.full_name}.gemspec")
|
175
|
+
spec = Gem::Specification.load(default_spec_path)
|
175
176
|
|
176
|
-
|
177
|
-
|
177
|
+
spec.executables.each do |e|
|
178
|
+
if Gem.win_platform?
|
179
|
+
assert_path_exists File.join(bin_dir, "#{e}.bat")
|
178
180
|
end
|
181
|
+
|
182
|
+
assert_path_exists File.join bin_dir, e
|
179
183
|
end
|
180
184
|
|
181
185
|
default_dir = Gem::Specification.default_specifications_dir
|
@@ -192,6 +192,62 @@ class TestGemCommandsUninstallCommand < Gem::InstallerTestCase
|
|
192
192
|
assert File.exist? File.join(@gemhome, 'bin', 'executable')
|
193
193
|
end
|
194
194
|
|
195
|
+
def test_uninstall_selection
|
196
|
+
ui = Gem::MockGemUi.new "1\n"
|
197
|
+
|
198
|
+
util_make_gems
|
199
|
+
|
200
|
+
list = Gem::Specification.find_all_by_name 'a'
|
201
|
+
|
202
|
+
@cmd.options[:args] = ['a']
|
203
|
+
|
204
|
+
use_ui ui do
|
205
|
+
@cmd.execute
|
206
|
+
end
|
207
|
+
|
208
|
+
updated_list = Gem::Specification.find_all_by_name('a')
|
209
|
+
assert_equal list.length - 1, updated_list.length
|
210
|
+
|
211
|
+
assert_match ' 1. a-1', ui.output
|
212
|
+
assert_match ' 2. a-2', ui.output
|
213
|
+
assert_match ' 3. a-3.a', ui.output
|
214
|
+
assert_match ' 4. All versions', ui.output
|
215
|
+
assert_match 'uninstalled a-1', ui.output
|
216
|
+
end
|
217
|
+
|
218
|
+
def test_uninstall_selection_multiple_gems
|
219
|
+
ui = Gem::MockGemUi.new "1\n"
|
220
|
+
|
221
|
+
util_make_gems
|
222
|
+
|
223
|
+
a_list = Gem::Specification.find_all_by_name('a')
|
224
|
+
b_list = Gem::Specification.find_all_by_name('b')
|
225
|
+
list = a_list + b_list
|
226
|
+
|
227
|
+
@cmd.options[:args] = ['a', 'b']
|
228
|
+
|
229
|
+
use_ui ui do
|
230
|
+
@cmd.execute
|
231
|
+
end
|
232
|
+
|
233
|
+
updated_a_list = Gem::Specification.find_all_by_name('a')
|
234
|
+
updated_b_list = Gem::Specification.find_all_by_name('b')
|
235
|
+
updated_list = updated_a_list + updated_b_list
|
236
|
+
|
237
|
+
assert_equal list.length - 2, updated_list.length
|
238
|
+
|
239
|
+
out = ui.output.split("\n")
|
240
|
+
assert_match 'uninstalled b-2', out.shift
|
241
|
+
assert_match '', out.shift
|
242
|
+
assert_match 'Select gem to uninstall:', out.shift
|
243
|
+
assert_match ' 1. a-1', out.shift
|
244
|
+
assert_match ' 2. a-2', out.shift
|
245
|
+
assert_match ' 3. a-3.a', out.shift
|
246
|
+
assert_match ' 4. All versions', out.shift
|
247
|
+
assert_match 'uninstalled a-1', out.shift
|
248
|
+
assert_empty out
|
249
|
+
end
|
250
|
+
|
195
251
|
def test_execute_with_force_and_without_version_uninstalls_everything
|
196
252
|
ui = Gem::MockGemUi.new "y\n"
|
197
253
|
|
@@ -246,7 +302,7 @@ class TestGemCommandsUninstallCommand < Gem::InstallerTestCase
|
|
246
302
|
gemhome2 = "#{@gemhome}2"
|
247
303
|
|
248
304
|
a_4, = util_gem 'a', 4
|
249
|
-
install_gem a_4
|
305
|
+
install_gem a_4
|
250
306
|
|
251
307
|
Gem::Specification.dirs = [@gemhome, gemhome2]
|
252
308
|
|
@@ -264,6 +320,29 @@ class TestGemCommandsUninstallCommand < Gem::InstallerTestCase
|
|
264
320
|
assert_equal %w[default-1], Gem::Specification.all_names.sort
|
265
321
|
end
|
266
322
|
|
323
|
+
def test_execute_outside_gem_home
|
324
|
+
ui = Gem::MockGemUi.new "y\n"
|
325
|
+
|
326
|
+
gemhome2 = "#{@gemhome}2"
|
327
|
+
|
328
|
+
a_4, = util_gem 'a', 4
|
329
|
+
install_gem a_4 , :install_dir => gemhome2
|
330
|
+
|
331
|
+
Gem::Specification.dirs = [@gemhome, gemhome2]
|
332
|
+
|
333
|
+
assert_includes Gem::Specification.all_names, 'a-4'
|
334
|
+
|
335
|
+
@cmd.options[:args] = ['a:4']
|
336
|
+
|
337
|
+
e = assert_raises Gem::InstallError do
|
338
|
+
use_ui ui do
|
339
|
+
@cmd.execute
|
340
|
+
end
|
341
|
+
end
|
342
|
+
|
343
|
+
assert_includes e.message, "a is not installed in GEM_HOME"
|
344
|
+
end
|
345
|
+
|
267
346
|
def test_handle_options
|
268
347
|
@cmd.handle_options %w[]
|
269
348
|
|
@@ -25,7 +25,7 @@ class TestGemExtCmakeBuilder < Gem::TestCase
|
|
25
25
|
File.open File.join(@ext, 'CMakeLists.txt'), 'w' do |cmakelists|
|
26
26
|
cmakelists.write <<-eo_cmake
|
27
27
|
cmake_minimum_required(VERSION 2.6)
|
28
|
-
project(self_build
|
28
|
+
project(self_build NONE)
|
29
29
|
install (FILES test.txt DESTINATION bin)
|
30
30
|
eo_cmake
|
31
31
|
end
|
@@ -37,6 +37,13 @@ class TestGemIndexer < Gem::TestCase
|
|
37
37
|
@indexer = Gem::Indexer.new(@tempdir)
|
38
38
|
end
|
39
39
|
|
40
|
+
def teardown
|
41
|
+
super
|
42
|
+
|
43
|
+
util_clear_gems
|
44
|
+
util_clear_default_gems
|
45
|
+
end
|
46
|
+
|
40
47
|
def test_initialize
|
41
48
|
assert_equal @tempdir, @indexer.dest_directory
|
42
49
|
assert_match %r{#{Dir.mktmpdir('gem_generate_index').match(/.*-/)}}, @indexer.directory
|
@@ -96,8 +103,8 @@ class TestGemIndexer < Gem::TestCase
|
|
96
103
|
quickdir = File.join @tempdir, 'quick'
|
97
104
|
marshal_quickdir = File.join quickdir, "Marshal.#{@marshal_version}"
|
98
105
|
|
99
|
-
|
100
|
-
|
106
|
+
assert_directory_exists quickdir
|
107
|
+
assert_directory_exists marshal_quickdir
|
101
108
|
|
102
109
|
assert_indexed marshal_quickdir, "#{File.basename(@a1.spec_file)}.rz"
|
103
110
|
assert_indexed marshal_quickdir, "#{File.basename(@a2.spec_file)}.rz"
|
@@ -126,8 +133,8 @@ class TestGemIndexer < Gem::TestCase
|
|
126
133
|
quickdir = File.join @tempdir, 'quick'
|
127
134
|
marshal_quickdir = File.join quickdir, "Marshal.#{@marshal_version}"
|
128
135
|
|
129
|
-
|
130
|
-
|
136
|
+
assert_directory_exists quickdir, 'quickdir should be directory'
|
137
|
+
assert_directory_exists marshal_quickdir
|
131
138
|
|
132
139
|
refute_indexed quickdir, "index"
|
133
140
|
refute_indexed quickdir, "index.rz"
|
@@ -172,8 +179,8 @@ class TestGemIndexer < Gem::TestCase
|
|
172
179
|
quickdir = File.join @tempdir, 'quick'
|
173
180
|
marshal_quickdir = File.join quickdir, "Marshal.#{@marshal_version}"
|
174
181
|
|
175
|
-
|
176
|
-
|
182
|
+
assert_directory_exists quickdir
|
183
|
+
assert_directory_exists marshal_quickdir
|
177
184
|
|
178
185
|
assert_indexed marshal_quickdir, "#{File.basename(@a1.spec_file)}.rz"
|
179
186
|
assert_indexed marshal_quickdir, "#{File.basename(@a2.spec_file)}.rz"
|
@@ -308,8 +315,8 @@ class TestGemIndexer < Gem::TestCase
|
|
308
315
|
quickdir = File.join @tempdir, 'quick'
|
309
316
|
marshal_quickdir = File.join quickdir, "Marshal.#{@marshal_version}"
|
310
317
|
|
311
|
-
|
312
|
-
|
318
|
+
assert_directory_exists quickdir
|
319
|
+
assert_directory_exists marshal_quickdir
|
313
320
|
|
314
321
|
@d2_1 = util_spec 'd', '2.1'
|
315
322
|
util_build_gem @d2_1
|
@@ -163,6 +163,8 @@ gem 'other', version
|
|
163
163
|
|
164
164
|
wrapper = File.read installed_exec
|
165
165
|
assert_match %r|generated by RubyGems|, wrapper
|
166
|
+
ensure
|
167
|
+
Gem::Installer.exec_format = nil
|
166
168
|
end
|
167
169
|
|
168
170
|
def test_check_executable_overwrite_other_gem
|
@@ -311,7 +313,7 @@ gem 'other', version
|
|
311
313
|
@installer.wrappers = true
|
312
314
|
|
313
315
|
@spec.executables = %w[executable]
|
314
|
-
@spec.bindir = '
|
316
|
+
@spec.bindir = 'bin'
|
315
317
|
|
316
318
|
exec_file = @installer.formatted_program_filename 'executable'
|
317
319
|
exec_path = File.join @spec.gem_dir, exec_file
|
@@ -323,7 +325,7 @@ gem 'other', version
|
|
323
325
|
|
324
326
|
@installer.generate_bin
|
325
327
|
|
326
|
-
|
328
|
+
assert_directory_exists (util_inst_bindir)
|
327
329
|
installed_exec = File.join(util_inst_bindir, 'executable')
|
328
330
|
assert_path_exists installed_exec
|
329
331
|
assert_equal mask, File.stat(installed_exec).mode unless win_platform?
|
@@ -364,7 +366,7 @@ gem 'other', version
|
|
364
366
|
@installer.gem_dir = @spec.gem_dir
|
365
367
|
|
366
368
|
@installer.generate_bin
|
367
|
-
|
369
|
+
assert_directory_exists util_inst_bindir
|
368
370
|
installed_exec = File.join util_inst_bindir, 'executable'
|
369
371
|
assert_path_exists installed_exec
|
370
372
|
assert_equal mask, File.stat(installed_exec).mode unless win_platform?
|
@@ -381,7 +383,7 @@ gem 'other', version
|
|
381
383
|
|
382
384
|
Gem::Installer.exec_format = 'foo-%s-bar'
|
383
385
|
@installer.generate_bin
|
384
|
-
|
386
|
+
assert_directory_exists util_inst_bindir
|
385
387
|
installed_exec = File.join util_inst_bindir, 'foo-executable-bar'
|
386
388
|
assert_path_exists installed_exec
|
387
389
|
ensure
|
@@ -395,7 +397,7 @@ gem 'other', version
|
|
395
397
|
|
396
398
|
Gem::Installer.exec_format = 'foo-%s-bar'
|
397
399
|
@installer.generate_bin
|
398
|
-
|
400
|
+
assert_directory_exists util_inst_bindir
|
399
401
|
installed_exec = File.join util_inst_bindir, 'executable'
|
400
402
|
assert_path_exists installed_exec
|
401
403
|
ensure
|
@@ -494,7 +496,7 @@ gem 'other', version
|
|
494
496
|
end
|
495
497
|
|
496
498
|
@installer.generate_bin
|
497
|
-
|
499
|
+
assert_directory_exists util_inst_bindir
|
498
500
|
assert_path_exists installed_exec
|
499
501
|
assert_equal mask, File.stat(installed_exec).mode unless win_platform?
|
500
502
|
|
@@ -512,7 +514,7 @@ gem 'other', version
|
|
512
514
|
@installer.gem_dir = @spec.gem_dir
|
513
515
|
|
514
516
|
@installer.generate_bin
|
515
|
-
|
517
|
+
assert_directory_exists util_inst_bindir
|
516
518
|
installed_exec = File.join util_inst_bindir, 'executable'
|
517
519
|
assert_equal true, File.symlink?(installed_exec)
|
518
520
|
assert_equal(File.join(@spec.gem_dir, 'bin', 'executable'),
|
@@ -664,7 +666,7 @@ gem 'other', version
|
|
664
666
|
@installer.generate_bin
|
665
667
|
end
|
666
668
|
|
667
|
-
|
669
|
+
assert_directory_exists util_inst_bindir
|
668
670
|
installed_exec = File.join(util_inst_bindir, 'executable')
|
669
671
|
assert_path_exists installed_exec
|
670
672
|
|
@@ -740,13 +742,13 @@ gem 'other', version
|
|
740
742
|
rakefile = File.join gemdir, 'ext', 'a', 'Rakefile'
|
741
743
|
spec_file = File.join @gemhome, 'specifications', @spec.spec_name
|
742
744
|
|
743
|
-
Gem.pre_install do
|
745
|
+
Gem.pre_install do
|
744
746
|
refute_path_exists cache_file, 'cache file must not exist yet'
|
745
747
|
refute_path_exists spec_file, 'spec file must not exist yet'
|
746
748
|
true
|
747
749
|
end
|
748
750
|
|
749
|
-
Gem.post_build do
|
751
|
+
Gem.post_build do
|
750
752
|
assert_path_exists gemdir, 'gem install dir must exist'
|
751
753
|
assert_path_exists rakefile, 'gem executable must exist'
|
752
754
|
refute_path_exists stub_exe, 'gem executable must not exist'
|
@@ -754,7 +756,7 @@ gem 'other', version
|
|
754
756
|
true
|
755
757
|
end
|
756
758
|
|
757
|
-
Gem.post_install do
|
759
|
+
Gem.post_install do
|
758
760
|
assert_path_exists cache_file, 'cache file must exist'
|
759
761
|
assert_path_exists spec_file, 'spec file must exist'
|
760
762
|
end
|
@@ -975,16 +977,16 @@ gem 'other', version
|
|
975
977
|
|
976
978
|
def test_install_missing_dirs
|
977
979
|
FileUtils.rm_f File.join(Gem.dir, 'cache')
|
978
|
-
FileUtils.rm_f File.join(Gem.dir, '
|
980
|
+
FileUtils.rm_f File.join(Gem.dir, 'doc')
|
979
981
|
FileUtils.rm_f File.join(Gem.dir, 'specifications')
|
980
982
|
|
981
983
|
use_ui @ui do
|
982
984
|
@installer.install
|
983
985
|
end
|
984
986
|
|
985
|
-
|
986
|
-
|
987
|
-
|
987
|
+
assert_directory_exists File.join(Gem.dir, 'cache')
|
988
|
+
assert_directory_exists File.join(Gem.dir, 'doc')
|
989
|
+
assert_directory_exists File.join(Gem.dir, 'specifications')
|
988
990
|
|
989
991
|
assert_path_exists File.join @gemhome, 'cache', @spec.file_name
|
990
992
|
assert_path_exists File.join @gemhome, 'specifications', @spec.spec_name
|
@@ -1489,6 +1491,8 @@ gem 'other', version
|
|
1489
1491
|
end
|
1490
1492
|
|
1491
1493
|
def test_pre_install_checks_malicious_extensions_before_eval
|
1494
|
+
skip "mswin environment disallow to create file contained the carriage return code." if Gem.win_platform?
|
1495
|
+
|
1492
1496
|
spec = util_spec "malicious", '1'
|
1493
1497
|
def spec.full_name # so the spec is buildable
|
1494
1498
|
"malicious-1"
|
@@ -1818,28 +1822,87 @@ gem 'other', version
|
|
1818
1822
|
assert_predicate spec, :default_gem?
|
1819
1823
|
end
|
1820
1824
|
|
1821
|
-
def
|
1825
|
+
def test_default_gem_without_wrappers
|
1822
1826
|
FileUtils.rm_f File.join(Gem.dir, 'specifications')
|
1823
1827
|
|
1824
|
-
@installer.wrappers =
|
1828
|
+
@installer.wrappers = false
|
1825
1829
|
@installer.options[:install_as_default] = true
|
1826
1830
|
@installer.gem_dir = @spec.gem_dir
|
1827
|
-
@installer.generate_bin
|
1828
1831
|
|
1829
1832
|
use_ui @ui do
|
1830
1833
|
@installer.install
|
1831
1834
|
end
|
1832
1835
|
|
1833
|
-
|
1834
|
-
installed_exec = File.join
|
1836
|
+
assert_directory_exists File.join(@spec.gem_dir, 'bin')
|
1837
|
+
installed_exec = File.join @spec.gem_dir, 'bin', 'executable'
|
1835
1838
|
assert_path_exists installed_exec
|
1836
1839
|
|
1837
|
-
|
1838
|
-
|
1840
|
+
assert_directory_exists File.join(Gem.default_dir, 'specifications')
|
1841
|
+
assert_directory_exists File.join(Gem.default_dir, 'specifications', 'default')
|
1839
1842
|
|
1840
1843
|
default_spec = eval File.read File.join(Gem.default_dir, 'specifications', 'default', 'a-2.gemspec')
|
1841
1844
|
assert_equal Gem::Version.new("2"), default_spec.version
|
1842
1845
|
assert_equal ['bin/executable'], default_spec.files
|
1846
|
+
|
1847
|
+
assert_directory_exists util_inst_bindir
|
1848
|
+
|
1849
|
+
installed_exec = File.join util_inst_bindir, 'executable'
|
1850
|
+
assert_path_exists installed_exec
|
1851
|
+
|
1852
|
+
wrapper = File.read installed_exec
|
1853
|
+
refute_match %r|generated by RubyGems|, wrapper
|
1854
|
+
end
|
1855
|
+
|
1856
|
+
def test_default_gem_with_wrappers
|
1857
|
+
FileUtils.rm_f File.join(Gem.dir, 'specifications')
|
1858
|
+
|
1859
|
+
@installer.wrappers = true
|
1860
|
+
@installer.options[:install_as_default] = true
|
1861
|
+
@installer.gem_dir = @spec.gem_dir
|
1862
|
+
|
1863
|
+
use_ui @ui do
|
1864
|
+
@installer.install
|
1865
|
+
end
|
1866
|
+
|
1867
|
+
assert_directory_exists util_inst_bindir
|
1868
|
+
|
1869
|
+
installed_exec = File.join util_inst_bindir, 'executable'
|
1870
|
+
assert_path_exists installed_exec
|
1871
|
+
|
1872
|
+
wrapper = File.read installed_exec
|
1873
|
+
assert_match %r|generated by RubyGems|, wrapper
|
1874
|
+
end
|
1875
|
+
|
1876
|
+
def test_default_gem_with_exe_as_bindir
|
1877
|
+
FileUtils.rm_f File.join(Gem.dir, 'specifications')
|
1878
|
+
|
1879
|
+
@spec = quick_gem 'c' do |spec|
|
1880
|
+
util_make_exec spec, '#!/usr/bin/ruby', 'exe'
|
1881
|
+
end
|
1882
|
+
|
1883
|
+
util_build_gem @spec
|
1884
|
+
|
1885
|
+
@spec.cache_file
|
1886
|
+
|
1887
|
+
installer = util_installer @spec, @gemhome
|
1888
|
+
|
1889
|
+
installer.options[:install_as_default] = true
|
1890
|
+
installer.gem_dir = @spec.gem_dir
|
1891
|
+
|
1892
|
+
use_ui @ui do
|
1893
|
+
installer.install
|
1894
|
+
end
|
1895
|
+
|
1896
|
+
assert_directory_exists File.join(@spec.gem_dir, 'exe')
|
1897
|
+
installed_exec = File.join @spec.gem_dir, 'exe', 'executable'
|
1898
|
+
assert_path_exists installed_exec
|
1899
|
+
|
1900
|
+
assert_directory_exists File.join(Gem.default_dir, 'specifications')
|
1901
|
+
assert_directory_exists File.join(Gem.default_dir, 'specifications', 'default')
|
1902
|
+
|
1903
|
+
default_spec = eval File.read File.join(Gem.default_dir, 'specifications', 'default', 'c-2.gemspec')
|
1904
|
+
assert_equal Gem::Version.new("2"), default_spec.version
|
1905
|
+
assert_equal ['exe/executable'], default_spec.files
|
1843
1906
|
end
|
1844
1907
|
|
1845
1908
|
def old_ruby_required(requirement)
|