rubygems-update 1.3.5 → 1.3.6
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 +8 -1
- data/ChangeLog +164 -0
- data/History.txt +52 -1
- data/Manifest.txt +8 -8
- data/README +3 -2
- data/Rakefile +49 -5
- data/bin/gem +2 -2
- data/bin/update_rubygems +9 -11
- data/cruise_config.rb +4 -3
- data/hide_lib_for_update/note.txt +5 -0
- data/lib/rbconfig/datadir.rb +10 -14
- data/lib/rubygems.rb +117 -140
- data/lib/rubygems/builder.rb +4 -2
- data/lib/rubygems/command.rb +51 -48
- data/lib/rubygems/command_manager.rb +2 -0
- data/lib/rubygems/commands/dependency_command.rb +10 -5
- data/lib/rubygems/commands/environment_command.rb +1 -1
- data/lib/rubygems/commands/fetch_command.rb +6 -5
- data/lib/rubygems/commands/install_command.rb +1 -0
- data/lib/rubygems/commands/mirror_command.rb +8 -8
- data/lib/rubygems/commands/owner_command.rb +75 -0
- data/lib/rubygems/commands/pristine_command.rb +1 -1
- data/lib/rubygems/commands/push_command.rb +45 -0
- data/lib/rubygems/commands/query_command.rb +4 -1
- data/lib/rubygems/commands/rdoc_command.rb +24 -9
- data/lib/rubygems/commands/server_command.rb +6 -0
- data/lib/rubygems/commands/setup_command.rb +14 -4
- data/lib/rubygems/commands/unpack_command.rb +2 -2
- data/lib/rubygems/commands/update_command.rb +2 -2
- data/lib/rubygems/commands/which_command.rb +7 -9
- data/lib/rubygems/config_file.rb +100 -26
- data/lib/rubygems/defaults.rb +1 -1
- data/lib/rubygems/dependency.rb +133 -75
- data/lib/rubygems/dependency_installer.rb +28 -10
- data/lib/rubygems/dependency_list.rb +41 -12
- data/lib/rubygems/doc_manager.rb +7 -0
- data/lib/rubygems/format.rb +16 -20
- data/lib/rubygems/gem_openssl.rb +1 -1
- data/lib/rubygems/gem_path_searcher.rb +10 -12
- data/lib/rubygems/gemcutter_utilities.rb +49 -0
- data/lib/rubygems/indexer.rb +2 -2
- data/lib/rubygems/install_update_options.rb +1 -9
- data/lib/rubygems/installer.rb +35 -76
- data/lib/rubygems/local_remote_options.rb +1 -2
- data/lib/rubygems/package.rb +0 -1
- data/lib/rubygems/package/tar_input.rb +3 -1
- data/lib/rubygems/package_task.rb +16 -11
- data/lib/rubygems/remote_fetcher.rb +22 -8
- data/lib/rubygems/requirement.rb +78 -100
- data/lib/rubygems/server.rb +41 -10
- data/lib/rubygems/source_index.rb +5 -5
- data/lib/rubygems/spec_fetcher.rb +2 -2
- data/lib/rubygems/specification.rb +66 -16
- data/lib/rubygems/test_utilities.rb +33 -4
- data/lib/rubygems/uninstaller.rb +3 -3
- data/lib/rubygems/user_interaction.rb +45 -0
- data/lib/rubygems/validator.rb +6 -7
- data/lib/rubygems/version.rb +206 -149
- data/lib/rubygems/version_option.rb +16 -0
- data/test/fake_certlib/openssl.rb +1 -1
- data/test/functional.rb +0 -7
- data/test/gem_installer_test_case.rb +4 -4
- data/test/gem_package_tar_test_case.rb +1 -1
- data/test/gemutilities.rb +35 -31
- data/test/insure_session.rb +0 -8
- data/test/mockgemui.rb +0 -8
- data/test/simple_gem.rb +2 -8
- data/test/test_config.rb +3 -10
- data/test/test_gem.rb +9 -14
- data/test/test_gem_builder.rb +1 -7
- data/test/test_gem_command.rb +1 -8
- data/test/test_gem_command_manager.rb +1 -7
- data/test/test_gem_commands_build_command.rb +4 -4
- data/test/test_gem_commands_cert_command.rb +1 -2
- data/test/test_gem_commands_check_command.rb +1 -7
- data/test/test_gem_commands_contents_command.rb +1 -1
- data/test/test_gem_commands_dependency_command.rb +17 -31
- data/test/test_gem_commands_environment_command.rb +1 -1
- data/test/test_gem_commands_fetch_command.rb +14 -12
- data/test/test_gem_commands_generate_index_command.rb +1 -1
- data/test/test_gem_commands_install_command.rb +22 -20
- data/test/test_gem_commands_list_command.rb +1 -1
- data/test/test_gem_commands_lock_command.rb +1 -1
- data/test/test_gem_commands_mirror_command.rb +5 -5
- data/test/test_gem_commands_outdated_command.rb +3 -5
- data/test/test_gem_commands_owner_command.rb +105 -0
- data/test/test_gem_commands_pristine_command.rb +2 -2
- data/test/test_gem_commands_push_command.rb +61 -0
- data/test/test_gem_commands_query_command.rb +23 -56
- data/test/test_gem_commands_server_command.rb +1 -1
- data/test/test_gem_commands_sources_command.rb +1 -70
- data/test/test_gem_commands_specification_command.rb +3 -4
- data/test/test_gem_commands_stale_command.rb +1 -1
- data/test/test_gem_commands_uninstall_command.rb +3 -4
- data/test/test_gem_commands_unpack_command.rb +1 -1
- data/test/test_gem_commands_update_command.rb +13 -13
- data/test/test_gem_commands_which_command.rb +66 -0
- data/test/test_gem_config_file.rb +13 -7
- data/test/test_gem_dependency.rb +82 -134
- data/test/test_gem_dependency_installer.rb +55 -30
- data/test/test_gem_dependency_list.rb +28 -7
- data/test/test_gem_doc_manager.rb +1 -7
- data/test/test_gem_ext_configure_builder.rb +2 -2
- data/test/test_gem_ext_ext_conf_builder.rb +1 -1
- data/test/test_gem_ext_rake_builder.rb +1 -1
- data/test/test_gem_format.rb +14 -11
- data/test/test_gem_gem_path_searcher.rb +12 -1
- data/test/test_gem_gem_runner.rb +1 -1
- data/test/test_gem_gemcutter_utilities.rb +103 -0
- data/test/test_gem_indexer.rb +44 -51
- data/test/test_gem_install_update_options.rb +1 -7
- data/test/test_gem_installer.rb +22 -82
- data/test/test_gem_local_remote_options.rb +1 -1
- data/test/test_gem_package_tar_header.rb +1 -8
- data/test/test_gem_package_tar_input.rb +1 -8
- data/test/test_gem_package_tar_output.rb +1 -8
- data/test/test_gem_package_tar_reader.rb +1 -8
- data/test/test_gem_package_tar_reader_entry.rb +1 -8
- data/test/test_gem_package_tar_writer.rb +1 -8
- data/test/test_gem_package_task.rb +1 -25
- data/test/test_gem_platform.rb +4 -4
- data/test/test_gem_remote_fetcher.rb +31 -21
- data/test/test_gem_requirement.rb +210 -140
- data/test/test_gem_server.rb +36 -1
- data/test/test_gem_source_index.rb +7 -13
- data/test/test_gem_spec_fetcher.rb +17 -47
- data/test/test_gem_specification.rb +7 -20
- data/test/test_gem_stream_ui.rb +21 -1
- data/test/test_gem_uninstaller.rb +1 -2
- data/test/test_gem_validator.rb +2 -8
- data/test/test_gem_version.rb +110 -254
- data/test/test_gem_version_option.rb +1 -1
- data/test/test_kernel.rb +1 -7
- data/util/CL2notes +1 -1
- data/util/gem_prelude.rb.template +64 -41
- metadata +33 -71
- metadata.gz.sig +0 -0
- data/lib/rubygems/digest/digest_adapter.rb +0 -49
- data/lib/rubygems/digest/md5.rb +0 -23
- data/lib/rubygems/digest/sha1.rb +0 -22
- data/lib/rubygems/digest/sha2.rb +0 -22
- data/lib/rubygems/timer.rb +0 -28
- data/test/test_gem_digest.rb +0 -46
- data/test/test_gem_source_info_cache.rb +0 -447
- data/test/test_gem_source_info_cache_entry.rb +0 -78
@@ -1,5 +1,4 @@
|
|
1
|
-
require File.
|
2
|
-
'gem_installer_test_case')
|
1
|
+
require File.expand_path('../gem_installer_test_case', __FILE__)
|
3
2
|
require 'rubygems/install_update_options'
|
4
3
|
require 'rubygems/command'
|
5
4
|
|
@@ -20,11 +19,6 @@ class TestGemInstallUpdateOptions < GemInstallerTestCase
|
|
20
19
|
assert @cmd.handles?(args)
|
21
20
|
end
|
22
21
|
|
23
|
-
def test_prerelease
|
24
|
-
@cmd.handle_options %w[--prerelease]
|
25
|
-
assert_equal true, @cmd.options[:prerelease]
|
26
|
-
end
|
27
|
-
|
28
22
|
def test_security_policy
|
29
23
|
@cmd.handle_options %w[-P HighSecurity]
|
30
24
|
|
data/test/test_gem_installer.rb
CHANGED
@@ -1,11 +1,4 @@
|
|
1
|
-
|
2
|
-
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
|
3
|
-
# All rights reserved.
|
4
|
-
# See LICENSE.txt for permissions.
|
5
|
-
#++
|
6
|
-
|
7
|
-
require File.join(File.expand_path(File.dirname(__FILE__)),
|
8
|
-
'gem_installer_test_case')
|
1
|
+
require File.expand_path('../gem_installer_test_case', __FILE__)
|
9
2
|
|
10
3
|
class TestGemInstaller < GemInstallerTestCase
|
11
4
|
|
@@ -108,19 +101,6 @@ load Gem.bin_path('a', 'my_exec', version)
|
|
108
101
|
assert_equal 'a requires b (> 2, runtime)', e.message
|
109
102
|
end
|
110
103
|
|
111
|
-
def test_expand_and_validate_gem_dir
|
112
|
-
@installer.gem_dir = '/nonexistent'
|
113
|
-
expanded_gem_dir = @installer.send(:expand_and_validate_gem_dir)
|
114
|
-
if win_platform?
|
115
|
-
expected = File.expand_path('/nonexistent').downcase
|
116
|
-
expanded_gem_dir = expanded_gem_dir.downcase
|
117
|
-
else
|
118
|
-
expected = '/nonexistent'
|
119
|
-
end
|
120
|
-
|
121
|
-
assert_equal expected, expanded_gem_dir
|
122
|
-
end
|
123
|
-
|
124
104
|
def test_extract_files
|
125
105
|
format = Object.new
|
126
106
|
def format.file_entries
|
@@ -516,7 +496,7 @@ load Gem.bin_path('a', 'my_exec', version)
|
|
516
496
|
|
517
497
|
@installer.generate_bin
|
518
498
|
|
519
|
-
default_shebang =
|
499
|
+
default_shebang = Gem.ruby
|
520
500
|
shebang_line = open("#{@gemhome}/bin/my_exec") { |f| f.readlines.first }
|
521
501
|
assert_match(/\A#!/, shebang_line)
|
522
502
|
assert_match(/#{default_shebang}/, shebang_line)
|
@@ -524,11 +504,11 @@ load Gem.bin_path('a', 'my_exec', version)
|
|
524
504
|
|
525
505
|
def test_initialize
|
526
506
|
spec = quick_gem 'a' do |s| s.platform = Gem::Platform.new 'mswin32' end
|
527
|
-
gem = File.join @tempdir,
|
507
|
+
gem = File.join @tempdir, spec.file_name
|
528
508
|
|
529
509
|
Dir.mkdir util_inst_bindir
|
530
510
|
util_build_gem spec
|
531
|
-
FileUtils.mv File.join(@gemhome, 'cache',
|
511
|
+
FileUtils.mv File.join(@gemhome, 'cache', spec.file_name),
|
532
512
|
@tempdir
|
533
513
|
|
534
514
|
installer = Gem::Installer.new gem
|
@@ -540,7 +520,7 @@ load Gem.bin_path('a', 'my_exec', version)
|
|
540
520
|
Dir.mkdir util_inst_bindir
|
541
521
|
util_setup_gem
|
542
522
|
|
543
|
-
cache_file = File.join @gemhome, 'cache',
|
523
|
+
cache_file = File.join @gemhome, 'cache', @spec.file_name
|
544
524
|
|
545
525
|
Gem.pre_install do |installer|
|
546
526
|
refute File.exist?(cache_file), 'cache file should not exist yet'
|
@@ -568,8 +548,7 @@ load Gem.bin_path('a', 'my_exec', version)
|
|
568
548
|
|
569
549
|
assert File.exist?(File.join(gemdir, 'ext', 'a', 'Rakefile'))
|
570
550
|
|
571
|
-
spec_file = File.join(@gemhome, 'specifications',
|
572
|
-
"#{@spec.full_name}.gemspec")
|
551
|
+
spec_file = File.join(@gemhome, 'specifications', @spec.spec_name)
|
573
552
|
|
574
553
|
assert_equal spec_file, @spec.loaded_from
|
575
554
|
assert File.exist?(spec_file)
|
@@ -583,7 +562,7 @@ load Gem.bin_path('a', 'my_exec', version)
|
|
583
562
|
|
584
563
|
use_ui @ui do
|
585
564
|
Dir.chdir @tempdir do Gem::Builder.new(@spec).build end
|
586
|
-
gem = File.join @tempdir,
|
565
|
+
gem = File.join @tempdir, @spec.file_name
|
587
566
|
end
|
588
567
|
|
589
568
|
gem_data = File.open gem, 'rb' do |fp| fp.read 1024 end
|
@@ -666,8 +645,7 @@ load Gem.bin_path('a', 'my_exec', version)
|
|
666
645
|
assert_equal 0111, exe_mode, "0%o" % exe_mode unless win_platform?
|
667
646
|
assert File.exist?(File.join(gemdir, 'lib', 'code.rb'))
|
668
647
|
|
669
|
-
assert File.exist?(File.join(@gemhome, 'specifications',
|
670
|
-
"#{@spec.full_name}.gemspec"))
|
648
|
+
assert File.exist?(File.join(@gemhome, 'specifications', @spec.spec_name))
|
671
649
|
end
|
672
650
|
|
673
651
|
def test_install_missing_dirs
|
@@ -677,7 +655,7 @@ load Gem.bin_path('a', 'my_exec', version)
|
|
677
655
|
|
678
656
|
use_ui @ui do
|
679
657
|
Dir.chdir @tempdir do Gem::Builder.new(@spec).build end
|
680
|
-
gem = File.join @tempdir,
|
658
|
+
gem = File.join @tempdir, @spec.file_name
|
681
659
|
|
682
660
|
@installer.install
|
683
661
|
end
|
@@ -686,50 +664,8 @@ load Gem.bin_path('a', 'my_exec', version)
|
|
686
664
|
File.directory? File.join(Gem.dir, 'docs')
|
687
665
|
File.directory? File.join(Gem.dir, 'specifications')
|
688
666
|
|
689
|
-
assert File.exist?(File.join(@gemhome, 'cache',
|
690
|
-
assert File.exist?(File.join(@gemhome, 'specifications',
|
691
|
-
"#{@spec.full_name}.gemspec"))
|
692
|
-
end
|
693
|
-
|
694
|
-
unless win_platform? # File.chmod doesn't work
|
695
|
-
def test_install_user_local_fallback
|
696
|
-
Dir.mkdir util_inst_bindir
|
697
|
-
File.chmod 0755, @userhome
|
698
|
-
File.chmod 0000, util_inst_bindir
|
699
|
-
File.chmod 0000, Gem.dir
|
700
|
-
@spec.executables = ["executable"]
|
701
|
-
|
702
|
-
build_rake_in do
|
703
|
-
use_ui @ui do
|
704
|
-
util_setup_gem
|
705
|
-
@installer.install
|
706
|
-
end
|
707
|
-
end
|
708
|
-
|
709
|
-
assert File.exist?(File.join(Gem.user_dir, 'gems',
|
710
|
-
@spec.full_name, 'lib', 'code.rb'))
|
711
|
-
assert File.exist?(File.join(Gem.user_dir, 'bin', 'executable'))
|
712
|
-
ensure
|
713
|
-
File.chmod 0755, Gem.dir
|
714
|
-
File.chmod 0755, util_inst_bindir
|
715
|
-
end
|
716
|
-
|
717
|
-
def test_install_bindir_read_only
|
718
|
-
Dir.mkdir util_inst_bindir
|
719
|
-
File.chmod 0755, @userhome
|
720
|
-
File.chmod 0000, util_inst_bindir
|
721
|
-
|
722
|
-
build_rake_in do
|
723
|
-
use_ui @ui do
|
724
|
-
util_setup_gem
|
725
|
-
@installer.install
|
726
|
-
end
|
727
|
-
end
|
728
|
-
|
729
|
-
assert File.exist?(File.join(Gem.user_dir, 'bin', 'executable'))
|
730
|
-
ensure
|
731
|
-
File.chmod 0755, util_inst_bindir
|
732
|
-
end
|
667
|
+
assert File.exist?(File.join(@gemhome, 'cache', @spec.file_name))
|
668
|
+
assert File.exist?(File.join(@gemhome, 'specifications', @spec.spec_name))
|
733
669
|
end
|
734
670
|
|
735
671
|
def test_install_with_message
|
@@ -750,7 +686,7 @@ load Gem.bin_path('a', 'my_exec', version)
|
|
750
686
|
e = assert_raises Gem::InstallError do
|
751
687
|
installer.install
|
752
688
|
end
|
753
|
-
assert_equal 'old_ruby_required requires Ruby version = 1.4.6',
|
689
|
+
assert_equal 'old_ruby_required requires Ruby version = 1.4.6.',
|
754
690
|
e.message
|
755
691
|
end
|
756
692
|
end
|
@@ -762,15 +698,15 @@ load Gem.bin_path('a', 'my_exec', version)
|
|
762
698
|
|
763
699
|
util_build_gem spec
|
764
700
|
|
765
|
-
gem = File.join @gemhome, 'cache',
|
701
|
+
gem = File.join @gemhome, 'cache', spec.file_name
|
766
702
|
|
767
703
|
use_ui @ui do
|
768
704
|
@installer = Gem::Installer.new gem
|
769
705
|
e = assert_raises Gem::InstallError do
|
770
706
|
@installer.install
|
771
707
|
end
|
772
|
-
assert_equal 'old_rubygems_required requires RubyGems version < 0'
|
773
|
-
|
708
|
+
assert_equal 'old_rubygems_required requires RubyGems version < 0. ' +
|
709
|
+
"Try 'gem update --system' to update RubyGems itself.", e.message
|
774
710
|
end
|
775
711
|
end
|
776
712
|
|
@@ -826,7 +762,11 @@ load Gem.bin_path('a', 'my_exec', version)
|
|
826
762
|
@installer.env_shebang = true
|
827
763
|
|
828
764
|
shebang = @installer.shebang 'my_exec'
|
829
|
-
|
765
|
+
|
766
|
+
env_shebang = "/usr/bin/env" unless Gem.win_platform?
|
767
|
+
|
768
|
+
assert_equal("#!#{env_shebang} #{Gem::ConfigMap[:ruby_install_name]}",
|
769
|
+
shebang)
|
830
770
|
end
|
831
771
|
|
832
772
|
def test_shebang_nested
|
@@ -890,7 +830,7 @@ load Gem.bin_path('a', 'my_exec', version)
|
|
890
830
|
|
891
831
|
def test_write_spec
|
892
832
|
spec_dir = File.join @gemhome, 'specifications'
|
893
|
-
spec_file = File.join spec_dir,
|
833
|
+
spec_file = File.join spec_dir, @spec.spec_name
|
894
834
|
FileUtils.rm spec_file
|
895
835
|
refute File.exist?(spec_file)
|
896
836
|
|
@@ -910,7 +850,7 @@ load Gem.bin_path('a', 'my_exec', version)
|
|
910
850
|
|
911
851
|
util_build_gem spec
|
912
852
|
|
913
|
-
File.join @gemhome, 'cache',
|
853
|
+
File.join @gemhome, 'cache', spec.file_name
|
914
854
|
end
|
915
855
|
|
916
856
|
end
|
@@ -1,11 +1,4 @@
|
|
1
|
-
|
2
|
-
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
|
3
|
-
# All rights reserved.
|
4
|
-
# See LICENSE.txt for permissions.
|
5
|
-
#++
|
6
|
-
|
7
|
-
require File.join(File.expand_path(File.dirname(__FILE__)),
|
8
|
-
'gem_package_tar_test_case')
|
1
|
+
require File.expand_path('../gem_package_tar_test_case', __FILE__)
|
9
2
|
require 'rubygems/package'
|
10
3
|
|
11
4
|
class TestGemPackageTarHeader < TarTestCase
|
@@ -1,11 +1,4 @@
|
|
1
|
-
|
2
|
-
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
|
3
|
-
# All rights reserved.
|
4
|
-
# See LICENSE.txt for permissions.
|
5
|
-
#++
|
6
|
-
|
7
|
-
require File.join(File.expand_path(File.dirname(__FILE__)),
|
8
|
-
'gem_package_tar_test_case')
|
1
|
+
require File.expand_path('../gem_package_tar_test_case', __FILE__)
|
9
2
|
require 'rubygems/package/tar_input'
|
10
3
|
|
11
4
|
class TestGemPackageTarInput < TarTestCase
|
@@ -1,11 +1,4 @@
|
|
1
|
-
|
2
|
-
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
|
3
|
-
# All rights reserved.
|
4
|
-
# See LICENSE.txt for permissions.
|
5
|
-
#++
|
6
|
-
|
7
|
-
require File.join(File.expand_path(File.dirname(__FILE__)),
|
8
|
-
'gem_package_tar_test_case')
|
1
|
+
require File.expand_path('../gem_package_tar_test_case', __FILE__)
|
9
2
|
require 'rubygems/package/tar_output'
|
10
3
|
|
11
4
|
class TestGemPackageTarOutput < TarTestCase
|
@@ -1,11 +1,4 @@
|
|
1
|
-
|
2
|
-
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
|
3
|
-
# All rights reserved.
|
4
|
-
# See LICENSE.txt for permissions.
|
5
|
-
#++
|
6
|
-
|
7
|
-
require File.join(File.expand_path(File.dirname(__FILE__)),
|
8
|
-
'gem_package_tar_test_case')
|
1
|
+
require File.expand_path('../gem_package_tar_test_case', __FILE__)
|
9
2
|
require 'rubygems/package'
|
10
3
|
|
11
4
|
class TestGemPackageTarReader < TarTestCase
|
@@ -1,11 +1,4 @@
|
|
1
|
-
|
2
|
-
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
|
3
|
-
# All rights reserved.
|
4
|
-
# See LICENSE.txt for permissions.
|
5
|
-
#++
|
6
|
-
|
7
|
-
require File.join(File.expand_path(File.dirname(__FILE__)),
|
8
|
-
'gem_package_tar_test_case')
|
1
|
+
require File.expand_path('../gem_package_tar_test_case', __FILE__)
|
9
2
|
require 'rubygems/package'
|
10
3
|
|
11
4
|
class TestGemPackageTarReaderEntry < TarTestCase
|
@@ -1,11 +1,4 @@
|
|
1
|
-
|
2
|
-
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
|
3
|
-
# All rights reserved.
|
4
|
-
# See LICENSE.txt for permissions.
|
5
|
-
#++
|
6
|
-
|
7
|
-
require File.join(File.expand_path(File.dirname(__FILE__)),
|
8
|
-
'gem_package_tar_test_case')
|
1
|
+
require File.expand_path('../gem_package_tar_test_case', __FILE__)
|
9
2
|
require 'rubygems/package/tar_writer'
|
10
3
|
|
11
4
|
class TestTarWriter < TarTestCase
|
@@ -1,25 +1,4 @@
|
|
1
|
-
|
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.
|
21
|
-
|
22
|
-
require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities')
|
1
|
+
require File.expand_path('../gemutilities', __FILE__)
|
23
2
|
require 'rubygems'
|
24
3
|
require 'rubygems/package_task'
|
25
4
|
|
@@ -35,7 +14,6 @@ class TestGemPackageTask < MiniTest::Unit::TestCase
|
|
35
14
|
p.package_files << "y"
|
36
15
|
end
|
37
16
|
assert_equal ["x", "y"], pkg.package_files
|
38
|
-
assert_equal "pkgr-1.2.3.gem", pkg.gem_file
|
39
17
|
end
|
40
18
|
|
41
19
|
def test_gem_package_with_current_platform
|
@@ -49,7 +27,6 @@ class TestGemPackageTask < MiniTest::Unit::TestCase
|
|
49
27
|
p.package_files << "y"
|
50
28
|
end
|
51
29
|
assert_equal ["x", "y"], pkg.package_files
|
52
|
-
assert_match(/^pkgr-1\.2\.3-(\S+)\.gem$/, pkg.gem_file)
|
53
30
|
end
|
54
31
|
|
55
32
|
def test_gem_package_with_ruby_platform
|
@@ -63,7 +40,6 @@ class TestGemPackageTask < MiniTest::Unit::TestCase
|
|
63
40
|
p.package_files << "y"
|
64
41
|
end
|
65
42
|
assert_equal ["x", "y"], pkg.package_files
|
66
|
-
assert_equal "pkgr-1.2.3.gem", pkg.gem_file
|
67
43
|
end
|
68
44
|
|
69
45
|
end
|
data/test/test_gem_platform.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require File.
|
1
|
+
require File.expand_path('../gemutilities', __FILE__)
|
2
2
|
require 'rubygems/platform'
|
3
3
|
require 'rbconfig'
|
4
4
|
|
@@ -100,8 +100,8 @@ class TestGemPlatform < RubyGemTestCase
|
|
100
100
|
end
|
101
101
|
|
102
102
|
def test_initialize_mswin32_vc6
|
103
|
-
orig_RUBY_SO_NAME =
|
104
|
-
|
103
|
+
orig_RUBY_SO_NAME = RbConfig::CONFIG['RUBY_SO_NAME']
|
104
|
+
RbConfig::CONFIG['RUBY_SO_NAME'] = 'msvcrt-ruby18'
|
105
105
|
|
106
106
|
expected = ['x86', 'mswin32', nil]
|
107
107
|
|
@@ -109,7 +109,7 @@ class TestGemPlatform < RubyGemTestCase
|
|
109
109
|
|
110
110
|
assert_equal expected, platform.to_a, 'i386-mswin32 VC6'
|
111
111
|
ensure
|
112
|
-
|
112
|
+
RbConfig::CONFIG['RUBY_SO_NAME'] = orig_RUBY_SO_NAME
|
113
113
|
end
|
114
114
|
|
115
115
|
def test_initialize_platform
|
@@ -1,14 +1,8 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
# All rights reserved.
|
4
|
-
# See LICENSE.txt for permissions.
|
5
|
-
#++
|
6
|
-
|
7
|
-
require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities')
|
1
|
+
require File.expand_path('../gemutilities', __FILE__)
|
2
|
+
require 'ostruct'
|
8
3
|
require 'webrick'
|
9
|
-
require 'zlib'
|
10
4
|
require 'rubygems/remote_fetcher'
|
11
|
-
require '
|
5
|
+
require 'rubygems/format'
|
12
6
|
|
13
7
|
# = Testing Proxy Settings
|
14
8
|
#
|
@@ -208,7 +202,7 @@ gems:
|
|
208
202
|
|
209
203
|
fetcher = util_fuck_with_fetcher a1_data
|
210
204
|
|
211
|
-
a1_cache_gem = File.join(@gemhome, 'cache',
|
205
|
+
a1_cache_gem = File.join(@gemhome, 'cache', @a1.file_name)
|
212
206
|
assert_equal a1_cache_gem, fetcher.download(@a1, 'http://gems.example.com')
|
213
207
|
assert_equal("http://gems.example.com/gems/a-1.gem",
|
214
208
|
fetcher.instance_variable_get(:@test_arg).to_s)
|
@@ -220,20 +214,20 @@ gems:
|
|
220
214
|
|
221
215
|
inst = Gem::RemoteFetcher.fetcher
|
222
216
|
|
223
|
-
assert_equal File.join(@gemhome, 'cache',
|
217
|
+
assert_equal File.join(@gemhome, 'cache', @a1.file_name),
|
224
218
|
inst.download(@a1, 'http://gems.example.com')
|
225
219
|
end
|
226
220
|
|
227
221
|
def test_download_local
|
228
222
|
FileUtils.mv @a1_gem, @tempdir
|
229
|
-
local_path = File.join @tempdir,
|
223
|
+
local_path = File.join @tempdir, @a1.file_name
|
230
224
|
inst = nil
|
231
225
|
|
232
226
|
Dir.chdir @tempdir do
|
233
227
|
inst = Gem::RemoteFetcher.fetcher
|
234
228
|
end
|
235
229
|
|
236
|
-
assert_equal File.join(@gemhome, 'cache',
|
230
|
+
assert_equal File.join(@gemhome, 'cache', @a1.file_name),
|
237
231
|
inst.download(@a1, local_path)
|
238
232
|
end
|
239
233
|
|
@@ -241,14 +235,14 @@ gems:
|
|
241
235
|
space_path = File.join @tempdir, 'space path'
|
242
236
|
FileUtils.mkdir space_path
|
243
237
|
FileUtils.mv @a1_gem, space_path
|
244
|
-
local_path = File.join space_path,
|
238
|
+
local_path = File.join space_path, @a1.file_name
|
245
239
|
inst = nil
|
246
240
|
|
247
241
|
Dir.chdir @tempdir do
|
248
242
|
inst = Gem::RemoteFetcher.fetcher
|
249
243
|
end
|
250
244
|
|
251
|
-
assert_equal File.join(@gemhome, 'cache',
|
245
|
+
assert_equal File.join(@gemhome, 'cache', @a1.file_name),
|
252
246
|
inst.download(@a1, local_path)
|
253
247
|
end
|
254
248
|
|
@@ -262,7 +256,7 @@ gems:
|
|
262
256
|
|
263
257
|
install_dir = File.join @tempdir, 'more_gems'
|
264
258
|
|
265
|
-
a1_cache_gem = File.join install_dir, 'cache',
|
259
|
+
a1_cache_gem = File.join install_dir, 'cache', @a1.file_name
|
266
260
|
FileUtils.mkdir_p(File.dirname(a1_cache_gem))
|
267
261
|
actual = fetcher.download(@a1, 'http://gems.example.com', install_dir)
|
268
262
|
|
@@ -276,7 +270,7 @@ gems:
|
|
276
270
|
unless win_platform? # File.chmod doesn't work
|
277
271
|
def test_download_local_read_only
|
278
272
|
FileUtils.mv @a1_gem, @tempdir
|
279
|
-
local_path = File.join @tempdir,
|
273
|
+
local_path = File.join @tempdir, @a1.file_name
|
280
274
|
inst = nil
|
281
275
|
File.chmod 0555, File.join(@gemhome, 'cache')
|
282
276
|
|
@@ -284,7 +278,7 @@ gems:
|
|
284
278
|
inst = Gem::RemoteFetcher.fetcher
|
285
279
|
end
|
286
280
|
|
287
|
-
assert_equal File.join(@tempdir,
|
281
|
+
assert_equal File.join(@tempdir, @a1.file_name),
|
288
282
|
inst.download(@a1, local_path)
|
289
283
|
ensure
|
290
284
|
File.chmod 0755, File.join(@gemhome, 'cache')
|
@@ -296,8 +290,7 @@ gems:
|
|
296
290
|
|
297
291
|
fetcher = util_fuck_with_fetcher File.read(@a1_gem)
|
298
292
|
fetcher.download(@a1, 'http://gems.example.com')
|
299
|
-
assert File.exist?(File.join(Gem.user_dir, 'cache',
|
300
|
-
"#{@a1.full_name}.gem"))
|
293
|
+
assert File.exist?(File.join(Gem.user_dir, 'cache', @a1.file_name))
|
301
294
|
ensure
|
302
295
|
File.chmod 0755, File.join(@gemhome)
|
303
296
|
File.chmod 0755, File.join(@gemhome, 'cache')
|
@@ -319,7 +312,7 @@ gems:
|
|
319
312
|
|
320
313
|
fetcher = util_fuck_with_fetcher e1_data, :blow_chunks
|
321
314
|
|
322
|
-
e1_cache_gem = File.join(@gemhome, 'cache',
|
315
|
+
e1_cache_gem = File.join(@gemhome, 'cache', e1.file_name)
|
323
316
|
|
324
317
|
assert_equal e1_cache_gem, fetcher.download(e1, 'http://gems.example.com')
|
325
318
|
|
@@ -328,6 +321,23 @@ gems:
|
|
328
321
|
assert File.exist?(e1_cache_gem)
|
329
322
|
end
|
330
323
|
|
324
|
+
def test_download_same_file
|
325
|
+
FileUtils.mv @a1_gem, @tempdir
|
326
|
+
local_path = File.join @tempdir, @a1.file_name
|
327
|
+
inst = nil
|
328
|
+
|
329
|
+
Dir.chdir @tempdir do
|
330
|
+
inst = Gem::RemoteFetcher.fetcher
|
331
|
+
end
|
332
|
+
|
333
|
+
cache_path = File.join @gemhome, 'cache', @a1.file_name
|
334
|
+
FileUtils.mv local_path, cache_path
|
335
|
+
|
336
|
+
gem = Gem::Format.from_file_by_path cache_path
|
337
|
+
|
338
|
+
assert_equal cache_path, inst.download(gem.spec, cache_path)
|
339
|
+
end
|
340
|
+
|
331
341
|
def test_download_unsupported
|
332
342
|
inst = Gem::RemoteFetcher.fetcher
|
333
343
|
|