rubygems-update 1.8.30 → 2.0.0.preview2
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.
- checksums.yaml +6 -6
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +3 -0
- data/.autotest +6 -3
- data/History.txt +137 -63
- data/LICENSE.txt +1 -5
- data/Manifest.txt +69 -32
- data/README.rdoc +11 -9
- data/Rakefile +24 -38
- data/bin/gem +0 -9
- data/bin/update_rubygems +1 -0
- data/lib/rubygems.rb +193 -405
- data/lib/rubygems/available_set.rb +95 -0
- data/lib/rubygems/command.rb +88 -45
- data/lib/rubygems/command_manager.rb +67 -40
- data/lib/rubygems/commands/build_command.rb +5 -23
- data/lib/rubygems/commands/cert_command.rb +199 -57
- data/lib/rubygems/commands/check_command.rb +14 -39
- data/lib/rubygems/commands/cleanup_command.rb +9 -1
- data/lib/rubygems/commands/contents_command.rb +30 -12
- data/lib/rubygems/commands/dependency_command.rb +3 -8
- data/lib/rubygems/commands/environment_command.rb +13 -8
- data/lib/rubygems/commands/fetch_command.rb +3 -16
- data/lib/rubygems/commands/generate_index_command.rb +7 -47
- data/lib/rubygems/commands/help_command.rb +1 -1
- data/lib/rubygems/commands/install_command.rb +69 -36
- data/lib/rubygems/commands/list_command.rb +6 -4
- data/lib/rubygems/commands/lock_command.rb +1 -1
- data/lib/rubygems/commands/mirror_command.rb +17 -0
- data/lib/rubygems/commands/outdated_command.rb +6 -3
- data/lib/rubygems/commands/owner_command.rb +13 -5
- data/lib/rubygems/commands/pristine_command.rb +19 -4
- data/lib/rubygems/commands/push_command.rb +12 -1
- data/lib/rubygems/commands/query_command.rb +43 -27
- data/lib/rubygems/commands/rdoc_command.rb +23 -28
- data/lib/rubygems/commands/search_command.rb +4 -18
- data/lib/rubygems/commands/server_command.rb +1 -1
- data/lib/rubygems/commands/setup_command.rb +124 -38
- data/lib/rubygems/commands/sources_command.rb +16 -16
- data/lib/rubygems/commands/specification_command.rb +11 -13
- data/lib/rubygems/commands/uninstall_command.rb +24 -7
- data/lib/rubygems/commands/unpack_command.rb +7 -3
- data/lib/rubygems/commands/update_command.rb +22 -36
- data/lib/rubygems/commands/yank_command.rb +98 -0
- data/lib/rubygems/compatibility.rb +51 -0
- data/lib/rubygems/config_file.rb +82 -54
- data/lib/rubygems/core_ext/kernel_gem.rb +53 -0
- data/lib/rubygems/core_ext/kernel_require.rb +119 -0
- data/lib/rubygems/defaults.rb +10 -21
- data/lib/rubygems/dependency.rb +61 -10
- data/lib/rubygems/dependency_installer.rb +157 -69
- data/lib/rubygems/dependency_list.rb +11 -19
- data/lib/rubygems/dependency_resolver.rb +562 -0
- data/lib/rubygems/deprecate.rb +40 -40
- data/lib/rubygems/errors.rb +77 -24
- data/lib/rubygems/exceptions.rb +25 -7
- data/lib/rubygems/ext/builder.rb +20 -23
- data/lib/rubygems/ext/configure_builder.rb +2 -2
- data/lib/rubygems/ext/ext_conf_builder.rb +5 -45
- data/lib/rubygems/ext/rake_builder.rb +2 -2
- data/lib/rubygems/gem_runner.rb +3 -16
- data/lib/rubygems/gemcutter_utilities.rb +22 -7
- data/lib/rubygems/indexer.rb +6 -159
- data/lib/rubygems/install_message.rb +12 -0
- data/lib/rubygems/install_update_options.rb +56 -18
- data/lib/rubygems/installer.rb +244 -134
- data/lib/rubygems/installer_test_case.rb +71 -19
- data/lib/rubygems/mock_gem_ui.rb +17 -0
- data/lib/rubygems/name_tuple.rb +110 -0
- data/lib/rubygems/package.rb +514 -43
- data/lib/rubygems/package/digest_io.rb +64 -0
- data/lib/rubygems/package/old.rb +147 -0
- data/lib/rubygems/package/tar_header.rb +18 -55
- data/lib/rubygems/package/tar_reader.rb +20 -3
- data/lib/rubygems/package/tar_writer.rb +63 -7
- data/lib/rubygems/package_task.rb +3 -4
- data/lib/rubygems/path_support.rb +14 -7
- data/lib/rubygems/platform.rb +19 -26
- data/lib/rubygems/rdoc.rb +316 -0
- data/lib/rubygems/remote_fetcher.rb +117 -54
- data/lib/rubygems/request_set.rb +182 -0
- data/lib/rubygems/requirement.rb +63 -26
- data/lib/rubygems/security.rb +295 -555
- data/lib/rubygems/security/policies.rb +115 -0
- data/lib/rubygems/security/policy.rb +227 -0
- data/lib/rubygems/security/signer.rb +136 -0
- data/lib/rubygems/security/trust_dir.rb +104 -0
- data/lib/rubygems/server.rb +45 -55
- data/lib/rubygems/source.rb +144 -0
- data/lib/rubygems/source_list.rb +87 -0
- data/lib/rubygems/source_local.rb +92 -0
- data/lib/rubygems/source_specific_file.rb +28 -0
- data/lib/rubygems/spec_fetcher.rb +116 -184
- data/lib/rubygems/specification.rb +731 -335
- data/lib/rubygems/ssl_certs/AddTrustExternalCARoot.pem +88 -30
- data/lib/rubygems/ssl_certs/Entrust_net-Secure-Server-Certification-Authority.pem +90 -0
- data/lib/rubygems/ssl_certs/VerisignClass3PublicPrimaryCertificationAuthority-G2.pem +57 -0
- data/lib/rubygems/syck_hack.rb +2 -0
- data/lib/rubygems/test_case.rb +199 -109
- data/lib/rubygems/test_utilities.rb +25 -5
- data/lib/rubygems/uninstaller.rb +62 -20
- data/lib/rubygems/user_interaction.rb +10 -0
- data/lib/rubygems/validator.rb +33 -40
- data/lib/rubygems/version.rb +19 -8
- data/setup.rb +8 -1
- data/test/rubygems/alternate_cert.pem +9 -0
- data/test/rubygems/alternate_cert_32.pem +9 -0
- data/test/rubygems/alternate_key.pem +9 -0
- data/test/rubygems/bad_rake.rb +1 -0
- data/test/rubygems/child_cert.pem +9 -0
- data/test/rubygems/child_cert_32.pem +9 -0
- data/test/rubygems/child_key.pem +9 -0
- data/test/rubygems/data/null-type.gemspec.rz +0 -0
- data/test/rubygems/expired_cert.pem +9 -0
- data/test/rubygems/future_cert.pem +9 -0
- data/test/rubygems/future_cert_32.pem +9 -0
- data/test/rubygems/good_rake.rb +1 -0
- data/test/rubygems/grandchild_cert.pem +9 -0
- data/test/rubygems/grandchild_cert_32.pem +9 -0
- data/test/rubygems/grandchild_key.pem +9 -0
- data/test/rubygems/invalid_issuer_cert.pem +9 -0
- data/test/rubygems/invalid_issuer_cert_32.pem +9 -0
- data/test/rubygems/invalid_key.pem +9 -0
- data/test/rubygems/invalid_signer_cert.pem +9 -0
- data/test/rubygems/invalid_signer_cert_32.pem +9 -0
- data/test/rubygems/invalidchild_cert.pem +9 -0
- data/test/rubygems/invalidchild_cert_32.pem +9 -0
- data/test/rubygems/invalidchild_key.pem +9 -0
- data/test/rubygems/plugin/exception/rubygems_plugin.rb +1 -1
- data/test/rubygems/plugin/standarderror/rubygems_plugin.rb +1 -1
- data/test/rubygems/private_key.pem +7 -25
- data/test/rubygems/public_cert.pem +8 -18
- data/test/rubygems/public_cert_32.pem +10 -0
- data/test/rubygems/public_key.pem +4 -0
- data/test/rubygems/rubygems/commands/crash_command.rb +1 -1
- data/test/rubygems/test_config.rb +4 -6
- data/test/rubygems/test_deprecate.rb +76 -0
- data/test/rubygems/test_gem.rb +318 -83
- data/test/rubygems/test_gem_available_set.rb +106 -0
- data/test/rubygems/test_gem_command.rb +10 -0
- data/test/rubygems/test_gem_command_manager.rb +55 -9
- data/test/rubygems/test_gem_commands_build_command.rb +11 -19
- data/test/rubygems/test_gem_commands_cert_command.rb +441 -42
- data/test/rubygems/test_gem_commands_cleanup_command.rb +29 -1
- data/test/rubygems/test_gem_commands_contents_command.rb +23 -0
- data/test/rubygems/test_gem_commands_dependency_command.rb +5 -0
- data/test/rubygems/test_gem_commands_fetch_command.rb +19 -20
- data/test/rubygems/test_gem_commands_generate_index_command.rb +2 -83
- data/test/rubygems/test_gem_commands_help_command.rb +2 -1
- data/test/rubygems/test_gem_commands_install_command.rb +647 -48
- data/test/rubygems/test_gem_commands_mirror.rb +32 -0
- data/test/rubygems/test_gem_commands_owner_command.rb +4 -8
- data/test/rubygems/test_gem_commands_pristine_command.rb +99 -4
- data/test/rubygems/test_gem_commands_push_command.rb +62 -8
- data/test/rubygems/test_gem_commands_query_command.rb +51 -0
- data/test/rubygems/test_gem_commands_search_command.rb +25 -0
- data/test/rubygems/test_gem_commands_setup_command.rb +45 -0
- data/test/rubygems/test_gem_commands_sources_command.rb +21 -6
- data/test/rubygems/test_gem_commands_specification_command.rb +33 -1
- data/test/rubygems/test_gem_commands_uninstall_command.rb +91 -31
- data/test/rubygems/test_gem_commands_unpack_command.rb +3 -3
- data/test/rubygems/test_gem_commands_update_command.rb +56 -38
- data/test/rubygems/test_gem_commands_which_command.rb +4 -4
- data/test/rubygems/test_gem_commands_yank_command.rb +97 -0
- data/test/rubygems/test_gem_config_file.rb +66 -21
- data/test/rubygems/test_gem_dependency.rb +46 -0
- data/test/rubygems/test_gem_dependency_installer.rb +228 -18
- data/test/rubygems/test_gem_dependency_list.rb +0 -9
- data/test/rubygems/test_gem_dependency_resolver.rb +327 -0
- data/test/rubygems/test_gem_ext_configure_builder.rb +4 -4
- data/test/rubygems/test_gem_ext_ext_conf_builder.rb +21 -49
- data/test/rubygems/test_gem_ext_rake_builder.rb +13 -13
- data/test/rubygems/test_gem_gem_runner.rb +27 -5
- data/test/rubygems/test_gem_gemcutter_utilities.rb +19 -0
- data/test/rubygems/test_gem_indexer.rb +14 -227
- data/test/rubygems/test_gem_install_update_options.rb +83 -3
- data/test/rubygems/test_gem_installer.rb +211 -236
- data/test/rubygems/test_gem_local_remote_options.rb +8 -2
- data/test/rubygems/test_gem_name_tuple.rb +15 -0
- data/test/rubygems/test_gem_package.rb +547 -0
- data/test/rubygems/test_gem_package_old.rb +37 -0
- data/test/rubygems/test_gem_package_tar_reader.rb +32 -0
- data/test/rubygems/test_gem_package_tar_writer.rb +84 -1
- data/test/rubygems/test_gem_path_support.rb +4 -30
- data/test/rubygems/test_gem_platform.rb +3 -6
- data/test/rubygems/test_gem_rdoc.rb +245 -0
- data/test/rubygems/test_gem_remote_fetcher.rb +51 -5
- data/test/rubygems/test_gem_request_set.rb +70 -0
- data/test/rubygems/test_gem_requirement.rb +53 -24
- data/test/rubygems/test_gem_security.rb +189 -43
- data/test/rubygems/test_gem_security_policy.rb +376 -0
- data/test/rubygems/test_gem_security_signer.rb +184 -0
- data/test/rubygems/test_gem_security_trust_dir.rb +94 -0
- data/test/rubygems/test_gem_server.rb +31 -36
- data/test/rubygems/test_gem_silent_ui.rb +2 -2
- data/test/rubygems/test_gem_source.rb +188 -0
- data/test/rubygems/test_gem_source_list.rb +87 -0
- data/test/rubygems/test_gem_source_local.rb +83 -0
- data/test/rubygems/test_gem_source_specific_file.rb +33 -0
- data/test/rubygems/test_gem_spec_fetcher.rb +91 -255
- data/test/rubygems/test_gem_specification.rb +293 -39
- data/test/rubygems/test_gem_uninstaller.rb +136 -13
- data/test/rubygems/test_gem_validator.rb +14 -41
- data/test/rubygems/test_gem_version.rb +15 -21
- data/test/rubygems/test_require.rb +193 -0
- data/test/rubygems/wrong_key_cert.pem +9 -0
- data/test/rubygems/wrong_key_cert_32.pem +9 -0
- metadata +171 -83
- metadata.gz.sig +1 -0
- data/CVE-2013-4287.txt +0 -36
- data/CVE-2013-4363.txt +0 -45
- data/ci_build.sh +0 -27
- data/cruise_config.rb +0 -32
- data/lib/rbconfig/datadir.rb +0 -13
- data/lib/rubygems/builder.rb +0 -99
- data/lib/rubygems/custom_require.rb +0 -69
- data/lib/rubygems/doc_manager.rb +0 -243
- data/lib/rubygems/format.rb +0 -82
- data/lib/rubygems/gem_openssl.rb +0 -90
- data/lib/rubygems/gem_path_searcher.rb +0 -172
- data/lib/rubygems/old_format.rb +0 -153
- data/lib/rubygems/package/f_sync_dir.rb +0 -23
- data/lib/rubygems/package/tar_input.rb +0 -234
- data/lib/rubygems/package/tar_output.rb +0 -146
- data/lib/rubygems/require_paths_builder.rb +0 -18
- data/lib/rubygems/source_index.rb +0 -406
- data/lib/rubygems/ssl_certs/AddTrustExternalCARoot-2048.pem +0 -25
- data/lib/rubygems/ssl_certs/Class3PublicPrimaryCertificationAuthority.pem +0 -14
- data/lib/rubygems/ssl_certs/DigiCertHighAssuranceEVRootCA.pem +0 -23
- data/lib/rubygems/ssl_certs/EntrustnetSecureServerCertificationAuthority.pem +0 -28
- data/lib/rubygems/ssl_certs/GeoTrustGlobalCA.pem +0 -20
- data/test/rubygems/test_bundled_ca.rb +0 -59
- data/test/rubygems/test_gem_builder.rb +0 -44
- data/test/rubygems/test_gem_doc_manager.rb +0 -32
- data/test/rubygems/test_gem_ext_builder.rb +0 -58
- data/test/rubygems/test_gem_format.rb +0 -88
- data/test/rubygems/test_gem_gem_path_searcher.rb +0 -94
- data/test/rubygems/test_gem_package_tar_input.rb +0 -129
- data/test/rubygems/test_gem_package_tar_output.rb +0 -101
- data/test/rubygems/test_gem_source_index.rb +0 -250
- data/util/update_bundled_ca_certificates.rb +0 -103
@@ -1,5 +1,4 @@
|
|
1
|
-
# coding:
|
2
|
-
|
1
|
+
# -*- coding: us-ascii -*-
|
3
2
|
require 'rubygems/test_case'
|
4
3
|
require 'stringio'
|
5
4
|
require 'rubygems/specification'
|
@@ -83,6 +82,7 @@ end
|
|
83
82
|
files
|
84
83
|
homepage
|
85
84
|
licenses
|
85
|
+
metadata
|
86
86
|
name
|
87
87
|
platform
|
88
88
|
post_install_message
|
@@ -302,6 +302,21 @@ dependencies: []
|
|
302
302
|
assert_equal @a2, spec
|
303
303
|
end
|
304
304
|
|
305
|
+
def test_self_load_tainted
|
306
|
+
full_path = @a2.spec_file
|
307
|
+
write_file full_path do |io|
|
308
|
+
io.write @a2.to_ruby_for_cache
|
309
|
+
end
|
310
|
+
|
311
|
+
full_path.taint
|
312
|
+
loader = Thread.new { $SAFE = 1; Gem::Specification.load full_path }
|
313
|
+
spec = loader.value
|
314
|
+
|
315
|
+
@a2.files.clear
|
316
|
+
|
317
|
+
assert_equal @a2, spec
|
318
|
+
end
|
319
|
+
|
305
320
|
def test_self_load_escape_curly
|
306
321
|
@a2.name = 'a};raise "improper escaping";%q{'
|
307
322
|
|
@@ -421,15 +436,13 @@ dependencies: []
|
|
421
436
|
end
|
422
437
|
|
423
438
|
def test_emits_zulu_timestamps_properly
|
424
|
-
skip "bug only on 1.9.2" unless RUBY_VERSION =~ /1\.9\.2/
|
425
|
-
|
426
439
|
t = Time.utc(2012, 3, 12)
|
427
440
|
@a2.date = t
|
428
441
|
|
429
442
|
yaml = with_psych { @a2.to_yaml }
|
430
443
|
|
431
444
|
assert_match %r!date: 2012-03-12 00:00:00\.000000000 Z!, yaml
|
432
|
-
end
|
445
|
+
end if RUBY_VERSION =~ /1\.9\.2/
|
433
446
|
|
434
447
|
def test_initialize
|
435
448
|
spec = Gem::Specification.new do |s|
|
@@ -573,10 +586,6 @@ dependencies: []
|
|
573
586
|
@a2.activate
|
574
587
|
|
575
588
|
assert @a2.activated?
|
576
|
-
|
577
|
-
Gem::Deprecate.skip_during do
|
578
|
-
assert @a2.loaded?
|
579
|
-
end
|
580
589
|
end
|
581
590
|
|
582
591
|
def test_add_dependency_with_explicit_type
|
@@ -645,11 +654,29 @@ dependencies: []
|
|
645
654
|
assert_equal Time.utc(2003, 9, 17, 0,0,0), @a1.date
|
646
655
|
end
|
647
656
|
|
657
|
+
def test_date_tolerates_hour_sec_zulu
|
658
|
+
@a1.date = "2012-01-12 11:22:33.4444444 Z"
|
659
|
+
assert_equal Time.utc(2012,01,12,0,0,0), @a1.date
|
660
|
+
end
|
661
|
+
|
662
|
+
def test_date_tolerates_hour_sec_and_timezone
|
663
|
+
@a1.date = "2012-01-12 11:22:33.4444444 +02:33"
|
664
|
+
assert_equal Time.utc(2012,01,12,0,0,0), @a1.date
|
665
|
+
end
|
666
|
+
|
648
667
|
def test_dependencies
|
649
668
|
util_setup_deps
|
650
669
|
assert_equal [@bonobo, @monkey], @gem.dependencies
|
651
670
|
end
|
652
671
|
|
672
|
+
def test_doc_dir
|
673
|
+
assert_equal File.join(@gemhome, 'doc', 'a-1'), @a1.doc_dir
|
674
|
+
end
|
675
|
+
|
676
|
+
def test_doc_dir_type
|
677
|
+
assert_equal File.join(@gemhome, 'doc', 'a-1', 'ri'), @a1.doc_dir('ri')
|
678
|
+
end
|
679
|
+
|
653
680
|
def test_runtime_dependencies
|
654
681
|
util_setup_deps
|
655
682
|
assert_equal [@bonobo], @gem.runtime_dependencies
|
@@ -814,14 +841,17 @@ dependencies: []
|
|
814
841
|
def test_full_name
|
815
842
|
assert_equal 'a-1', @a1.full_name
|
816
843
|
|
844
|
+
@a1 = Gem::Specification.new "a", 1
|
817
845
|
@a1.platform = Gem::Platform.new ['universal', 'darwin', nil]
|
818
846
|
assert_equal 'a-1-universal-darwin', @a1.full_name
|
819
847
|
|
848
|
+
@a1 = Gem::Specification.new "a", 1
|
820
849
|
@a1.instance_variable_set :@new_platform, 'mswin32'
|
821
850
|
assert_equal 'a-1-mswin32', @a1.full_name, 'legacy'
|
822
851
|
|
823
852
|
return if win_platform?
|
824
853
|
|
854
|
+
@a1 = Gem::Specification.new "a", 1
|
825
855
|
@a1.platform = 'current'
|
826
856
|
assert_equal 'a-1-x86-darwin-8', @a1.full_name
|
827
857
|
end
|
@@ -834,6 +864,7 @@ dependencies: []
|
|
834
864
|
}
|
835
865
|
|
836
866
|
test_cases.each do |arch, expected|
|
867
|
+
@a1 = Gem::Specification.new "a", 1
|
837
868
|
util_set_arch arch
|
838
869
|
@a1.platform = 'current'
|
839
870
|
assert_equal expected, @a1.full_name
|
@@ -846,15 +877,12 @@ dependencies: []
|
|
846
877
|
refute_equal @a1.hash, @a2.hash
|
847
878
|
end
|
848
879
|
|
849
|
-
def
|
850
|
-
|
851
|
-
assert_equal @gemhome, @a1.installation_path
|
880
|
+
def test_base_dir
|
881
|
+
assert_equal @gemhome, @a1.base_dir
|
852
882
|
|
853
|
-
|
854
|
-
@a1.instance_variable_set :@loaded, false
|
883
|
+
@a1.instance_variable_set :@loaded_from, nil
|
855
884
|
|
856
|
-
|
857
|
-
end
|
885
|
+
assert_equal Gem.dir, @a1.base_dir
|
858
886
|
end
|
859
887
|
|
860
888
|
def test_lib_files
|
@@ -887,6 +915,20 @@ dependencies: []
|
|
887
915
|
assert_equal Gem::Platform::RUBY, @a1.platform
|
888
916
|
end
|
889
917
|
|
918
|
+
def test_platform_change_reset_full_name
|
919
|
+
orig_full_name = @a1.full_name
|
920
|
+
|
921
|
+
@a1.platform = "universal-unknown"
|
922
|
+
refute_equal orig_full_name, @a1.full_name
|
923
|
+
end
|
924
|
+
|
925
|
+
def test_platform_change_reset_cache_file
|
926
|
+
orig_cache_file = @a1.cache_file
|
927
|
+
|
928
|
+
@a1.platform = "universal-unknown"
|
929
|
+
refute_equal orig_cache_file, @a1.cache_file
|
930
|
+
end
|
931
|
+
|
890
932
|
def test_platform_equals
|
891
933
|
@a1.platform = nil
|
892
934
|
assert_equal Gem::Platform::RUBY, @a1.platform
|
@@ -980,6 +1022,11 @@ dependencies: []
|
|
980
1022
|
assert_equal( 1, (s2 <=> s1))
|
981
1023
|
end
|
982
1024
|
|
1025
|
+
def test_spec_file
|
1026
|
+
assert_equal File.join(@gemhome, 'specifications', 'a-1.gemspec'),
|
1027
|
+
@a1.spec_file
|
1028
|
+
end
|
1029
|
+
|
983
1030
|
def test_spec_name
|
984
1031
|
assert_equal 'a-1.gemspec', @a1.spec_name
|
985
1032
|
end
|
@@ -1120,7 +1167,7 @@ Gem::Specification.new do |s|
|
|
1120
1167
|
s.test_files = ["test/suite.rb"]
|
1121
1168
|
|
1122
1169
|
if s.respond_to? :specification_version then
|
1123
|
-
s.specification_version =
|
1170
|
+
s.specification_version = 4
|
1124
1171
|
|
1125
1172
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
1126
1173
|
s.add_runtime_dependency(%q<rake>, [\"> 0.4\"])
|
@@ -1156,6 +1203,17 @@ end
|
|
1156
1203
|
assert_equal gemspec1, gemspec2
|
1157
1204
|
end
|
1158
1205
|
|
1206
|
+
def test_to_ruby_nested_hash
|
1207
|
+
metadata = {}
|
1208
|
+
metadata[metadata] = metadata
|
1209
|
+
|
1210
|
+
@a2.metadata = metadata
|
1211
|
+
|
1212
|
+
ruby = @a2.to_ruby
|
1213
|
+
|
1214
|
+
assert_match %r%^ s\.metadata = \{ "%, ruby
|
1215
|
+
end
|
1216
|
+
|
1159
1217
|
def test_to_ruby_platform
|
1160
1218
|
@a2.platform = Gem::Platform.local
|
1161
1219
|
@a2.instance_variable_set :@original_platform, 'old_platform'
|
@@ -1177,15 +1235,6 @@ end
|
|
1177
1235
|
assert_equal @a1, same_spec
|
1178
1236
|
end
|
1179
1237
|
|
1180
|
-
def test_to_yaml_encoding
|
1181
|
-
@a1.description = 'π'
|
1182
|
-
|
1183
|
-
yaml_str = @a1.to_yaml
|
1184
|
-
same_spec = Gem::Specification.from_yaml(yaml_str)
|
1185
|
-
|
1186
|
-
assert_equal @a1.description, same_spec.description
|
1187
|
-
end
|
1188
|
-
|
1189
1238
|
def test_to_yaml_fancy
|
1190
1239
|
@a1.platform = Gem::Platform.local
|
1191
1240
|
yaml_str = @a1.to_yaml
|
@@ -1221,18 +1270,6 @@ end
|
|
1221
1270
|
assert_match %r|^platform: ruby$|, @a1.to_yaml
|
1222
1271
|
end
|
1223
1272
|
|
1224
|
-
def test_to_yaml_emits_syck_compat_yaml
|
1225
|
-
if YAML.const_defined?(:ENGINE) && !YAML::ENGINE.syck?
|
1226
|
-
@a1.add_dependency "gx", "1.0.0"
|
1227
|
-
|
1228
|
-
y = @a1.to_yaml
|
1229
|
-
|
1230
|
-
refute_match %r!^\s*- - =!, y
|
1231
|
-
else
|
1232
|
-
skip "Only validates psych yaml"
|
1233
|
-
end
|
1234
|
-
end
|
1235
|
-
|
1236
1273
|
def test_validate
|
1237
1274
|
util_setup_validate
|
1238
1275
|
|
@@ -1301,6 +1338,26 @@ end
|
|
1301
1338
|
end
|
1302
1339
|
end
|
1303
1340
|
|
1341
|
+
def test_validate_dependencies
|
1342
|
+
util_setup_validate
|
1343
|
+
|
1344
|
+
Dir.chdir @tempdir do
|
1345
|
+
@a1.add_runtime_dependency 'b', '>= 1.0.rc1'
|
1346
|
+
@a1.add_development_dependency 'c', '>= 2.0.rc2'
|
1347
|
+
|
1348
|
+
use_ui @ui do
|
1349
|
+
@a1.validate
|
1350
|
+
end
|
1351
|
+
|
1352
|
+
expected = <<-EXPECTED
|
1353
|
+
#{w}: prerelease dependency on b (>= 1.0.rc1) is not recommended
|
1354
|
+
#{w}: prerelease dependency on c (>= 2.0.rc2, development) is not recommended
|
1355
|
+
EXPECTED
|
1356
|
+
|
1357
|
+
assert_equal expected, @ui.error, 'warning'
|
1358
|
+
end
|
1359
|
+
end
|
1360
|
+
|
1304
1361
|
def test_validate_description
|
1305
1362
|
util_setup_validate
|
1306
1363
|
|
@@ -1498,6 +1555,25 @@ end
|
|
1498
1555
|
end
|
1499
1556
|
end
|
1500
1557
|
|
1558
|
+
def test_validate_permissions
|
1559
|
+
skip 'chmod not supported' if Gem.win_platform?
|
1560
|
+
|
1561
|
+
util_setup_validate
|
1562
|
+
|
1563
|
+
Dir.chdir @tempdir do
|
1564
|
+
File.chmod 0640, File.join('lib', 'code.rb')
|
1565
|
+
File.chmod 0640, File.join('bin', 'exec')
|
1566
|
+
|
1567
|
+
use_ui @ui do
|
1568
|
+
@a1.validate
|
1569
|
+
end
|
1570
|
+
|
1571
|
+
assert_match "#{w}: lib/code.rb is not world-readable\n", @ui.error
|
1572
|
+
assert_match "#{w}: bin/exec is not world-readable\n", @ui.error
|
1573
|
+
assert_match "#{w}: bin/exec is not executable\n", @ui.error
|
1574
|
+
end
|
1575
|
+
end
|
1576
|
+
|
1501
1577
|
def test_validate_platform_legacy
|
1502
1578
|
util_setup_validate
|
1503
1579
|
|
@@ -1576,6 +1652,22 @@ end
|
|
1576
1652
|
assert_equal Gem::Version.new('1'), @a1.version
|
1577
1653
|
end
|
1578
1654
|
|
1655
|
+
def test_version_change_reset_full_name
|
1656
|
+
orig_full_name = @a1.full_name
|
1657
|
+
|
1658
|
+
@a1.version = "2"
|
1659
|
+
|
1660
|
+
refute_equal orig_full_name, @a1.full_name
|
1661
|
+
end
|
1662
|
+
|
1663
|
+
def test_version_change_reset_cache_file
|
1664
|
+
orig_cache_file = @a1.cache_file
|
1665
|
+
|
1666
|
+
@a1.version = "2"
|
1667
|
+
|
1668
|
+
refute_equal orig_cache_file, @a1.cache_file
|
1669
|
+
end
|
1670
|
+
|
1579
1671
|
def test__load_fixes_Date_objects
|
1580
1672
|
spec = new_spec "a", 1
|
1581
1673
|
spec.instance_variable_set :@date, Date.today
|
@@ -1653,8 +1745,10 @@ end
|
|
1653
1745
|
a-3-x86-other_platform-1
|
1654
1746
|
a_evil-9
|
1655
1747
|
c-1.2
|
1748
|
+
dep_x-1
|
1656
1749
|
p-1
|
1657
1750
|
#{p1_curr.full_name}
|
1751
|
+
x-1
|
1658
1752
|
]
|
1659
1753
|
|
1660
1754
|
latest_specs = Gem::Specification.latest_specs.map(&:full_name).sort
|
@@ -1662,6 +1756,163 @@ end
|
|
1662
1756
|
assert_equal expected, latest_specs
|
1663
1757
|
end
|
1664
1758
|
|
1759
|
+
def test_metadata_validates_ok
|
1760
|
+
util_setup_validate
|
1761
|
+
|
1762
|
+
Dir.chdir @tempdir do
|
1763
|
+
@m1 = quick_gem 'm', '1' do |s|
|
1764
|
+
s.files = %w[lib/code.rb]
|
1765
|
+
s.metadata = { 'one' => "two", 'two' => "three" }
|
1766
|
+
end
|
1767
|
+
|
1768
|
+
use_ui @ui do
|
1769
|
+
@m1.validate
|
1770
|
+
end
|
1771
|
+
end
|
1772
|
+
end
|
1773
|
+
|
1774
|
+
def test_metadata_key_type_validation_fails
|
1775
|
+
util_setup_validate
|
1776
|
+
|
1777
|
+
Dir.chdir @tempdir do
|
1778
|
+
@m2 = quick_gem 'm', '2' do |s|
|
1779
|
+
s.files = %w[lib/code.rb]
|
1780
|
+
s.metadata = { 1 => "fail" }
|
1781
|
+
end
|
1782
|
+
|
1783
|
+
e = assert_raises Gem::InvalidSpecificationException do
|
1784
|
+
@m2.validate
|
1785
|
+
end
|
1786
|
+
|
1787
|
+
assert_equal "metadata keys must be a String", e.message
|
1788
|
+
end
|
1789
|
+
end
|
1790
|
+
|
1791
|
+
def test_metadata_key_size_validation_fails
|
1792
|
+
util_setup_validate
|
1793
|
+
|
1794
|
+
Dir.chdir @tempdir do
|
1795
|
+
@m2 = quick_gem 'm', '2' do |s|
|
1796
|
+
s.files = %w[lib/code.rb]
|
1797
|
+
s.metadata = { ("x" * 129) => "fail" }
|
1798
|
+
end
|
1799
|
+
|
1800
|
+
e = assert_raises Gem::InvalidSpecificationException do
|
1801
|
+
@m2.validate
|
1802
|
+
end
|
1803
|
+
|
1804
|
+
assert_equal "metadata key too large (129 > 128)", e.message
|
1805
|
+
end
|
1806
|
+
end
|
1807
|
+
|
1808
|
+
def test_metadata_value_type_validation_fails
|
1809
|
+
util_setup_validate
|
1810
|
+
|
1811
|
+
Dir.chdir @tempdir do
|
1812
|
+
@m2 = quick_gem 'm', '2' do |s|
|
1813
|
+
s.files = %w[lib/code.rb]
|
1814
|
+
s.metadata = { 'fail' => [] }
|
1815
|
+
end
|
1816
|
+
|
1817
|
+
e = assert_raises Gem::InvalidSpecificationException do
|
1818
|
+
@m2.validate
|
1819
|
+
end
|
1820
|
+
|
1821
|
+
assert_equal "metadata values must be a String", e.message
|
1822
|
+
end
|
1823
|
+
end
|
1824
|
+
|
1825
|
+
def test_metadata_value_size_validation_fails
|
1826
|
+
util_setup_validate
|
1827
|
+
|
1828
|
+
Dir.chdir @tempdir do
|
1829
|
+
@m2 = quick_gem 'm', '2' do |s|
|
1830
|
+
s.files = %w[lib/code.rb]
|
1831
|
+
s.metadata = { 'fail' => ("x" * 1025) }
|
1832
|
+
end
|
1833
|
+
|
1834
|
+
e = assert_raises Gem::InvalidSpecificationException do
|
1835
|
+
@m2.validate
|
1836
|
+
end
|
1837
|
+
|
1838
|
+
assert_equal "metadata value too large (1025 > 1024)", e.message
|
1839
|
+
end
|
1840
|
+
end
|
1841
|
+
|
1842
|
+
def test_metadata_specs
|
1843
|
+
valid_ruby_spec = <<-EOF
|
1844
|
+
# -*- encoding: utf-8 -*-
|
1845
|
+
|
1846
|
+
Gem::Specification.new do |s|
|
1847
|
+
s.name = "m"
|
1848
|
+
s.version = "1"
|
1849
|
+
|
1850
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
1851
|
+
s.metadata = { "one" => "two", "two" => "three" } if s.respond_to? :metadata=
|
1852
|
+
s.authors = ["A User"]
|
1853
|
+
s.date = "#{Gem::Specification::TODAY.strftime("%Y-%m-%d")}"
|
1854
|
+
s.description = "This is a test description"
|
1855
|
+
s.email = "example@example.com"
|
1856
|
+
s.files = ["lib/code.rb"]
|
1857
|
+
s.homepage = "http://example.com"
|
1858
|
+
s.require_paths = ["lib"]
|
1859
|
+
s.rubygems_version = "#{Gem::VERSION}"
|
1860
|
+
s.summary = "this is a summary"
|
1861
|
+
end
|
1862
|
+
EOF
|
1863
|
+
|
1864
|
+
@m1 = quick_gem 'm', '1' do |s|
|
1865
|
+
s.files = %w[lib/code.rb]
|
1866
|
+
s.metadata = { 'one' => "two", 'two' => "three" }
|
1867
|
+
end
|
1868
|
+
|
1869
|
+
assert_equal @m1.to_ruby, valid_ruby_spec
|
1870
|
+
end
|
1871
|
+
|
1872
|
+
def test_find_by_name
|
1873
|
+
util_make_gems
|
1874
|
+
assert(Gem::Specification.find_by_name("a"))
|
1875
|
+
assert(Gem::Specification.find_by_name("a", "1"))
|
1876
|
+
assert(Gem::Specification.find_by_name("a", ">1"))
|
1877
|
+
assert_raises(Gem::LoadError) do
|
1878
|
+
Gem::Specification.find_by_name("monkeys")
|
1879
|
+
end
|
1880
|
+
end
|
1881
|
+
|
1882
|
+
def test_find_by_path
|
1883
|
+
a = new_spec "foo", "1", nil, "lib/foo.rb"
|
1884
|
+
|
1885
|
+
install_specs a
|
1886
|
+
|
1887
|
+
assert_equal a, Gem::Specification.find_by_path('foo')
|
1888
|
+
a.activate
|
1889
|
+
assert_equal a, Gem::Specification.find_by_path('foo')
|
1890
|
+
end
|
1891
|
+
|
1892
|
+
def test_find_inactive_by_path
|
1893
|
+
a = new_spec "foo", "1", nil, "lib/foo.rb"
|
1894
|
+
|
1895
|
+
install_specs a
|
1896
|
+
|
1897
|
+
assert_equal a, Gem::Specification.find_inactive_by_path('foo')
|
1898
|
+
a.activate
|
1899
|
+
assert_equal nil, Gem::Specification.find_inactive_by_path('foo')
|
1900
|
+
end
|
1901
|
+
|
1902
|
+
def test_load_default_gem
|
1903
|
+
Gem::Specification.reset
|
1904
|
+
assert_equal [], Gem::Specification.map(&:full_name)
|
1905
|
+
|
1906
|
+
default_gem_spec = new_default_spec("default", "2.0.0.0",
|
1907
|
+
nil, "default/gem.rb")
|
1908
|
+
spec_path = File.join(@default_spec_dir, default_gem_spec.spec_name)
|
1909
|
+
write_file(spec_path) do |file|
|
1910
|
+
file.print(default_gem_spec.to_ruby)
|
1911
|
+
end
|
1912
|
+
Gem::Specification.reset
|
1913
|
+
assert_equal ["default-2.0.0.0"], Gem::Specification.map(&:full_name)
|
1914
|
+
end
|
1915
|
+
|
1665
1916
|
def util_setup_deps
|
1666
1917
|
@gem = quick_spec "awesome", "1.0" do |awesome|
|
1667
1918
|
awesome.add_runtime_dependency "bonobo", []
|
@@ -1683,7 +1934,7 @@ end
|
|
1683
1934
|
FileUtils.touch File.join("lib", "code.rb")
|
1684
1935
|
FileUtils.touch File.join("test", "suite.rb")
|
1685
1936
|
|
1686
|
-
File.open "bin/exec", "w" do |fp|
|
1937
|
+
File.open "bin/exec", "w", 0755 do |fp|
|
1687
1938
|
fp.puts "#!#{Gem.ruby}"
|
1688
1939
|
end
|
1689
1940
|
end
|
@@ -1693,10 +1944,13 @@ end
|
|
1693
1944
|
begin
|
1694
1945
|
require "yaml"
|
1695
1946
|
old_engine = YAML::ENGINE.yamler
|
1947
|
+
verbose, $VERBOSE = $VERBOSE, nil
|
1696
1948
|
YAML::ENGINE.yamler = 'syck'
|
1697
1949
|
load 'rubygems/syck_hack.rb'
|
1698
1950
|
rescue NameError
|
1699
1951
|
# probably on 1.8, ignore
|
1952
|
+
ensure
|
1953
|
+
$VERBOSE = verbose
|
1700
1954
|
end
|
1701
1955
|
|
1702
1956
|
yield
|