rubygems-update 2.7.11 → 3.0.0
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 +4 -4
- data/.rubocop.yml +66 -0
- data/.travis.yml +22 -18
- data/CONTRIBUTING.md +141 -0
- data/History.txt +289 -19
- data/MAINTAINERS.txt +1 -0
- data/Manifest.txt +16 -11
- data/POLICIES.md +92 -0
- data/README.md +47 -26
- data/Rakefile +47 -207
- data/{UPGRADING.rdoc → UPGRADING.md} +31 -32
- data/appveyor.yml +20 -45
- data/bin/gem +1 -2
- data/bin/update_rubygems +2 -3
- data/bundler/CHANGELOG.md +54 -0
- data/bundler/bundler.gemspec +7 -1
- data/bundler/lib/bundler.rb +26 -8
- data/bundler/lib/bundler/build_metadata.rb +2 -2
- data/bundler/lib/bundler/cli.rb +63 -21
- data/bundler/lib/bundler/cli/add.rb +15 -5
- data/bundler/lib/bundler/cli/binstubs.rb +8 -2
- data/bundler/lib/bundler/cli/doctor.rb +47 -1
- data/bundler/lib/bundler/cli/install.rb +8 -5
- data/bundler/lib/bundler/cli/list.rb +41 -5
- data/bundler/lib/bundler/cli/outdated.rb +7 -1
- data/bundler/lib/bundler/cli/pristine.rb +4 -0
- data/bundler/lib/bundler/cli/remove.rb +18 -0
- data/bundler/lib/bundler/definition.rb +15 -16
- data/bundler/lib/bundler/dependency.rb +2 -2
- data/bundler/lib/bundler/dsl.rb +19 -3
- data/bundler/lib/bundler/feature_flag.rb +7 -0
- data/bundler/lib/bundler/gem_version_promoter.rb +4 -2
- data/bundler/lib/bundler/injector.rb +168 -9
- data/bundler/lib/bundler/installer.rb +29 -6
- data/bundler/lib/bundler/installer/parallel_installer.rb +5 -0
- data/bundler/lib/bundler/plugin.rb +10 -3
- data/bundler/lib/bundler/plugin/events.rb +61 -0
- data/bundler/lib/bundler/resolver.rb +2 -2
- data/bundler/lib/bundler/runtime.rb +8 -2
- data/bundler/lib/bundler/settings.rb +24 -3
- data/bundler/lib/bundler/settings/validator.rb +23 -0
- data/bundler/lib/bundler/shared_helpers.rb +19 -3
- data/bundler/lib/bundler/source.rb +9 -9
- data/bundler/lib/bundler/templates/newgem/lib/newgem.rb.tt +1 -0
- data/bundler/lib/bundler/version.rb +1 -1
- data/bundler/man/bundle-add.ronn +13 -2
- data/bundler/man/bundle-config.ronn +21 -0
- data/bundler/man/bundle-install.ronn +1 -1
- data/bundler/man/bundle-list.ronn +19 -1
- data/bundler/man/bundle-outdated.ronn +4 -0
- data/bundler/man/bundle-remove.ronn +23 -0
- data/bundler/man/bundle-update.ronn +1 -1
- data/lib/rubygems.rb +70 -96
- data/lib/rubygems/available_set.rb +1 -1
- data/lib/rubygems/basic_specification.rb +12 -12
- data/lib/rubygems/bundler_version_finder.rb +3 -3
- data/lib/rubygems/command.rb +22 -15
- data/lib/rubygems/command_manager.rb +20 -11
- data/lib/rubygems/commands/build_command.rb +27 -8
- data/lib/rubygems/commands/cert_command.rb +45 -24
- data/lib/rubygems/commands/check_command.rb +1 -1
- data/lib/rubygems/commands/cleanup_command.rb +14 -7
- data/lib/rubygems/commands/contents_command.rb +14 -15
- data/lib/rubygems/commands/dependency_command.rb +17 -17
- data/lib/rubygems/commands/environment_command.rb +20 -1
- data/lib/rubygems/commands/fetch_command.rb +2 -3
- data/lib/rubygems/commands/generate_index_command.rb +2 -3
- data/lib/rubygems/commands/help_command.rb +12 -13
- data/lib/rubygems/commands/info_command.rb +33 -0
- data/lib/rubygems/commands/install_command.rb +21 -17
- data/lib/rubygems/commands/list_command.rb +0 -1
- data/lib/rubygems/commands/lock_command.rb +3 -4
- data/lib/rubygems/commands/open_command.rb +16 -10
- data/lib/rubygems/commands/owner_command.rb +20 -11
- data/lib/rubygems/commands/pristine_command.rb +23 -16
- data/lib/rubygems/commands/push_command.rb +17 -8
- data/lib/rubygems/commands/query_command.rb +24 -24
- data/lib/rubygems/commands/rdoc_command.rb +3 -4
- data/lib/rubygems/commands/search_command.rb +0 -1
- data/lib/rubygems/commands/server_command.rb +1 -2
- data/lib/rubygems/commands/setup_command.rb +78 -38
- data/lib/rubygems/commands/signin_command.rb +2 -1
- data/lib/rubygems/commands/signout_command.rb +2 -2
- data/lib/rubygems/commands/sources_command.rb +11 -12
- data/lib/rubygems/commands/specification_command.rb +7 -7
- data/lib/rubygems/commands/uninstall_command.rb +41 -19
- data/lib/rubygems/commands/unpack_command.rb +16 -7
- data/lib/rubygems/commands/update_command.rb +28 -23
- data/lib/rubygems/commands/which_command.rb +4 -5
- data/lib/rubygems/commands/yank_command.rb +1 -2
- data/lib/rubygems/compatibility.rb +1 -21
- data/lib/rubygems/config_file.rb +36 -36
- data/lib/rubygems/core_ext/kernel_require.rb +6 -6
- data/lib/rubygems/core_ext/kernel_warn.rb +45 -0
- data/lib/rubygems/defaults.rb +31 -12
- data/lib/rubygems/dependency.rb +14 -14
- data/lib/rubygems/dependency_installer.rb +29 -31
- data/lib/rubygems/dependency_list.rb +8 -9
- data/lib/rubygems/deprecate.rb +2 -3
- data/lib/rubygems/doctor.rb +5 -6
- data/lib/rubygems/errors.rb +3 -3
- data/lib/rubygems/exceptions.rb +11 -4
- data/lib/rubygems/ext.rb +0 -1
- data/lib/rubygems/ext/build_error.rb +0 -1
- data/lib/rubygems/ext/builder.rb +50 -23
- data/lib/rubygems/ext/cmake_builder.rb +2 -2
- data/lib/rubygems/ext/configure_builder.rb +2 -3
- data/lib/rubygems/ext/ext_conf_builder.rb +8 -7
- data/lib/rubygems/ext/rake_builder.rb +16 -18
- data/lib/rubygems/gem_runner.rb +2 -2
- data/lib/rubygems/gemcutter_utilities.rb +40 -13
- data/lib/rubygems/indexer.rb +19 -12
- data/lib/rubygems/install_default_message.rb +0 -1
- data/lib/rubygems/install_message.rb +0 -1
- data/lib/rubygems/install_update_options.rb +2 -28
- data/lib/rubygems/installer.rb +95 -75
- data/lib/rubygems/installer_test_case.rb +0 -14
- data/lib/rubygems/local_remote_options.rb +5 -4
- data/lib/rubygems/mock_gem_ui.rb +3 -4
- data/lib/rubygems/name_tuple.rb +4 -4
- data/lib/rubygems/package.rb +90 -73
- data/lib/rubygems/package/digest_io.rb +3 -4
- data/lib/rubygems/package/file_source.rb +3 -4
- data/lib/rubygems/package/io_source.rb +1 -2
- data/lib/rubygems/package/old.rb +8 -16
- data/lib/rubygems/package/source.rb +0 -1
- data/lib/rubygems/package/tar_header.rb +2 -2
- data/lib/rubygems/package/tar_reader.rb +2 -4
- data/lib/rubygems/package/tar_reader/entry.rb +20 -4
- data/lib/rubygems/package/tar_test_case.rb +2 -8
- data/lib/rubygems/package/tar_writer.rb +13 -15
- data/lib/rubygems/package_task.rb +0 -1
- data/lib/rubygems/path_support.rb +16 -6
- data/lib/rubygems/platform.rb +4 -5
- data/lib/rubygems/psych_tree.rb +1 -1
- data/lib/rubygems/rdoc.rb +0 -311
- data/lib/rubygems/remote_fetcher.rb +34 -48
- data/lib/rubygems/request.rb +16 -15
- data/lib/rubygems/request/connection_pools.rb +24 -13
- data/lib/rubygems/request/http_pool.rb +3 -4
- data/lib/rubygems/request/https_pool.rb +1 -3
- data/lib/rubygems/request_set.rb +52 -25
- data/lib/rubygems/request_set/gem_dependency_api.rb +36 -40
- data/lib/rubygems/request_set/lockfile.rb +12 -12
- data/lib/rubygems/request_set/lockfile/parser.rb +18 -29
- data/lib/rubygems/request_set/lockfile/tokenizer.rb +9 -9
- data/lib/rubygems/requirement.rb +16 -16
- data/lib/rubygems/resolver.rb +10 -15
- data/lib/rubygems/resolver/activation_request.rb +6 -6
- data/lib/rubygems/resolver/api_set.rb +5 -6
- data/lib/rubygems/resolver/api_specification.rb +2 -3
- data/lib/rubygems/resolver/best_set.rb +5 -6
- data/lib/rubygems/resolver/composed_set.rb +5 -6
- data/lib/rubygems/resolver/conflict.rb +5 -5
- data/lib/rubygems/resolver/current_set.rb +1 -2
- data/lib/rubygems/resolver/dependency_request.rb +4 -4
- data/lib/rubygems/resolver/git_set.rb +5 -6
- data/lib/rubygems/resolver/git_specification.rb +4 -5
- data/lib/rubygems/resolver/index_set.rb +5 -6
- data/lib/rubygems/resolver/index_specification.rb +3 -4
- data/lib/rubygems/resolver/installed_specification.rb +3 -4
- data/lib/rubygems/resolver/installer_set.rb +12 -12
- data/lib/rubygems/resolver/local_specification.rb +1 -2
- data/lib/rubygems/resolver/lock_set.rb +5 -6
- data/lib/rubygems/resolver/lock_specification.rb +7 -8
- data/lib/rubygems/resolver/requirement_list.rb +1 -1
- data/lib/rubygems/resolver/set.rb +2 -2
- data/lib/rubygems/resolver/source_set.rb +4 -5
- data/lib/rubygems/resolver/spec_specification.rb +1 -2
- data/lib/rubygems/resolver/specification.rb +10 -7
- data/lib/rubygems/resolver/stats.rb +1 -1
- data/lib/rubygems/resolver/vendor_set.rb +4 -5
- data/lib/rubygems/resolver/vendor_specification.rb +2 -3
- data/lib/rubygems/safe_yaml.rb +18 -10
- data/lib/rubygems/security.rb +21 -22
- data/lib/rubygems/security/policies.rb +1 -2
- data/lib/rubygems/security/policy.rb +25 -25
- data/lib/rubygems/security/signer.rb +72 -24
- data/lib/rubygems/security/trust_dir.rb +10 -10
- data/lib/rubygems/server.rb +21 -21
- data/lib/rubygems/source.rb +16 -25
- data/lib/rubygems/source/git.rb +9 -10
- data/lib/rubygems/source/installed.rb +3 -4
- data/lib/rubygems/source/local.rb +7 -7
- data/lib/rubygems/source/lock.rb +4 -4
- data/lib/rubygems/source/specific_file.rb +5 -5
- data/lib/rubygems/source/vendor.rb +2 -3
- data/lib/rubygems/source_list.rb +2 -2
- data/lib/rubygems/source_local.rb +0 -1
- data/lib/rubygems/spec_fetcher.rb +5 -6
- data/lib/rubygems/specification.rb +199 -536
- data/lib/rubygems/specification_policy.rb +407 -0
- data/lib/rubygems/ssl_certs/{rubygems.org → index.rubygems.org}/GlobalSignRootCA.pem +0 -0
- data/lib/rubygems/ssl_certs/rubygems.global.ssl.fastly.net/DigiCertHighAssuranceEVRootCA.pem +23 -0
- data/lib/rubygems/ssl_certs/rubygems.org/AddTrustExternalCARoot.pem +25 -0
- data/lib/rubygems/stub_specification.rb +11 -15
- data/lib/rubygems/test_case.rb +141 -66
- data/lib/rubygems/test_utilities.rb +20 -35
- data/lib/rubygems/text.rb +6 -6
- data/lib/rubygems/uninstaller.rb +37 -26
- data/lib/rubygems/uri_formatter.rb +1 -2
- data/lib/rubygems/user_interaction.rb +38 -93
- data/lib/rubygems/util.rb +20 -14
- data/lib/rubygems/util/licenses.rb +27 -1
- data/lib/rubygems/util/list.rb +1 -1
- data/lib/rubygems/validator.rb +4 -5
- data/lib/rubygems/version.rb +15 -15
- data/lib/rubygems/version_option.rb +2 -3
- data/rubygems-update.gemspec +43 -0
- data/setup.rb +2 -8
- data/test/rubygems/rubygems_plugin.rb +0 -1
- data/test/rubygems/simple_gem.rb +1 -1
- data/test/rubygems/test_bundled_ca.rb +4 -7
- data/test/rubygems/test_config.rb +7 -2
- data/test/rubygems/test_gem.rb +161 -130
- data/test/rubygems/test_gem_command.rb +0 -1
- data/test/rubygems/test_gem_command_manager.rb +8 -3
- data/test/rubygems/test_gem_commands_build_command.rb +219 -15
- data/test/rubygems/test_gem_commands_cert_command.rb +69 -8
- data/test/rubygems/test_gem_commands_check_command.rb +1 -1
- data/test/rubygems/test_gem_commands_cleanup_command.rb +27 -1
- data/test/rubygems/test_gem_commands_contents_command.rb +1 -2
- data/test/rubygems/test_gem_commands_dependency_command.rb +33 -34
- data/test/rubygems/test_gem_commands_environment_command.rb +1 -0
- data/test/rubygems/test_gem_commands_fetch_command.rb +0 -1
- data/test/rubygems/test_gem_commands_generate_index_command.rb +0 -1
- data/test/rubygems/test_gem_commands_help_command.rb +7 -4
- data/test/rubygems/test_gem_commands_info_command.rb +44 -0
- data/test/rubygems/test_gem_commands_install_command.rb +79 -12
- data/test/rubygems/test_gem_commands_lock_command.rb +0 -1
- data/test/rubygems/test_gem_commands_open_command.rb +29 -0
- data/test/rubygems/test_gem_commands_outdated_command.rb +0 -1
- data/test/rubygems/test_gem_commands_owner_command.rb +93 -57
- data/test/rubygems/test_gem_commands_pristine_command.rb +65 -30
- data/test/rubygems/test_gem_commands_push_command.rb +39 -0
- data/test/rubygems/test_gem_commands_query_command.rb +102 -100
- data/test/rubygems/test_gem_commands_search_command.rb +0 -1
- data/test/rubygems/test_gem_commands_server_command.rb +0 -1
- data/test/rubygems/test_gem_commands_setup_command.rb +39 -8
- data/test/rubygems/test_gem_commands_signin_command.rb +1 -1
- data/test/rubygems/test_gem_commands_sources_command.rb +0 -1
- data/test/rubygems/test_gem_commands_specification_command.rb +2 -3
- data/test/rubygems/test_gem_commands_stale_command.rb +3 -2
- data/test/rubygems/test_gem_commands_uninstall_command.rb +81 -7
- data/test/rubygems/test_gem_commands_unpack_command.rb +17 -1
- data/test/rubygems/test_gem_commands_update_command.rb +19 -2
- data/test/rubygems/test_gem_commands_which_command.rb +0 -1
- data/test/rubygems/test_gem_commands_yank_command.rb +0 -1
- data/test/rubygems/test_gem_config_file.rb +4 -2
- data/test/rubygems/test_gem_dependency.rb +0 -1
- data/test/rubygems/test_gem_dependency_installer.rb +8 -5
- data/test/rubygems/test_gem_dependency_list.rb +6 -7
- data/test/rubygems/test_gem_dependency_resolution_error.rb +0 -1
- data/test/rubygems/test_gem_doctor.rb +1 -2
- data/test/rubygems/test_gem_ext_builder.rb +10 -23
- data/test/rubygems/test_gem_ext_cmake_builder.rb +5 -4
- data/test/rubygems/test_gem_ext_configure_builder.rb +3 -3
- data/test/rubygems/test_gem_ext_ext_conf_builder.rb +8 -9
- data/test/rubygems/test_gem_ext_rake_builder.rb +20 -5
- data/test/rubygems/test_gem_gem_runner.rb +0 -1
- data/test/rubygems/test_gem_gemcutter_utilities.rb +32 -6
- data/test/rubygems/test_gem_impossible_dependencies_error.rb +0 -1
- data/test/rubygems/test_gem_indexer.rb +1 -2
- data/test/rubygems/test_gem_install_update_options.rb +1 -20
- data/test/rubygems/test_gem_installer.rb +69 -203
- data/test/rubygems/test_gem_local_remote_options.rb +3 -3
- data/test/rubygems/test_gem_name_tuple.rb +0 -1
- data/test/rubygems/test_gem_package.rb +59 -50
- data/test/rubygems/test_gem_package_old.rb +0 -1
- data/test/rubygems/test_gem_package_tar_header.rb +1 -2
- data/test/rubygems/test_gem_package_tar_reader.rb +0 -1
- data/test/rubygems/test_gem_package_tar_reader_entry.rb +11 -0
- data/test/rubygems/test_gem_package_tar_writer.rb +40 -7
- data/test/rubygems/test_gem_package_task.rb +2 -2
- data/test/rubygems/test_gem_path_support.rb +28 -11
- data/test/rubygems/test_gem_platform.rb +4 -5
- data/test/rubygems/test_gem_rdoc.rb +1 -2
- data/test/rubygems/test_gem_remote_fetcher.rb +111 -130
- data/test/rubygems/test_gem_request.rb +5 -5
- data/test/rubygems/test_gem_request_connection_pools.rb +24 -3
- data/test/rubygems/test_gem_request_set.rb +5 -5
- data/test/rubygems/test_gem_request_set_gem_dependency_api.rb +2 -7
- data/test/rubygems/test_gem_request_set_lockfile.rb +1 -2
- data/test/rubygems/test_gem_request_set_lockfile_parser.rb +4 -9
- data/test/rubygems/test_gem_request_set_lockfile_tokenizer.rb +1 -1
- data/test/rubygems/test_gem_requirement.rb +18 -4
- data/test/rubygems/test_gem_resolver.rb +13 -17
- data/test/rubygems/test_gem_resolver_activation_request.rb +0 -1
- data/test/rubygems/test_gem_resolver_api_set.rb +0 -1
- data/test/rubygems/test_gem_resolver_api_specification.rb +0 -1
- data/test/rubygems/test_gem_resolver_best_set.rb +0 -1
- data/test/rubygems/test_gem_resolver_composed_set.rb +0 -1
- data/test/rubygems/test_gem_resolver_conflict.rb +0 -1
- data/test/rubygems/test_gem_resolver_dependency_request.rb +0 -1
- data/test/rubygems/test_gem_resolver_git_set.rb +0 -1
- data/test/rubygems/test_gem_resolver_git_specification.rb +0 -1
- data/test/rubygems/test_gem_resolver_index_set.rb +0 -1
- data/test/rubygems/test_gem_resolver_index_specification.rb +0 -1
- data/test/rubygems/test_gem_resolver_installed_specification.rb +0 -1
- data/test/rubygems/test_gem_resolver_installer_set.rb +2 -3
- data/test/rubygems/test_gem_resolver_local_specification.rb +0 -1
- data/test/rubygems/test_gem_resolver_lock_set.rb +0 -1
- data/test/rubygems/test_gem_resolver_lock_specification.rb +0 -1
- data/test/rubygems/test_gem_resolver_requirement_list.rb +0 -1
- data/test/rubygems/test_gem_resolver_specification.rb +1 -2
- data/test/rubygems/test_gem_resolver_vendor_set.rb +0 -1
- data/test/rubygems/test_gem_resolver_vendor_specification.rb +0 -1
- data/test/rubygems/test_gem_security.rb +1 -3
- data/test/rubygems/test_gem_security_policy.rb +4 -5
- data/test/rubygems/test_gem_security_signer.rb +4 -3
- data/test/rubygems/test_gem_security_trust_dir.rb +1 -2
- data/test/rubygems/test_gem_server.rb +4 -4
- data/test/rubygems/test_gem_source.rb +0 -13
- data/test/rubygems/test_gem_source_fetch_problem.rb +0 -1
- data/test/rubygems/test_gem_source_git.rb +0 -1
- data/test/rubygems/test_gem_source_installed.rb +0 -1
- data/test/rubygems/test_gem_source_lock.rb +0 -1
- data/test/rubygems/test_gem_source_vendor.rb +0 -1
- data/test/rubygems/test_gem_spec_fetcher.rb +0 -1
- data/test/rubygems/test_gem_specification.rb +334 -198
- data/test/rubygems/test_gem_stream_ui.rb +13 -30
- data/test/rubygems/test_gem_stub_specification.rb +0 -2
- data/test/rubygems/test_gem_text.rb +4 -5
- data/test/rubygems/test_gem_uninstaller.rb +21 -1
- data/test/rubygems/test_gem_unsatisfiable_dependency_error.rb +0 -1
- data/test/rubygems/test_gem_uri_formatter.rb +0 -1
- data/test/rubygems/test_gem_util.rb +6 -11
- data/test/rubygems/test_gem_validator.rb +0 -1
- data/test/rubygems/test_gem_version.rb +11 -11
- data/test/rubygems/test_gem_version_option.rb +0 -1
- data/test/rubygems/test_remote_fetch_error.rb +0 -1
- data/test/rubygems/test_require.rb +67 -52
- data/util/CL2notes +1 -2
- data/util/ci +15 -12
- data/util/create_certs.rb +6 -7
- data/util/create_encrypted_key.rb +0 -1
- data/util/patch_with_prs.rb +1 -1
- data/util/rubocop +8 -0
- data/util/update_bundled_ca_certificates.rb +15 -14
- data/util/update_changelog.rb +1 -1
- metadata +67 -59
- data/.autotest +0 -71
- data/.document +0 -5
- data/CONTRIBUTING.rdoc +0 -130
- data/CVE-2013-4287.txt +0 -35
- data/CVE-2013-4363.txt +0 -45
- data/CVE-2015-3900.txt +0 -40
- data/POLICIES.rdoc +0 -74
- data/lib/rubygems/ssl_certs/rubygems.org/GlobalSignRootCA_R3.pem +0 -21
- data/test/rubygems/fix_openssl_warnings.rb +0 -13
@@ -31,7 +31,7 @@ class Gem::Package::DigestIO
|
|
31
31
|
# digests['SHA1'].hexdigest #=> "aaf4c61d[...]"
|
32
32
|
# digests['SHA512'].hexdigest #=> "9b71d224[...]"
|
33
33
|
|
34
|
-
def self.wrap
|
34
|
+
def self.wrap(io, digests)
|
35
35
|
digest_io = new io, digests
|
36
36
|
|
37
37
|
yield digest_io
|
@@ -43,7 +43,7 @@ class Gem::Package::DigestIO
|
|
43
43
|
# Creates a new DigestIO instance. Using ::wrap is recommended, see the
|
44
44
|
# ::wrap documentation for documentation of +io+ and +digests+.
|
45
45
|
|
46
|
-
def initialize
|
46
|
+
def initialize(io, digests)
|
47
47
|
@io = io
|
48
48
|
@digests = digests
|
49
49
|
end
|
@@ -51,7 +51,7 @@ class Gem::Package::DigestIO
|
|
51
51
|
##
|
52
52
|
# Writes +data+ to the underlying IO and updates the digests
|
53
53
|
|
54
|
-
def write
|
54
|
+
def write(data)
|
55
55
|
result = @io.write data
|
56
56
|
|
57
57
|
@digests.each do |_, digest|
|
@@ -62,4 +62,3 @@ class Gem::Package::DigestIO
|
|
62
62
|
end
|
63
63
|
|
64
64
|
end
|
65
|
-
|
@@ -10,7 +10,7 @@ class Gem::Package::FileSource < Gem::Package::Source # :nodoc: all
|
|
10
10
|
|
11
11
|
attr_reader :path
|
12
12
|
|
13
|
-
def initialize
|
13
|
+
def initialize(path)
|
14
14
|
@path = path
|
15
15
|
end
|
16
16
|
|
@@ -22,13 +22,12 @@ class Gem::Package::FileSource < Gem::Package::Source # :nodoc: all
|
|
22
22
|
File.exist? path
|
23
23
|
end
|
24
24
|
|
25
|
-
def with_write_io
|
25
|
+
def with_write_io(&block)
|
26
26
|
File.open path, 'wb', &block
|
27
27
|
end
|
28
28
|
|
29
|
-
def with_read_io
|
29
|
+
def with_read_io(&block)
|
30
30
|
File.open path, 'rb', &block
|
31
31
|
end
|
32
32
|
|
33
33
|
end
|
34
|
-
|
@@ -11,7 +11,7 @@ class Gem::Package::IOSource < Gem::Package::Source # :nodoc: all
|
|
11
11
|
|
12
12
|
attr_reader :io
|
13
13
|
|
14
|
-
def initialize
|
14
|
+
def initialize(io)
|
15
15
|
@io = io
|
16
16
|
end
|
17
17
|
|
@@ -43,4 +43,3 @@ class Gem::Package::IOSource < Gem::Package::Source # :nodoc: all
|
|
43
43
|
end
|
44
44
|
|
45
45
|
end
|
46
|
-
|
data/lib/rubygems/package/old.rb
CHANGED
@@ -19,7 +19,7 @@ class Gem::Package::Old < Gem::Package
|
|
19
19
|
# Creates a new old-format package reader for +gem+. Old-format packages
|
20
20
|
# cannot be written.
|
21
21
|
|
22
|
-
def initialize
|
22
|
+
def initialize(gem, security_policy)
|
23
23
|
require 'fileutils'
|
24
24
|
require 'zlib'
|
25
25
|
Gem.load_yaml
|
@@ -49,7 +49,7 @@ class Gem::Package::Old < Gem::Package
|
|
49
49
|
##
|
50
50
|
# Extracts the files in this package into +destination_dir+
|
51
51
|
|
52
|
-
def extract_files
|
52
|
+
def extract_files(destination_dir)
|
53
53
|
verify
|
54
54
|
|
55
55
|
errstr = "Error reading files from gem"
|
@@ -78,9 +78,9 @@ class Gem::Package::Old < Gem::Package
|
|
78
78
|
|
79
79
|
FileUtils.rm_rf destination
|
80
80
|
|
81
|
-
FileUtils.mkdir_p File.dirname
|
81
|
+
FileUtils.mkdir_p File.dirname(destination), :mode => dir_mode && 0700
|
82
82
|
|
83
|
-
File.open destination, 'wb', entry['mode'] do |out|
|
83
|
+
File.open destination, 'wb', file_mode(entry['mode']) do |out|
|
84
84
|
out.write file_data
|
85
85
|
end
|
86
86
|
|
@@ -94,7 +94,7 @@ class Gem::Package::Old < Gem::Package
|
|
94
94
|
##
|
95
95
|
# Reads the file list section from the old-format gem +io+
|
96
96
|
|
97
|
-
def file_list
|
97
|
+
def file_list(io) # :nodoc:
|
98
98
|
header = String.new
|
99
99
|
|
100
100
|
read_until_dashes io do |line|
|
@@ -107,7 +107,7 @@ class Gem::Package::Old < Gem::Package
|
|
107
107
|
##
|
108
108
|
# Reads lines until a "---" separator is found
|
109
109
|
|
110
|
-
def read_until_dashes
|
110
|
+
def read_until_dashes(io) # :nodoc:
|
111
111
|
while (line = io.gets) && line.chomp.strip != "---" do
|
112
112
|
yield line if block_given?
|
113
113
|
end
|
@@ -116,7 +116,7 @@ class Gem::Package::Old < Gem::Package
|
|
116
116
|
##
|
117
117
|
# Skips the Ruby self-install header in +io+.
|
118
118
|
|
119
|
-
def skip_ruby
|
119
|
+
def skip_ruby(io) # :nodoc:
|
120
120
|
loop do
|
121
121
|
line = io.gets
|
122
122
|
|
@@ -144,17 +144,9 @@ class Gem::Package::Old < Gem::Package
|
|
144
144
|
end
|
145
145
|
end
|
146
146
|
|
147
|
-
yaml_error = if RUBY_VERSION < '1.9' then
|
148
|
-
YAML::ParseError
|
149
|
-
elsif YAML.const_defined?(:ENGINE) && YAML::ENGINE.yamler == 'syck' then
|
150
|
-
YAML::ParseError
|
151
|
-
else
|
152
|
-
YAML::SyntaxError
|
153
|
-
end
|
154
|
-
|
155
147
|
begin
|
156
148
|
@spec = Gem::Specification.from_yaml yaml
|
157
|
-
rescue
|
149
|
+
rescue YAML::SyntaxError
|
158
150
|
raise Gem::Exception, "Failed to parse gem specification out of gem file"
|
159
151
|
end
|
160
152
|
rescue ArgumentError
|
@@ -50,7 +50,7 @@ class Gem::Package::TarHeader
|
|
50
50
|
:uid,
|
51
51
|
:uname,
|
52
52
|
:version,
|
53
|
-
]
|
53
|
+
].freeze
|
54
54
|
|
55
55
|
##
|
56
56
|
# Pack format for a tar header
|
@@ -134,7 +134,7 @@ class Gem::Package::TarHeader
|
|
134
134
|
# Creates a new TarHeader using +vals+
|
135
135
|
|
136
136
|
def initialize(vals)
|
137
|
-
unless vals[:name] && vals[:size] && vals[:prefix] && vals[:mode]
|
137
|
+
unless vals[:name] && vals[:size] && vals[:prefix] && vals[:mode]
|
138
138
|
raise ArgumentError, ":name, :size, :prefix and :mode required"
|
139
139
|
end
|
140
140
|
|
@@ -92,11 +92,9 @@ class Gem::Package::TarReader
|
|
92
92
|
# NOTE: Do not call #rewind during #each
|
93
93
|
|
94
94
|
def rewind
|
95
|
-
if @init_pos == 0
|
96
|
-
raise Gem::Package::NonSeekableIO unless @io.respond_to? :rewind
|
95
|
+
if @init_pos == 0
|
97
96
|
@io.rewind
|
98
97
|
else
|
99
|
-
raise Gem::Package::NonSeekableIO unless @io.respond_to? :pos=
|
100
98
|
@io.pos = @init_pos
|
101
99
|
end
|
102
100
|
end
|
@@ -106,7 +104,7 @@ class Gem::Package::TarReader
|
|
106
104
|
# yields it. Rewinds the tar file to the beginning when the block
|
107
105
|
# terminates.
|
108
106
|
|
109
|
-
def seek
|
107
|
+
def seek(name) # :yields: entry
|
110
108
|
found = find do |entry|
|
111
109
|
entry.full_name == name
|
112
110
|
end
|
@@ -64,7 +64,7 @@ class Gem::Package::TarReader::Entry
|
|
64
64
|
# Full name of the tar entry
|
65
65
|
|
66
66
|
def full_name
|
67
|
-
if @header.prefix != ""
|
67
|
+
if @header.prefix != ""
|
68
68
|
File.join @header.prefix, @header.name
|
69
69
|
else
|
70
70
|
@header.name
|
@@ -119,6 +119,12 @@ class Gem::Package::TarReader::Entry
|
|
119
119
|
bytes_read
|
120
120
|
end
|
121
121
|
|
122
|
+
def size
|
123
|
+
@header.size
|
124
|
+
end
|
125
|
+
|
126
|
+
alias length size
|
127
|
+
|
122
128
|
##
|
123
129
|
# Reads +len+ bytes from the tar file entry, or the rest of the entry if
|
124
130
|
# nil
|
@@ -137,7 +143,19 @@ class Gem::Package::TarReader::Entry
|
|
137
143
|
ret
|
138
144
|
end
|
139
145
|
|
140
|
-
|
146
|
+
def readpartial(maxlen = nil, outbuf = "".b)
|
147
|
+
check_closed
|
148
|
+
|
149
|
+
raise EOFError if @read >= @header.size
|
150
|
+
|
151
|
+
maxlen ||= @header.size - @read
|
152
|
+
max_read = [maxlen, @header.size - @read].min
|
153
|
+
|
154
|
+
@io.readpartial(max_read, outbuf)
|
155
|
+
@read += outbuf.size
|
156
|
+
|
157
|
+
outbuf
|
158
|
+
end
|
141
159
|
|
142
160
|
##
|
143
161
|
# Rewinds to the beginning of the tar file entry
|
@@ -145,8 +163,6 @@ class Gem::Package::TarReader::Entry
|
|
145
163
|
def rewind
|
146
164
|
check_closed
|
147
165
|
|
148
|
-
raise Gem::Package::NonSeekableIO unless @io.respond_to? :pos=
|
149
|
-
|
150
166
|
@io.pos = @orig_pos
|
151
167
|
@read = 0
|
152
168
|
end
|
@@ -52,7 +52,7 @@ class Gem::Package::TarTestCase < Gem::TestCase
|
|
52
52
|
name = fields.shift
|
53
53
|
length = fields.shift.to_i
|
54
54
|
|
55
|
-
if name == "checksum"
|
55
|
+
if name == "checksum"
|
56
56
|
chksum_off = offset
|
57
57
|
offset += length
|
58
58
|
next
|
@@ -94,13 +94,7 @@ class Gem::Package::TarTestCase < Gem::TestCase
|
|
94
94
|
ASCIIZ(dname, 155) # char prefix[155]; ASCII + (Z unless filled)
|
95
95
|
]
|
96
96
|
|
97
|
-
|
98
|
-
h = if RUBY_VERSION >= "1.9" then
|
99
|
-
arr.join
|
100
|
-
else
|
101
|
-
arr = arr.join("").split(//).map{|x| x[0]}
|
102
|
-
arr.pack format
|
103
|
-
end
|
97
|
+
h = arr.join
|
104
98
|
ret = h + "\0" * (512 - h.size)
|
105
99
|
assert_equal(512, ret.size)
|
106
100
|
ret
|
@@ -106,8 +106,6 @@ class Gem::Package::TarWriter
|
|
106
106
|
def add_file(name, mode) # :yields: io
|
107
107
|
check_closed
|
108
108
|
|
109
|
-
raise Gem::Package::NonSeekableIO unless @io.respond_to? :pos=
|
110
|
-
|
111
109
|
name, prefix = split_name name
|
112
110
|
|
113
111
|
init_pos = @io.pos
|
@@ -125,7 +123,7 @@ class Gem::Package::TarWriter
|
|
125
123
|
|
126
124
|
header = Gem::Package::TarHeader.new :name => name, :mode => mode,
|
127
125
|
:size => size, :prefix => prefix,
|
128
|
-
:mtime => Time.now
|
126
|
+
:mtime => ENV["SOURCE_DATE_EPOCH"] ? Time.at(ENV["SOURCE_DATE_EPOCH"].to_i).utc : Time.now
|
129
127
|
|
130
128
|
@io.write header
|
131
129
|
@io.pos = final_pos
|
@@ -141,11 +139,11 @@ class Gem::Package::TarWriter
|
|
141
139
|
#
|
142
140
|
# The created digest object is returned.
|
143
141
|
|
144
|
-
def add_file_digest
|
142
|
+
def add_file_digest(name, mode, digest_algorithms) # :yields: io
|
145
143
|
digests = digest_algorithms.map do |digest_algorithm|
|
146
144
|
digest = digest_algorithm.new
|
147
145
|
digest_name =
|
148
|
-
if digest.respond_to? :name
|
146
|
+
if digest.respond_to? :name
|
149
147
|
digest.name
|
150
148
|
else
|
151
149
|
/::([^:]+)$/ =~ digest_algorithm.name
|
@@ -174,7 +172,7 @@ class Gem::Package::TarWriter
|
|
174
172
|
#
|
175
173
|
# Returns the digest.
|
176
174
|
|
177
|
-
def add_file_signed
|
175
|
+
def add_file_signed(name, mode, signer)
|
178
176
|
digest_algorithms = [
|
179
177
|
signer.digest_algorithm,
|
180
178
|
Digest::SHA512,
|
@@ -186,7 +184,7 @@ class Gem::Package::TarWriter
|
|
186
184
|
|
187
185
|
signature_digest = digests.values.compact.find do |digest|
|
188
186
|
digest_name =
|
189
|
-
if digest.respond_to? :name
|
187
|
+
if digest.respond_to? :name
|
190
188
|
digest.name
|
191
189
|
else
|
192
190
|
digest.class.name[/::([^:]+)\z/, 1]
|
@@ -197,7 +195,7 @@ class Gem::Package::TarWriter
|
|
197
195
|
|
198
196
|
raise "no #{signer.digest_name} in #{digests.values.compact}" unless signature_digest
|
199
197
|
|
200
|
-
if signer.key
|
198
|
+
if signer.key
|
201
199
|
signature = signer.sign signature_digest.digest
|
202
200
|
|
203
201
|
add_file_simple "#{name}.sig", 0444, signature.length do |io|
|
@@ -219,7 +217,7 @@ class Gem::Package::TarWriter
|
|
219
217
|
|
220
218
|
header = Gem::Package::TarHeader.new(:name => name, :mode => mode,
|
221
219
|
:size => size, :prefix => prefix,
|
222
|
-
:mtime => Time.now).to_s
|
220
|
+
:mtime => ENV["SOURCE_DATE_EPOCH"] ? Time.at(ENV["SOURCE_DATE_EPOCH"].to_i).utc : Time.now).to_s
|
223
221
|
|
224
222
|
@io.write header
|
225
223
|
os = BoundedStream.new @io, size
|
@@ -247,7 +245,7 @@ class Gem::Package::TarWriter
|
|
247
245
|
:size => 0, :typeflag => "2",
|
248
246
|
:linkname => target,
|
249
247
|
:prefix => prefix,
|
250
|
-
:mtime => Time.now).to_s
|
248
|
+
:mtime => ENV["SOURCE_DATE_EPOCH"] ? Time.at(ENV["SOURCE_DATE_EPOCH"].to_i).utc : Time.now).to_s
|
251
249
|
|
252
250
|
@io.write header
|
253
251
|
|
@@ -300,7 +298,7 @@ class Gem::Package::TarWriter
|
|
300
298
|
header = Gem::Package::TarHeader.new :name => name, :mode => mode,
|
301
299
|
:typeflag => "5", :size => 0,
|
302
300
|
:prefix => prefix,
|
303
|
-
:mtime => Time.now
|
301
|
+
:mtime => ENV["SOURCE_DATE_EPOCH"] ? Time.at(ENV["SOURCE_DATE_EPOCH"].to_i).utc : Time.now
|
304
302
|
|
305
303
|
@io.write header
|
306
304
|
|
@@ -311,12 +309,12 @@ class Gem::Package::TarWriter
|
|
311
309
|
# Splits +name+ into a name and prefix that can fit in the TarHeader
|
312
310
|
|
313
311
|
def split_name(name) # :nodoc:
|
314
|
-
if name.bytesize > 256
|
312
|
+
if name.bytesize > 256
|
315
313
|
raise Gem::Package::TooLongFileName.new("File \"#{name}\" has a too long path (should be 256 or less)")
|
316
314
|
end
|
317
315
|
|
318
316
|
prefix = ''
|
319
|
-
if name.bytesize > 100
|
317
|
+
if name.bytesize > 100
|
320
318
|
parts = name.split('/', -1) # parts are never empty here
|
321
319
|
name = parts.pop # initially empty for names with a trailing slash ("foo/.../bar/")
|
322
320
|
prefix = parts.join('/') # if empty, then it's impossible to split (parts is empty too)
|
@@ -325,11 +323,11 @@ class Gem::Package::TarWriter
|
|
325
323
|
prefix = parts.join('/')
|
326
324
|
end
|
327
325
|
|
328
|
-
if name.bytesize > 100 or prefix.empty?
|
326
|
+
if name.bytesize > 100 or prefix.empty?
|
329
327
|
raise Gem::Package::TooLongFileName.new("File \"#{prefix}/#{name}\" has a too long name (should be 100 or less)")
|
330
328
|
end
|
331
329
|
|
332
|
-
if prefix.bytesize > 155
|
330
|
+
if prefix.bytesize > 155
|
333
331
|
raise Gem::Package::TooLongFileName.new("File \"#{prefix}/#{name}\" has a too long base path (should be 155 or less)")
|
334
332
|
end
|
335
333
|
end
|
@@ -23,12 +23,14 @@ class Gem::PathSupport
|
|
23
23
|
# hashtable, or defaults to ENV, the system environment.
|
24
24
|
#
|
25
25
|
def initialize(env)
|
26
|
-
@home
|
26
|
+
@home = env["GEM_HOME"] || Gem.default_dir
|
27
27
|
|
28
|
-
if File::ALT_SEPARATOR
|
29
|
-
@home
|
28
|
+
if File::ALT_SEPARATOR
|
29
|
+
@home = @home.gsub(File::ALT_SEPARATOR, File::SEPARATOR)
|
30
30
|
end
|
31
31
|
|
32
|
+
@home = expand(@home)
|
33
|
+
|
32
34
|
@path = split_gem_path env["GEM_PATH"], @home
|
33
35
|
|
34
36
|
@spec_cache_dir = env["GEM_SPEC_CACHE"] || Gem.default_spec_cache_dir
|
@@ -41,7 +43,7 @@ class Gem::PathSupport
|
|
41
43
|
##
|
42
44
|
# Split the Gem search path (as reported by Gem.path).
|
43
45
|
|
44
|
-
def split_gem_path
|
46
|
+
def split_gem_path(gpaths, home)
|
45
47
|
# FIX: it should be [home, *path], not [*path, home]
|
46
48
|
|
47
49
|
gem_path = []
|
@@ -54,7 +56,7 @@ class Gem::PathSupport
|
|
54
56
|
gem_path += default_path
|
55
57
|
end
|
56
58
|
|
57
|
-
if File::ALT_SEPARATOR
|
59
|
+
if File::ALT_SEPARATOR
|
58
60
|
gem_path.map! do |this_path|
|
59
61
|
this_path.gsub File::ALT_SEPARATOR, File::SEPARATOR
|
60
62
|
end
|
@@ -65,7 +67,7 @@ class Gem::PathSupport
|
|
65
67
|
gem_path = default_path
|
66
68
|
end
|
67
69
|
|
68
|
-
gem_path.uniq
|
70
|
+
gem_path.map { |path| expand(path) }.uniq
|
69
71
|
end
|
70
72
|
|
71
73
|
# Return the default Gem path
|
@@ -77,4 +79,12 @@ class Gem::PathSupport
|
|
77
79
|
end
|
78
80
|
gem_path
|
79
81
|
end
|
82
|
+
|
83
|
+
def expand(path)
|
84
|
+
if File.directory?(path)
|
85
|
+
File.realpath(path)
|
86
|
+
else
|
87
|
+
path
|
88
|
+
end
|
89
|
+
end
|
80
90
|
end
|
data/lib/rubygems/platform.rb
CHANGED
@@ -56,7 +56,7 @@ class Gem::Platform
|
|
56
56
|
when String then
|
57
57
|
arch = arch.split '-'
|
58
58
|
|
59
|
-
if arch.length > 2 and arch.last !~ /\d/
|
59
|
+
if arch.length > 2 and arch.last !~ /\d/ # reassemble x86-linux-gnu
|
60
60
|
extra = arch.pop
|
61
61
|
arch.last << "-#{extra}"
|
62
62
|
end
|
@@ -68,7 +68,7 @@ class Gem::Platform
|
|
68
68
|
else cpu
|
69
69
|
end
|
70
70
|
|
71
|
-
if arch.length == 2 and arch.last =~ /^\d+(\.\d+)?$/
|
71
|
+
if arch.length == 2 and arch.last =~ /^\d+(\.\d+)?$/ # for command-line
|
72
72
|
@os, @version = arch
|
73
73
|
return
|
74
74
|
end
|
@@ -195,12 +195,11 @@ class Gem::Platform
|
|
195
195
|
# A pure-Ruby gem that may use Gem::Specification#extensions to build
|
196
196
|
# binary files.
|
197
197
|
|
198
|
-
RUBY = 'ruby'
|
198
|
+
RUBY = 'ruby'.freeze
|
199
199
|
|
200
200
|
##
|
201
201
|
# A platform-specific gem that is built for the packaging Ruby's platform.
|
202
202
|
# This will be replaced with Gem::Platform::local.
|
203
203
|
|
204
|
-
CURRENT = 'current'
|
204
|
+
CURRENT = 'current'.freeze
|
205
205
|
end
|
206
|
-
|