rubygems-update 1.3.1 → 1.3.2
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of rubygems-update might be problematic. Click here for more details.
- data.tar.gz.sig +0 -0
- data/.autotest +24 -0
- data/.document +4 -3
- data/ChangeLog +382 -1
- data/Manifest.txt +214 -0
- data/README +1 -49
- data/Rakefile +124 -191
- data/bin/gem +1 -4
- data/cruise_config.rb +22 -0
- data/doc/release_notes/rel_1_3_1.rdoc +3 -3
- data/doc/release_notes/rel_1_3_2.rdoc +119 -0
- data/lib/gauntlet_rubygems.rb +50 -0
- data/lib/rubygems.rb +250 -25
- data/lib/rubygems/builder.rb +62 -60
- data/lib/rubygems/command.rb +421 -319
- data/lib/rubygems/command_manager.rb +153 -125
- data/lib/rubygems/commands/check_command.rb +12 -7
- data/lib/rubygems/commands/cleanup_command.rb +11 -2
- data/lib/rubygems/commands/contents_command.rb +42 -18
- data/lib/rubygems/commands/generate_index_command.rb +91 -15
- data/lib/rubygems/commands/install_command.rb +33 -47
- data/lib/rubygems/commands/query_command.rb +36 -20
- data/lib/rubygems/commands/rdoc_command.rb +62 -68
- data/lib/rubygems/commands/search_command.rb +26 -32
- data/lib/rubygems/commands/setup_command.rb +353 -0
- data/lib/rubygems/commands/sources_command.rb +5 -0
- data/lib/rubygems/commands/specification_command.rb +23 -3
- data/lib/rubygems/commands/uninstall_command.rb +71 -61
- data/lib/rubygems/commands/unpack_command.rb +14 -12
- data/lib/rubygems/commands/update_command.rb +26 -5
- data/lib/rubygems/defaults.rb +16 -3
- data/lib/rubygems/dependency.rb +38 -7
- data/lib/rubygems/dependency_installer.rb +7 -4
- data/lib/rubygems/digest/digest_adapter.rb +42 -33
- data/lib/rubygems/digest/sha1.rb +6 -1
- data/lib/rubygems/digest/sha2.rb +5 -0
- data/lib/rubygems/doc_manager.rb +31 -11
- data/lib/rubygems/ext/ext_conf_builder.rb +2 -1
- data/lib/rubygems/ext/rake_builder.rb +6 -2
- data/lib/rubygems/format.rb +63 -63
- data/lib/rubygems/gem_openssl.rb +14 -2
- data/lib/rubygems/gem_path_searcher.rb +7 -3
- data/lib/rubygems/gem_runner.rb +59 -39
- data/lib/rubygems/indexer.rb +450 -109
- data/lib/rubygems/install_update_options.rb +13 -1
- data/lib/rubygems/installer.rb +25 -22
- data/lib/rubygems/local_remote_options.rb +5 -3
- data/lib/rubygems/old_format.rb +124 -120
- data/lib/rubygems/package/tar_header.rb +25 -3
- data/lib/rubygems/package/tar_input.rb +5 -5
- data/lib/rubygems/package/tar_output.rb +2 -0
- data/lib/rubygems/package/tar_reader.rb +19 -0
- data/lib/rubygems/package/tar_reader/entry.rb +43 -0
- data/lib/rubygems/package/tar_writer.rb +65 -3
- data/lib/rubygems/package_task.rb +117 -0
- data/lib/rubygems/platform.rb +12 -8
- data/lib/rubygems/remote_fetcher.rb +43 -24
- data/lib/rubygems/require_paths_builder.rb +14 -12
- data/lib/rubygems/requirement.rb +15 -6
- data/lib/rubygems/rubygems_version.rb +14 -1
- data/lib/rubygems/source_index.rb +38 -16
- data/lib/rubygems/source_info_cache_entry.rb +2 -2
- data/lib/rubygems/spec_fetcher.rb +43 -20
- data/lib/rubygems/specification.rb +1122 -947
- data/lib/rubygems/text.rb +30 -0
- data/lib/rubygems/timer.rb +14 -11
- data/lib/rubygems/uninstaller.rb +25 -5
- data/lib/rubygems/user_interaction.rb +294 -264
- data/lib/rubygems/validator.rb +70 -36
- data/lib/rubygems/version.rb +97 -33
- data/lib/rubygems/version_option.rb +1 -0
- data/setup.rb +11 -306
- data/test/foo/discover.rb +0 -0
- data/test/gem_installer_test_case.rb +22 -11
- data/test/gem_package_tar_test_case.rb +0 -14
- data/test/gemutilities.rb +89 -8
- data/test/mockgemui.rb +2 -1
- data/test/rubygems_plugin.rb +16 -0
- data/test/test_gem.rb +107 -36
- data/test/test_gem_command.rb +3 -13
- data/test/test_gem_command_manager.rb +1 -14
- data/test/test_gem_commands_cert_command.rb +1 -1
- data/test/test_gem_commands_contents_command.rb +63 -0
- data/test/test_gem_commands_environment_command.rb +1 -1
- data/test/test_gem_commands_generate_index_command.rb +104 -1
- data/test/test_gem_commands_install_command.rb +95 -0
- data/test/test_gem_commands_pristine_command.rb +3 -3
- data/test/test_gem_commands_query_command.rb +46 -0
- data/test/test_gem_commands_sources_command.rb +9 -5
- data/test/test_gem_commands_specification_command.rb +31 -0
- data/test/test_gem_commands_uninstall_command.rb +3 -2
- data/test/test_gem_commands_unpack_command.rb +3 -2
- data/test/test_gem_commands_update_command.rb +12 -7
- data/test/test_gem_dependency.rb +62 -11
- data/test/test_gem_dependency_installer.rb +18 -5
- data/test/test_gem_dependency_list.rb +6 -6
- data/test/test_gem_doc_manager.rb +7 -1
- data/test/test_gem_ext_configure_builder.rb +8 -10
- data/test/test_gem_ext_ext_conf_builder.rb +14 -8
- data/test/test_gem_gem_path_searcher.rb +1 -1
- data/test/test_gem_gem_runner.rb +11 -0
- data/test/test_gem_indexer.rb +398 -21
- data/test/test_gem_install_update_options.rb +20 -6
- data/test/test_gem_installer.rb +22 -14
- data/test/test_gem_local_remote_options.rb +2 -1
- data/test/test_gem_package_tar_header.rb +3 -3
- data/test/test_gem_package_tar_input.rb +3 -3
- data/test/test_gem_package_tar_output.rb +2 -2
- data/test/test_gem_package_task.rb +70 -0
- data/test/test_gem_platform.rb +12 -6
- data/test/test_gem_remote_fetcher.rb +23 -1
- data/test/test_gem_source_index.rb +32 -21
- data/test/test_gem_spec_fetcher.rb +77 -5
- data/test/test_gem_specification.rb +274 -1
- data/test/test_gem_uninstaller.rb +34 -4
- data/test/test_gem_version.rb +94 -4
- data/test/test_gem_version_option.rb +13 -0
- data/test/test_kernel.rb +4 -4
- data/util/CL2notes +56 -0
- data/util/gem_prelude.rb.template +251 -0
- metadata +30 -20
- metadata.gz.sig +3 -4
- data/TODO +0 -1
- data/scripts/buildtests.rb +0 -31
- data/scripts/gemdoc.rb +0 -67
- data/scripts/runtest.rb +0 -40
- data/scripts/specdoc.rb +0 -171
- data/scripts/upload_gemdoc.rb +0 -140
File without changes
|
@@ -1,4 +1,3 @@
|
|
1
|
-
require 'minitest/unit'
|
2
1
|
require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities')
|
3
2
|
require 'rubygems/installer'
|
4
3
|
|
@@ -20,17 +19,17 @@ class GemInstallerTestCase < RubyGemTestCase
|
|
20
19
|
def setup
|
21
20
|
super
|
22
21
|
|
23
|
-
@spec = quick_gem
|
22
|
+
@spec = quick_gem 'a'
|
24
23
|
@gem = File.join @tempdir, "#{@spec.full_name}.gem"
|
25
24
|
|
26
|
-
|
27
|
-
FileUtils.mv File.join(@gemhome, 'cache', "#{@spec.full_name}.gem"),
|
28
|
-
@tempdir
|
25
|
+
@installer = util_installer @spec, @gem, @gemhome
|
29
26
|
|
30
|
-
@
|
31
|
-
@
|
32
|
-
|
33
|
-
@
|
27
|
+
@user_spec = quick_gem 'b'
|
28
|
+
@user_gem = File.join @tempdir, "#{@user_spec.full_name}.gem"
|
29
|
+
|
30
|
+
@user_installer = util_installer @user_spec, @user_gem, Gem.user_dir
|
31
|
+
@user_installer.gem_dir = File.join(Gem.user_dir, 'gems',
|
32
|
+
@user_spec.full_name)
|
34
33
|
end
|
35
34
|
|
36
35
|
def util_gem_bindir(version = '2')
|
@@ -49,8 +48,7 @@ class GemInstallerTestCase < RubyGemTestCase
|
|
49
48
|
@spec.executables = ["my_exec"]
|
50
49
|
|
51
50
|
FileUtils.mkdir_p util_gem_bindir(version)
|
52
|
-
|
53
|
-
exec_path = File.join util_gem_bindir(version), exec_file
|
51
|
+
exec_path = File.join util_gem_bindir(version), "my_exec"
|
54
52
|
File.open exec_path, 'w' do |f|
|
55
53
|
f.puts shebang
|
56
54
|
end
|
@@ -82,5 +80,18 @@ class GemInstallerTestCase < RubyGemTestCase
|
|
82
80
|
@installer = Gem::Installer.new @gem
|
83
81
|
end
|
84
82
|
|
83
|
+
def util_installer(spec, gem_path, gem_home)
|
84
|
+
util_build_gem spec
|
85
|
+
FileUtils.mv File.join(@gemhome, 'cache', "#{spec.full_name}.gem"),
|
86
|
+
@tempdir
|
87
|
+
|
88
|
+
installer = Gem::Installer.new gem_path
|
89
|
+
installer.gem_dir = util_gem_dir
|
90
|
+
installer.gem_home = gem_home
|
91
|
+
installer.spec = spec
|
92
|
+
|
93
|
+
installer
|
94
|
+
end
|
95
|
+
|
85
96
|
end
|
86
97
|
|
@@ -1,20 +1,6 @@
|
|
1
1
|
require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities')
|
2
2
|
require 'rubygems/package'
|
3
3
|
|
4
|
-
class File
|
5
|
-
|
6
|
-
# straight from setup.rb
|
7
|
-
def self.dir?(path)
|
8
|
-
# for corrupted windows stat()
|
9
|
-
File.directory?((path[-1,1] == '/') ? path : path + '/')
|
10
|
-
end
|
11
|
-
|
12
|
-
def self.read_b(name)
|
13
|
-
File.open(name, "rb") { |f| f.read }
|
14
|
-
end
|
15
|
-
|
16
|
-
end
|
17
|
-
|
18
4
|
class TarTestCase < RubyGemTestCase
|
19
5
|
|
20
6
|
def ASCIIZ(str, length)
|
data/test/gemutilities.rb
CHANGED
@@ -11,15 +11,24 @@ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
|
11
11
|
require 'rubygems'
|
12
12
|
require 'fileutils'
|
13
13
|
begin
|
14
|
+
gem 'minitest', '>= 1.3.1'
|
14
15
|
require 'minitest/unit'
|
15
|
-
rescue LoadError
|
16
|
-
warn "Install minitest gem"
|
16
|
+
rescue Gem::LoadError
|
17
|
+
warn "Install minitest gem >= 1.3.1"
|
17
18
|
raise
|
18
19
|
end
|
19
20
|
require 'tmpdir'
|
20
21
|
require 'uri'
|
21
22
|
require 'rubygems/package'
|
22
23
|
require 'rubygems/test_utilities'
|
24
|
+
require 'pp'
|
25
|
+
|
26
|
+
begin
|
27
|
+
gem 'rdoc'
|
28
|
+
rescue Gem::LoadError
|
29
|
+
end
|
30
|
+
|
31
|
+
require 'rdoc/rdoc'
|
23
32
|
|
24
33
|
require File.join(File.expand_path(File.dirname(__FILE__)), 'mockgemui')
|
25
34
|
|
@@ -83,7 +92,7 @@ class RubyGemTestCase < MiniTest::Unit::TestCase
|
|
83
92
|
Gem::SpecFetcher.fetcher = nil
|
84
93
|
|
85
94
|
@orig_BASERUBY = Gem::ConfigMap[:BASERUBY]
|
86
|
-
Gem::ConfigMap[:BASERUBY] = Gem::ConfigMap[:
|
95
|
+
Gem::ConfigMap[:BASERUBY] = Gem::ConfigMap[:ruby_install_name]
|
87
96
|
|
88
97
|
@orig_arch = Gem::ConfigMap[:arch]
|
89
98
|
|
@@ -158,6 +167,13 @@ class RubyGemTestCase < MiniTest::Unit::TestCase
|
|
158
167
|
Gem::Installer.new(gem, :wrappers => true).install
|
159
168
|
end
|
160
169
|
|
170
|
+
def mu_pp(obj)
|
171
|
+
s = ''
|
172
|
+
s = PP.pp obj, s
|
173
|
+
s = s.force_encoding(Encoding.default_external) if defined? Encoding
|
174
|
+
s.chomp
|
175
|
+
end
|
176
|
+
|
161
177
|
def prep_cache_files(lc)
|
162
178
|
@usr_si ||= Gem::SourceIndex.new
|
163
179
|
@usr_sice ||= Gem::SourceInfoCacheEntry.new @usr_si, 0
|
@@ -290,13 +306,28 @@ class RubyGemTestCase < MiniTest::Unit::TestCase
|
|
290
306
|
out.string
|
291
307
|
end
|
292
308
|
|
293
|
-
def util_make_gems
|
309
|
+
def util_make_gems(prerelease = false)
|
310
|
+
@a1 = quick_gem 'a', '1' do |s|
|
311
|
+
s.files = %w[lib/code.rb]
|
312
|
+
s.require_paths = %w[lib]
|
313
|
+
s.date = Gem::Specification::TODAY - 86400
|
314
|
+
s.homepage = 'http://a.example.com'
|
315
|
+
s.email = %w[example@example.com example2@example.com]
|
316
|
+
s.authors = %w[Example Example2]
|
317
|
+
s.description = <<-DESC
|
318
|
+
This line is really, really long. So long, in fact, that it is more than eighty characters long! The purpose of this line is for testing wrapping behavior because sometimes people don't wrap their text to eighty characters. Without the wrapping, the text might not look good in the RSS feed.
|
319
|
+
|
320
|
+
Also, a list:
|
321
|
+
* An entry that's actually kind of sort
|
322
|
+
* an entry that's really long, which will probably get wrapped funny. That's ok, somebody wasn't thinking straight when they made it more than eighty characters.
|
323
|
+
DESC
|
324
|
+
end
|
325
|
+
|
294
326
|
init = proc do |s|
|
295
327
|
s.files = %w[lib/code.rb]
|
296
328
|
s.require_paths = %w[lib]
|
297
329
|
end
|
298
330
|
|
299
|
-
@a1 = quick_gem('a', '1', &init)
|
300
331
|
@a2 = quick_gem('a', '2', &init)
|
301
332
|
@a_evil9 = quick_gem('a_evil', '9', &init)
|
302
333
|
@b2 = quick_gem('b', '2', &init)
|
@@ -308,6 +339,13 @@ class RubyGemTestCase < MiniTest::Unit::TestCase
|
|
308
339
|
s.instance_variable_set :@original_platform, 'i386-linux'
|
309
340
|
end
|
310
341
|
|
342
|
+
if prerelease
|
343
|
+
@a2_pre = quick_gem('a', '2.a', &init)
|
344
|
+
write_file File.join(*%W[gems #{@a2_pre.original_name} lib code.rb]) do
|
345
|
+
end
|
346
|
+
util_build_gem @a2_pre
|
347
|
+
end
|
348
|
+
|
311
349
|
write_file File.join(*%W[gems #{@a1.original_name} lib code.rb]) do end
|
312
350
|
write_file File.join(*%W[gems #{@a2.original_name} lib code.rb]) do end
|
313
351
|
write_file File.join(*%W[gems #{@b2.original_name} lib code.rb]) do end
|
@@ -334,14 +372,14 @@ class RubyGemTestCase < MiniTest::Unit::TestCase
|
|
334
372
|
platform
|
335
373
|
end
|
336
374
|
|
337
|
-
def util_setup_fake_fetcher
|
375
|
+
def util_setup_fake_fetcher(prerelease = false)
|
338
376
|
require 'zlib'
|
339
377
|
require 'socket'
|
340
378
|
require 'rubygems/remote_fetcher'
|
341
379
|
|
342
380
|
@fetcher = Gem::FakeFetcher.new
|
343
381
|
|
344
|
-
util_make_gems
|
382
|
+
util_make_gems(prerelease)
|
345
383
|
|
346
384
|
@all_gems = [@a1, @a2, @a_evil9, @b2, @c1_2].sort
|
347
385
|
@all_gem_names = @all_gems.map { |gem| gem.full_name }
|
@@ -354,6 +392,7 @@ class RubyGemTestCase < MiniTest::Unit::TestCase
|
|
354
392
|
@source_index.add_spec @a2
|
355
393
|
@source_index.add_spec @a_evil9
|
356
394
|
@source_index.add_spec @c1_2
|
395
|
+
@source_index.add_spec @a2_pre if prerelease
|
357
396
|
|
358
397
|
Gem::RemoteFetcher.fetcher = @fetcher
|
359
398
|
end
|
@@ -396,7 +435,13 @@ class RubyGemTestCase < MiniTest::Unit::TestCase
|
|
396
435
|
spec_fetcher.latest_specs[@uri] << spec_tuple
|
397
436
|
end
|
398
437
|
|
399
|
-
|
438
|
+
spec_fetcher.prerelease_specs[@uri] = []
|
439
|
+
si.prerelease_specs.sort.each do |spec|
|
440
|
+
spec_tuple = [spec.name, spec.version, spec.original_platform]
|
441
|
+
spec_fetcher.prerelease_specs[@uri] << spec_tuple
|
442
|
+
end
|
443
|
+
|
444
|
+
(si.gems.merge si.prerelease_gems).sort_by { |_,spec| spec }.each do |_, spec|
|
400
445
|
path = "#{@gem_repo}quick/Marshal.#{Gem.marshal_version}/#{spec.original_name}.gemspec.rz"
|
401
446
|
data = Marshal.dump spec
|
402
447
|
data_deflate = Zlib::Deflate.deflate data
|
@@ -418,6 +463,42 @@ class RubyGemTestCase < MiniTest::Unit::TestCase
|
|
418
463
|
Gem.win_platform?
|
419
464
|
end
|
420
465
|
|
466
|
+
# Returns whether or not we're on a version of Ruby built with VC++ (or
|
467
|
+
# Borland) versus Cygwin, Mingw, etc.
|
468
|
+
#
|
469
|
+
def self.vc_windows?
|
470
|
+
RUBY_PLATFORM.match('mswin')
|
471
|
+
end
|
472
|
+
|
473
|
+
# Returns whether or not we're on a version of Ruby built with VC++ (or
|
474
|
+
# Borland) versus Cygwin, Mingw, etc.
|
475
|
+
#
|
476
|
+
def vc_windows?
|
477
|
+
RUBY_PLATFORM.match('mswin')
|
478
|
+
end
|
479
|
+
|
480
|
+
# Returns the make command for the current platform. For versions of Ruby
|
481
|
+
# built on MS Windows with VC++ or Borland it will return 'nmake'. On all
|
482
|
+
# other platforms, including Cygwin, it will return 'make'.
|
483
|
+
#
|
484
|
+
def self.make_command
|
485
|
+
vc_windows? ? 'nmake' : 'make'
|
486
|
+
end
|
487
|
+
|
488
|
+
# Returns the make command for the current platform. For versions of Ruby
|
489
|
+
# built on MS Windows with VC++ or Borland it will return 'nmake'. On all
|
490
|
+
# other platforms, including Cygwin, it will return 'make'.
|
491
|
+
#
|
492
|
+
def make_command
|
493
|
+
vc_windows? ? 'nmake' : 'make'
|
494
|
+
end
|
495
|
+
|
496
|
+
# Returns whether or not the nmake command could be found.
|
497
|
+
#
|
498
|
+
def nmake_found?
|
499
|
+
system('nmake /? 1>NUL 2>&1')
|
500
|
+
end
|
501
|
+
|
421
502
|
# NOTE Allow tests to use a random (but controlled) port number instead of
|
422
503
|
# a hardcoded one. This helps CI tools when running parallels builds on
|
423
504
|
# the same builder slave.
|
data/test/mockgemui.rb
CHANGED
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'rubygems/command_manager'
|
2
|
+
|
3
|
+
class Gem::Commands::InterruptCommand < Gem::Command
|
4
|
+
|
5
|
+
def initialize
|
6
|
+
super('interrupt', 'Raises an Interrupt Exception', {})
|
7
|
+
end
|
8
|
+
|
9
|
+
def execute
|
10
|
+
raise Interrupt, "Interrupt exception"
|
11
|
+
end
|
12
|
+
|
13
|
+
end
|
14
|
+
|
15
|
+
Gem::CommandManager.instance.register_command :interrupt
|
16
|
+
|
data/test/test_gem.rb
CHANGED
@@ -11,7 +11,11 @@ class TestGem < RubyGemTestCase
|
|
11
11
|
super
|
12
12
|
|
13
13
|
@additional = %w[a b].map { |d| File.join @tempdir, d }
|
14
|
-
@default_dir_re =
|
14
|
+
@default_dir_re = if RUBY_VERSION > '1.9' then
|
15
|
+
%r|/.*?[Rr]uby.*?/[Gg]ems/[0-9.]+|
|
16
|
+
else
|
17
|
+
%r|/[Rr]uby/[Gg]ems/[0-9.]+|
|
18
|
+
end
|
15
19
|
end
|
16
20
|
|
17
21
|
def test_self_all_load_paths
|
@@ -37,6 +41,48 @@ class TestGem < RubyGemTestCase
|
|
37
41
|
assert(!Gem.available?("monkeys"))
|
38
42
|
end
|
39
43
|
|
44
|
+
def test_self_bin_path_bin_name
|
45
|
+
util_exec_gem
|
46
|
+
assert_equal @abin_path, Gem.bin_path('a', 'abin')
|
47
|
+
end
|
48
|
+
|
49
|
+
def test_self_bin_path_bin_name_version
|
50
|
+
util_exec_gem
|
51
|
+
assert_equal @abin_path, Gem.bin_path('a', 'abin', '4')
|
52
|
+
end
|
53
|
+
|
54
|
+
def test_self_bin_path_name
|
55
|
+
util_exec_gem
|
56
|
+
assert_equal @exec_path, Gem.bin_path('a')
|
57
|
+
end
|
58
|
+
|
59
|
+
def test_self_bin_path_name_version
|
60
|
+
util_exec_gem
|
61
|
+
assert_equal @exec_path, Gem.bin_path('a', nil, '4')
|
62
|
+
end
|
63
|
+
|
64
|
+
def test_self_bin_path_no_default_bin
|
65
|
+
quick_gem 'a', '2' do |s|
|
66
|
+
s.executables = ['exec']
|
67
|
+
end
|
68
|
+
assert_raises(Gem::Exception) do
|
69
|
+
Gem.bin_path('a', '2')
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
def test_self_bin_path_no_bin_file
|
74
|
+
quick_gem 'a', '1'
|
75
|
+
assert_raises(Gem::Exception) do
|
76
|
+
Gem.bin_path('a', '1')
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
def test_self_bin_path_not_found
|
81
|
+
assert_raises(Gem::GemNotFoundException) do
|
82
|
+
Gem.bin_path('non-existent')
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
40
86
|
def test_self_bindir
|
41
87
|
assert_equal File.join(@gemhome, 'bin'), Gem.bindir
|
42
88
|
assert_equal File.join(@gemhome, 'bin'), Gem.bindir(Gem.dir)
|
@@ -107,39 +153,30 @@ class TestGem < RubyGemTestCase
|
|
107
153
|
end
|
108
154
|
|
109
155
|
def test_self_default_exec_format
|
110
|
-
|
111
|
-
|
112
|
-
Gem::ConfigMap[:BASERUBY] = 'ruby'
|
113
|
-
Gem::ConfigMap[:RUBY_INSTALL_NAME] = 'ruby'
|
156
|
+
orig_RUBY_INSTALL_NAME = Gem::ConfigMap[:ruby_install_name]
|
157
|
+
Gem::ConfigMap[:ruby_install_name] = 'ruby'
|
114
158
|
|
115
159
|
assert_equal '%s', Gem.default_exec_format
|
116
160
|
ensure
|
117
|
-
Gem::ConfigMap[:
|
118
|
-
Gem::ConfigMap[:RUBY_INSTALL_NAME] = orig_RUBY_INSTALL_NAME
|
161
|
+
Gem::ConfigMap[:ruby_install_name] = orig_RUBY_INSTALL_NAME
|
119
162
|
end
|
120
163
|
|
121
164
|
def test_self_default_exec_format_18
|
122
|
-
|
123
|
-
|
124
|
-
Gem::ConfigMap[:BASERUBY] = 'ruby'
|
125
|
-
Gem::ConfigMap[:RUBY_INSTALL_NAME] = 'ruby18'
|
165
|
+
orig_RUBY_INSTALL_NAME = Gem::ConfigMap[:ruby_install_name]
|
166
|
+
Gem::ConfigMap[:ruby_install_name] = 'ruby18'
|
126
167
|
|
127
168
|
assert_equal '%s18', Gem.default_exec_format
|
128
169
|
ensure
|
129
|
-
Gem::ConfigMap[:
|
130
|
-
Gem::ConfigMap[:RUBY_INSTALL_NAME] = orig_RUBY_INSTALL_NAME
|
170
|
+
Gem::ConfigMap[:ruby_install_name] = orig_RUBY_INSTALL_NAME
|
131
171
|
end
|
132
172
|
|
133
173
|
def test_self_default_exec_format_jruby
|
134
|
-
|
135
|
-
|
136
|
-
Gem::ConfigMap[:BASERUBY] = 'ruby'
|
137
|
-
Gem::ConfigMap[:RUBY_INSTALL_NAME] = 'jruby'
|
174
|
+
orig_RUBY_INSTALL_NAME = Gem::ConfigMap[:ruby_install_name]
|
175
|
+
Gem::ConfigMap[:ruby_install_name] = 'jruby'
|
138
176
|
|
139
177
|
assert_equal 'j%s', Gem.default_exec_format
|
140
178
|
ensure
|
141
|
-
Gem::ConfigMap[:
|
142
|
-
Gem::ConfigMap[:RUBY_INSTALL_NAME] = orig_RUBY_INSTALL_NAME
|
179
|
+
Gem::ConfigMap[:ruby_install_name] = orig_RUBY_INSTALL_NAME
|
143
180
|
end
|
144
181
|
|
145
182
|
def test_self_default_sources
|
@@ -167,7 +204,7 @@ class TestGem < RubyGemTestCase
|
|
167
204
|
def test_self_ensure_gem_directories_missing_parents
|
168
205
|
gemdir = File.join @tempdir, 'a/b/c/gemdir'
|
169
206
|
FileUtils.rm_rf File.join(@tempdir, 'a') rescue nil
|
170
|
-
|
207
|
+
refute File.exist?(File.join(@tempdir, 'a')),
|
171
208
|
"manually remove #{File.join @tempdir, 'a'}, tests are broken"
|
172
209
|
Gem.use_paths gemdir
|
173
210
|
|
@@ -180,14 +217,14 @@ class TestGem < RubyGemTestCase
|
|
180
217
|
def test_self_ensure_gem_directories_write_protected
|
181
218
|
gemdir = File.join @tempdir, "egd"
|
182
219
|
FileUtils.rm_r gemdir rescue nil
|
183
|
-
|
220
|
+
refute File.exist?(gemdir), "manually remove #{gemdir}, tests are broken"
|
184
221
|
FileUtils.mkdir_p gemdir
|
185
222
|
FileUtils.chmod 0400, gemdir
|
186
223
|
Gem.use_paths gemdir
|
187
224
|
|
188
225
|
Gem.ensure_gem_subdirectories gemdir
|
189
226
|
|
190
|
-
|
227
|
+
refute File.exist?("#{gemdir}/cache")
|
191
228
|
ensure
|
192
229
|
FileUtils.chmod 0600, gemdir
|
193
230
|
end
|
@@ -197,14 +234,14 @@ class TestGem < RubyGemTestCase
|
|
197
234
|
gemdir = "#{parent}/a/b/c"
|
198
235
|
|
199
236
|
FileUtils.rm_r parent rescue nil
|
200
|
-
|
237
|
+
refute File.exist?(parent), "manually remove #{parent}, tests are broken"
|
201
238
|
FileUtils.mkdir_p parent
|
202
239
|
FileUtils.chmod 0400, parent
|
203
240
|
Gem.use_paths(gemdir)
|
204
241
|
|
205
242
|
Gem.ensure_gem_subdirectories gemdir
|
206
243
|
|
207
|
-
|
244
|
+
refute File.exist?("#{gemdir}/cache")
|
208
245
|
ensure
|
209
246
|
FileUtils.chmod 0600, parent
|
210
247
|
end
|
@@ -224,18 +261,20 @@ class TestGem < RubyGemTestCase
|
|
224
261
|
end
|
225
262
|
|
226
263
|
def test_self_find_files
|
264
|
+
discover_path = File.join 'lib', 'foo', 'discover.rb'
|
265
|
+
|
227
266
|
foo1 = quick_gem 'foo', '1' do |s|
|
228
|
-
s.files <<
|
267
|
+
s.files << discover_path
|
229
268
|
end
|
230
269
|
|
231
270
|
foo2 = quick_gem 'foo', '2' do |s|
|
232
|
-
s.files <<
|
271
|
+
s.files << discover_path
|
233
272
|
end
|
234
273
|
|
235
|
-
path = File.join 'gems', foo1.full_name,
|
274
|
+
path = File.join 'gems', foo1.full_name, discover_path
|
236
275
|
write_file(path) { |fp| fp.puts "# #{path}" }
|
237
276
|
|
238
|
-
path = File.join 'gems', foo2.full_name,
|
277
|
+
path = File.join 'gems', foo2.full_name, discover_path
|
239
278
|
write_file(path) { |fp| fp.puts "# #{path}" }
|
240
279
|
|
241
280
|
@fetcher = Gem::FakeFetcher.new
|
@@ -246,11 +285,12 @@ class TestGem < RubyGemTestCase
|
|
246
285
|
Gem.searcher = nil
|
247
286
|
|
248
287
|
expected = [
|
249
|
-
File.
|
250
|
-
File.join(foo2.full_gem_path,
|
288
|
+
File.expand_path('foo/discover.rb', File.dirname(__FILE__)),
|
289
|
+
File.join(foo2.full_gem_path, discover_path),
|
290
|
+
File.join(foo1.full_gem_path, discover_path),
|
251
291
|
]
|
252
292
|
|
253
|
-
assert_equal expected, Gem.find_files('foo/discover')
|
293
|
+
assert_equal expected, Gem.find_files('foo/discover')
|
254
294
|
end
|
255
295
|
|
256
296
|
def test_self_latest_load_paths
|
@@ -299,7 +339,7 @@ class TestGem < RubyGemTestCase
|
|
299
339
|
apple_gem_home = File.join @tempdir, 'apple_gem_home'
|
300
340
|
Gem.const_set :APPLE_GEM_HOME, apple_gem_home
|
301
341
|
|
302
|
-
|
342
|
+
assert_includes Gem.path, apple_gem_home
|
303
343
|
ensure
|
304
344
|
Gem.send :remove_const, :APPLE_GEM_HOME
|
305
345
|
end
|
@@ -310,7 +350,7 @@ class TestGem < RubyGemTestCase
|
|
310
350
|
apple_gem_home = File.join @tempdir, 'apple_gem_home'
|
311
351
|
Gem.const_set :APPLE_GEM_HOME, apple_gem_home
|
312
352
|
|
313
|
-
|
353
|
+
refute Gem.path.include?(apple_gem_home)
|
314
354
|
ensure
|
315
355
|
Gem.send :remove_const, :APPLE_GEM_HOME
|
316
356
|
end
|
@@ -405,13 +445,13 @@ class TestGem < RubyGemTestCase
|
|
405
445
|
|
406
446
|
FileUtils.mv a1_spec, @tempdir
|
407
447
|
|
408
|
-
|
448
|
+
refute Gem.source_index.gems.include?(@a1.full_name)
|
409
449
|
|
410
450
|
FileUtils.mv File.join(@tempdir, "#{@a1.full_name}.gemspec"), a1_spec
|
411
451
|
|
412
452
|
Gem.refresh
|
413
453
|
|
414
|
-
|
454
|
+
assert_includes Gem.source_index.gems, @a1.full_name
|
415
455
|
assert_equal nil, Gem.instance_variable_get(:@searcher)
|
416
456
|
end
|
417
457
|
|
@@ -466,7 +506,7 @@ class TestGem < RubyGemTestCase
|
|
466
506
|
|
467
507
|
def test_self_ruby_version
|
468
508
|
version = RUBY_VERSION.dup
|
469
|
-
version << ".#{RUBY_PATCHLEVEL}" if defined? RUBY_PATCHLEVEL
|
509
|
+
version << ".#{RUBY_PATCHLEVEL}" if defined?(RUBY_PATCHLEVEL) && RUBY_PATCHLEVEL != -1
|
470
510
|
|
471
511
|
assert_equal Gem::Version.new(version), Gem.ruby_version
|
472
512
|
end
|
@@ -475,6 +515,27 @@ class TestGem < RubyGemTestCase
|
|
475
515
|
assert_kind_of Gem::GemPathSearcher, Gem.searcher
|
476
516
|
end
|
477
517
|
|
518
|
+
def test_self_set_paths
|
519
|
+
other = File.join @tempdir, 'other'
|
520
|
+
path = [@userhome, other].join File::PATH_SEPARATOR
|
521
|
+
Gem.send :set_paths, path
|
522
|
+
|
523
|
+
assert File.exist?(File.join(@userhome, 'gems'))
|
524
|
+
assert File.exist?(File.join(other, 'gems'))
|
525
|
+
end
|
526
|
+
|
527
|
+
def test_self_set_paths_nonexistent_home
|
528
|
+
Gem.clear_paths
|
529
|
+
|
530
|
+
other = File.join @tempdir, 'other'
|
531
|
+
|
532
|
+
ENV['HOME'] = other
|
533
|
+
|
534
|
+
Gem.send :set_paths, other
|
535
|
+
|
536
|
+
refute File.exist?(File.join(other, 'gems'))
|
537
|
+
end
|
538
|
+
|
478
539
|
def test_self_source_index
|
479
540
|
assert_kind_of Gem::SourceIndex, Gem.source_index
|
480
541
|
end
|
@@ -546,5 +607,15 @@ class TestGem < RubyGemTestCase
|
|
546
607
|
end
|
547
608
|
end
|
548
609
|
|
610
|
+
def util_exec_gem
|
611
|
+
spec, _ = quick_gem 'a', '4' do |s|
|
612
|
+
s.default_executable = 'exec'
|
613
|
+
s.executables = ['exec', 'abin']
|
614
|
+
end
|
615
|
+
|
616
|
+
@exec_path = File.join spec.full_gem_path, spec.bindir, 'exec'
|
617
|
+
@abin_path = File.join spec.full_gem_path, spec.bindir, 'abin'
|
618
|
+
end
|
619
|
+
|
549
620
|
end
|
550
621
|
|