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
data/lib/rubygems/request.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
require 'net/http'
|
3
|
-
require 'thread'
|
4
3
|
require 'time'
|
5
4
|
require 'rubygems/user_interaction'
|
6
5
|
|
@@ -11,7 +10,7 @@ class Gem::Request
|
|
11
10
|
|
12
11
|
###
|
13
12
|
# Legacy. This is used in tests.
|
14
|
-
def self.create_with_proxy
|
13
|
+
def self.create_with_proxy(uri, request_class, last_modified, proxy) # :nodoc:
|
15
14
|
cert_files = get_cert_files
|
16
15
|
proxy ||= get_proxy_from_env(uri.scheme)
|
17
16
|
pool = ConnectionPools.new proxy_uri(proxy), cert_files
|
@@ -19,7 +18,7 @@ class Gem::Request
|
|
19
18
|
new(uri, request_class, last_modified, pool.pool_for(uri))
|
20
19
|
end
|
21
20
|
|
22
|
-
def self.proxy_uri
|
21
|
+
def self.proxy_uri(proxy) # :nodoc:
|
23
22
|
case proxy
|
24
23
|
when :no_proxy then nil
|
25
24
|
when URI::HTTP then proxy
|
@@ -52,7 +51,7 @@ class Gem::Request
|
|
52
51
|
Gem.configuration.ssl_verify_mode || OpenSSL::SSL::VERIFY_PEER
|
53
52
|
store = OpenSSL::X509::Store.new
|
54
53
|
|
55
|
-
if Gem.configuration.ssl_client_cert
|
54
|
+
if Gem.configuration.ssl_client_cert
|
56
55
|
pem = File.read Gem.configuration.ssl_client_cert
|
57
56
|
connection.cert = OpenSSL::X509::Certificate.new pem
|
58
57
|
connection.key = OpenSSL::PKey::RSA.new pem
|
@@ -86,7 +85,7 @@ class Gem::Request
|
|
86
85
|
'Unable to require openssl, install OpenSSL and rebuild Ruby (preferred) or use non-HTTPS sources')
|
87
86
|
end
|
88
87
|
|
89
|
-
def self.verify_certificate
|
88
|
+
def self.verify_certificate(store_context)
|
90
89
|
depth = store_context.error_depth
|
91
90
|
error = store_context.error_string
|
92
91
|
number = store_context.error
|
@@ -99,7 +98,7 @@ class Gem::Request
|
|
99
98
|
ui.alert_error extra_message if extra_message
|
100
99
|
end
|
101
100
|
|
102
|
-
def self.verify_certificate_message
|
101
|
+
def self.verify_certificate_message(error_number, cert)
|
103
102
|
return unless cert
|
104
103
|
case error_number
|
105
104
|
when OpenSSL::X509::V_ERR_CERT_HAS_EXPIRED then
|
@@ -118,9 +117,11 @@ class Gem::Request
|
|
118
117
|
"Certificate #{cert.subject} has an invalid purpose"
|
119
118
|
when OpenSSL::X509::V_ERR_SELF_SIGNED_CERT_IN_CHAIN then
|
120
119
|
"Root certificate is not trusted (#{cert.subject})"
|
121
|
-
when OpenSSL::X509::V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY
|
122
|
-
OpenSSL::X509::V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE then
|
120
|
+
when OpenSSL::X509::V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY then
|
123
121
|
"You must add #{cert.issuer} to your local trusted store"
|
122
|
+
when
|
123
|
+
OpenSSL::X509::V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE then
|
124
|
+
"Cannot verify certificate issued by #{cert.issuer}"
|
124
125
|
end
|
125
126
|
end
|
126
127
|
|
@@ -138,7 +139,7 @@ class Gem::Request
|
|
138
139
|
def fetch
|
139
140
|
request = @request_class.new @uri.request_uri
|
140
141
|
|
141
|
-
unless @uri.nil? || @uri.user.nil? || @uri.user.empty?
|
142
|
+
unless @uri.nil? || @uri.user.nil? || @uri.user.empty?
|
142
143
|
request.basic_auth Gem::UriFormatter.new(@uri.user).unescape,
|
143
144
|
Gem::UriFormatter.new(@uri.password).unescape
|
144
145
|
end
|
@@ -147,7 +148,7 @@ class Gem::Request
|
|
147
148
|
request.add_field 'Connection', 'keep-alive'
|
148
149
|
request.add_field 'Keep-Alive', '30'
|
149
150
|
|
150
|
-
if @last_modified
|
151
|
+
if @last_modified
|
151
152
|
request.add_field 'If-Modified-Since', @last_modified.httpdate
|
152
153
|
end
|
153
154
|
|
@@ -160,7 +161,7 @@ class Gem::Request
|
|
160
161
|
# Returns a proxy URI for the given +scheme+ if one is set in the
|
161
162
|
# environment variables.
|
162
163
|
|
163
|
-
def self.get_proxy_from_env
|
164
|
+
def self.get_proxy_from_env(scheme = 'http')
|
164
165
|
_scheme = scheme.downcase
|
165
166
|
_SCHEME = scheme.upcase
|
166
167
|
env_proxy = ENV["#{_scheme}_proxy"] || ENV["#{_SCHEME}_PROXY"]
|
@@ -172,7 +173,7 @@ class Gem::Request
|
|
172
173
|
|
173
174
|
uri = URI(Gem::UriFormatter.new(env_proxy).normalize)
|
174
175
|
|
175
|
-
if uri and uri.user.nil? and uri.password.nil?
|
176
|
+
if uri and uri.user.nil? and uri.password.nil?
|
176
177
|
user = ENV["#{_scheme}_proxy_user"] || ENV["#{_SCHEME}_PROXY_USER"]
|
177
178
|
password = ENV["#{_scheme}_proxy_pass"] || ENV["#{_SCHEME}_PROXY_PASS"]
|
178
179
|
|
@@ -183,7 +184,7 @@ class Gem::Request
|
|
183
184
|
uri
|
184
185
|
end
|
185
186
|
|
186
|
-
def perform_request
|
187
|
+
def perform_request(request) # :nodoc:
|
187
188
|
connection = connection_for @uri
|
188
189
|
|
189
190
|
retried = false
|
@@ -275,9 +276,9 @@ class Gem::Request
|
|
275
276
|
ruby_version += 'dev' if RUBY_PATCHLEVEL == -1
|
276
277
|
|
277
278
|
ua << " Ruby/#{ruby_version} (#{RUBY_RELEASE_DATE}"
|
278
|
-
if RUBY_PATCHLEVEL >= 0
|
279
|
+
if RUBY_PATCHLEVEL >= 0
|
279
280
|
ua << " patchlevel #{RUBY_PATCHLEVEL}"
|
280
|
-
elsif defined?(RUBY_REVISION)
|
281
|
+
elsif defined?(RUBY_REVISION)
|
281
282
|
ua << " revision #{RUBY_REVISION}"
|
282
283
|
end
|
283
284
|
ua << ")"
|
@@ -1,5 +1,4 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
require 'thread'
|
3
2
|
|
4
3
|
class Gem::Request::ConnectionPools # :nodoc:
|
5
4
|
|
@@ -9,19 +8,19 @@ class Gem::Request::ConnectionPools # :nodoc:
|
|
9
8
|
attr_accessor :client
|
10
9
|
end
|
11
10
|
|
12
|
-
def initialize
|
11
|
+
def initialize(proxy_uri, cert_files)
|
13
12
|
@proxy_uri = proxy_uri
|
14
13
|
@cert_files = cert_files
|
15
14
|
@pools = {}
|
16
15
|
@pool_mutex = Mutex.new
|
17
16
|
end
|
18
17
|
|
19
|
-
def pool_for
|
18
|
+
def pool_for(uri)
|
20
19
|
http_args = net_http_args(uri, @proxy_uri)
|
21
20
|
key = http_args + [https?(uri)]
|
22
21
|
@pool_mutex.synchronize do
|
23
22
|
@pools[key] ||=
|
24
|
-
if https? uri
|
23
|
+
if https? uri
|
25
24
|
Gem::Request::HTTPSPool.new(http_args, @cert_files, @proxy_uri)
|
26
25
|
else
|
27
26
|
Gem::Request::HTTPPool.new(http_args, @cert_files, @proxy_uri)
|
@@ -46,22 +45,35 @@ class Gem::Request::ConnectionPools # :nodoc:
|
|
46
45
|
env_no_proxy.split(/\s*,\s*/)
|
47
46
|
end
|
48
47
|
|
49
|
-
def https?
|
48
|
+
def https?(uri)
|
50
49
|
uri.scheme.downcase == 'https'
|
51
50
|
end
|
52
51
|
|
53
|
-
def no_proxy?
|
52
|
+
def no_proxy?(host, env_no_proxy)
|
54
53
|
host = host.downcase
|
55
54
|
|
56
55
|
env_no_proxy.any? do |pattern|
|
57
|
-
|
56
|
+
env_no_proxy_pattern = pattern.downcase.dup
|
58
57
|
|
59
|
-
|
60
|
-
|
58
|
+
# Remove dot in front of pattern for wildcard matching
|
59
|
+
env_no_proxy_pattern[0] = "" if env_no_proxy_pattern[0] == "."
|
60
|
+
|
61
|
+
host_tokens = host.split(".")
|
62
|
+
pattern_tokens = env_no_proxy_pattern.split(".")
|
63
|
+
|
64
|
+
intersection = (host_tokens - pattern_tokens) | (pattern_tokens - host_tokens)
|
65
|
+
|
66
|
+
# When we do the split into tokens we miss a dot character, so add it back if we need it
|
67
|
+
missing_dot = intersection.length > 0 ? 1 : 0
|
68
|
+
start = intersection.join(".").size + missing_dot
|
69
|
+
|
70
|
+
no_proxy_host = host[start..-1]
|
71
|
+
|
72
|
+
env_no_proxy_pattern == no_proxy_host
|
61
73
|
end
|
62
74
|
end
|
63
75
|
|
64
|
-
def net_http_args
|
76
|
+
def net_http_args(uri, proxy_uri)
|
65
77
|
# URI::Generic#hostname was added in ruby 1.9.3, use it if exists, otherwise
|
66
78
|
# don't support IPv6 literals and use host.
|
67
79
|
hostname = uri.respond_to?(:hostname) ? uri.hostname : uri.host
|
@@ -69,7 +81,7 @@ class Gem::Request::ConnectionPools # :nodoc:
|
|
69
81
|
|
70
82
|
no_proxy = get_no_proxy_from_env
|
71
83
|
|
72
|
-
if proxy_uri and not no_proxy?(hostname, no_proxy)
|
84
|
+
if proxy_uri and not no_proxy?(hostname, no_proxy)
|
73
85
|
proxy_hostname = proxy_uri.respond_to?(:hostname) ? proxy_uri.hostname : proxy_uri.host
|
74
86
|
net_http_args + [
|
75
87
|
proxy_hostname,
|
@@ -77,7 +89,7 @@ class Gem::Request::ConnectionPools # :nodoc:
|
|
77
89
|
Gem::UriFormatter.new(proxy_uri.user).unescape,
|
78
90
|
Gem::UriFormatter.new(proxy_uri.password).unescape,
|
79
91
|
]
|
80
|
-
elsif no_proxy? hostname, no_proxy
|
92
|
+
elsif no_proxy? hostname, no_proxy
|
81
93
|
net_http_args + [nil, nil]
|
82
94
|
else
|
83
95
|
net_http_args
|
@@ -85,4 +97,3 @@ class Gem::Request::ConnectionPools # :nodoc:
|
|
85
97
|
end
|
86
98
|
|
87
99
|
end
|
88
|
-
|
@@ -8,7 +8,7 @@
|
|
8
8
|
class Gem::Request::HTTPPool # :nodoc:
|
9
9
|
attr_reader :cert_files, :proxy_uri
|
10
10
|
|
11
|
-
def initialize
|
11
|
+
def initialize(http_args, cert_files, proxy_uri)
|
12
12
|
@http_args = http_args
|
13
13
|
@cert_files = cert_files
|
14
14
|
@proxy_uri = proxy_uri
|
@@ -20,7 +20,7 @@ class Gem::Request::HTTPPool # :nodoc:
|
|
20
20
|
@queue.pop || make_connection
|
21
21
|
end
|
22
22
|
|
23
|
-
def checkin
|
23
|
+
def checkin(connection)
|
24
24
|
@queue.push connection
|
25
25
|
end
|
26
26
|
|
@@ -39,10 +39,9 @@ class Gem::Request::HTTPPool # :nodoc:
|
|
39
39
|
setup_connection Gem::Request::ConnectionPools.client.new(*@http_args)
|
40
40
|
end
|
41
41
|
|
42
|
-
def setup_connection
|
42
|
+
def setup_connection(connection)
|
43
43
|
connection.start
|
44
44
|
connection
|
45
45
|
end
|
46
46
|
|
47
47
|
end
|
48
|
-
|
data/lib/rubygems/request_set.rb
CHANGED
@@ -91,7 +91,7 @@ class Gem::RequestSet
|
|
91
91
|
#
|
92
92
|
# set = Gem::RequestSet.new nokogiri, pg
|
93
93
|
|
94
|
-
def initialize
|
94
|
+
def initialize(*deps)
|
95
95
|
@dependencies = deps
|
96
96
|
|
97
97
|
@always_install = []
|
@@ -119,8 +119,8 @@ class Gem::RequestSet
|
|
119
119
|
##
|
120
120
|
# Declare that a gem of name +name+ with +reqs+ requirements is needed.
|
121
121
|
|
122
|
-
def gem
|
123
|
-
if dep = @dependency_names[name]
|
122
|
+
def gem(name, *reqs)
|
123
|
+
if dep = @dependency_names[name]
|
124
124
|
dep.requirement.concat reqs
|
125
125
|
else
|
126
126
|
dep = Gem::Dependency.new name, *reqs
|
@@ -132,7 +132,7 @@ class Gem::RequestSet
|
|
132
132
|
##
|
133
133
|
# Add +deps+ Gem::Dependency objects to the set.
|
134
134
|
|
135
|
-
def import
|
135
|
+
def import(deps)
|
136
136
|
@dependencies.concat deps
|
137
137
|
end
|
138
138
|
|
@@ -143,7 +143,7 @@ class Gem::RequestSet
|
|
143
143
|
# The +installer+ will be +nil+ if a gem matching the request was already
|
144
144
|
# installed.
|
145
145
|
|
146
|
-
def install
|
146
|
+
def install(options, &block) # :yields: request, installer
|
147
147
|
if dir = options[:install_dir]
|
148
148
|
requests = install_into dir, false, options, &block
|
149
149
|
return requests
|
@@ -152,12 +152,39 @@ class Gem::RequestSet
|
|
152
152
|
@prerelease = options[:prerelease]
|
153
153
|
|
154
154
|
requests = []
|
155
|
+
download_queue = Queue.new
|
155
156
|
|
157
|
+
# Create a thread-safe list of gems to download
|
156
158
|
sorted_requests.each do |req|
|
157
|
-
|
159
|
+
download_queue << req
|
160
|
+
end
|
161
|
+
|
162
|
+
# Create N threads in a pool, have them download all the gems
|
163
|
+
threads = Gem.configuration.concurrent_downloads.times.map do
|
164
|
+
# When a thread pops this item, it knows to stop running. The symbol
|
165
|
+
# is queued here so that there will be one symbol per thread.
|
166
|
+
download_queue << :stop
|
167
|
+
|
168
|
+
Thread.new do
|
169
|
+
# The pop method will block waiting for items, so the only way
|
170
|
+
# to stop a thread from running is to provide a final item that
|
171
|
+
# means the thread should stop.
|
172
|
+
while req = download_queue.pop
|
173
|
+
break if req == :stop
|
174
|
+
req.spec.download options unless req.installed?
|
175
|
+
end
|
176
|
+
end
|
177
|
+
end
|
178
|
+
|
179
|
+
# Wait for all the downloads to finish before continuing
|
180
|
+
threads.each(&:value)
|
181
|
+
|
182
|
+
# Install requested gems after they have been downloaded
|
183
|
+
sorted_requests.each do |req|
|
184
|
+
if req.installed?
|
158
185
|
req.spec.spec.build_extensions
|
159
186
|
|
160
|
-
if @always_install.none? { |spec| spec == req.spec.spec }
|
187
|
+
if @always_install.none? { |spec| spec == req.spec.spec }
|
161
188
|
yield req, nil if block_given?
|
162
189
|
next
|
163
190
|
end
|
@@ -203,7 +230,7 @@ class Gem::RequestSet
|
|
203
230
|
# If +:without_groups+ is given in the +options+, those groups in the gem
|
204
231
|
# dependencies file are not used. See Gem::Installer for other +options+.
|
205
232
|
|
206
|
-
def install_from_gemdeps
|
233
|
+
def install_from_gemdeps(options, &block)
|
207
234
|
gemdeps = options[:gemdeps]
|
208
235
|
|
209
236
|
@install_dir = options[:install_dir] || Gem.dir
|
@@ -228,7 +255,7 @@ class Gem::RequestSet
|
|
228
255
|
else
|
229
256
|
installed = install options, &block
|
230
257
|
|
231
|
-
if options.fetch :lock, true
|
258
|
+
if options.fetch :lock, true
|
232
259
|
lockfile =
|
233
260
|
Gem::RequestSet::Lockfile.build self, gemdeps, gem_deps_api.dependencies
|
234
261
|
lockfile.write
|
@@ -238,7 +265,7 @@ class Gem::RequestSet
|
|
238
265
|
end
|
239
266
|
end
|
240
267
|
|
241
|
-
def install_into
|
268
|
+
def install_into(dir, force = true, options = {})
|
242
269
|
gem_home, ENV['GEM_HOME'] = ENV['GEM_HOME'], dir
|
243
270
|
|
244
271
|
existing = force ? [] : specs_in(dir)
|
@@ -256,7 +283,7 @@ class Gem::RequestSet
|
|
256
283
|
sorted_requests.each do |request|
|
257
284
|
spec = request.spec
|
258
285
|
|
259
|
-
if existing.find { |s| s.full_name == spec.full_name }
|
286
|
+
if existing.find { |s| s.full_name == spec.full_name }
|
260
287
|
yield request, nil if block_given?
|
261
288
|
next
|
262
289
|
end
|
@@ -278,7 +305,7 @@ class Gem::RequestSet
|
|
278
305
|
##
|
279
306
|
# Call hooks on installed gems
|
280
307
|
|
281
|
-
def install_hooks
|
308
|
+
def install_hooks(requests, options)
|
282
309
|
specs = requests.map do |request|
|
283
310
|
case request
|
284
311
|
when Gem::Resolver::ActivationRequest then
|
@@ -300,7 +327,7 @@ class Gem::RequestSet
|
|
300
327
|
##
|
301
328
|
# Load a dependency management file.
|
302
329
|
|
303
|
-
def load_gemdeps
|
330
|
+
def load_gemdeps(path, without_groups = [], installing = false)
|
304
331
|
@git_set = Gem::Resolver::GitSet.new
|
305
332
|
@vendor_set = Gem::Resolver::VendorSet.new
|
306
333
|
@source_set = Gem::Resolver::SourceSet.new
|
@@ -321,29 +348,29 @@ class Gem::RequestSet
|
|
321
348
|
gf.load
|
322
349
|
end
|
323
350
|
|
324
|
-
def pretty_print
|
351
|
+
def pretty_print(q) # :nodoc:
|
325
352
|
q.group 2, '[RequestSet:', ']' do
|
326
353
|
q.breakable
|
327
354
|
|
328
|
-
if @remote
|
355
|
+
if @remote
|
329
356
|
q.text 'remote'
|
330
357
|
q.breakable
|
331
358
|
end
|
332
359
|
|
333
|
-
if @prerelease
|
360
|
+
if @prerelease
|
334
361
|
q.text 'prerelease'
|
335
362
|
q.breakable
|
336
363
|
end
|
337
364
|
|
338
|
-
if @development_shallow
|
365
|
+
if @development_shallow
|
339
366
|
q.text 'shallow development'
|
340
367
|
q.breakable
|
341
|
-
elsif @development
|
368
|
+
elsif @development
|
342
369
|
q.text 'development'
|
343
370
|
q.breakable
|
344
371
|
end
|
345
372
|
|
346
|
-
if @soft_missing
|
373
|
+
if @soft_missing
|
347
374
|
q.text 'soft missing'
|
348
375
|
end
|
349
376
|
|
@@ -367,7 +394,7 @@ class Gem::RequestSet
|
|
367
394
|
# Resolve the requested dependencies and return an Array of Specification
|
368
395
|
# objects to be activated.
|
369
396
|
|
370
|
-
def resolve
|
397
|
+
def resolve(set = Gem::Resolver::BestSet.new)
|
371
398
|
@sets << set
|
372
399
|
@sets << @git_set
|
373
400
|
@sets << @vendor_set
|
@@ -416,17 +443,17 @@ class Gem::RequestSet
|
|
416
443
|
@specs ||= @requests.map { |r| r.full_spec }
|
417
444
|
end
|
418
445
|
|
419
|
-
def specs_in
|
420
|
-
|
446
|
+
def specs_in(dir)
|
447
|
+
Gem::Util.glob_files_in_dir("*.gemspec", File.join(dir, "specifications")).map do |g|
|
421
448
|
Gem::Specification.load g
|
422
449
|
end
|
423
450
|
end
|
424
451
|
|
425
|
-
def tsort_each_node
|
452
|
+
def tsort_each_node(&block) # :nodoc:
|
426
453
|
@requests.each(&block)
|
427
454
|
end
|
428
455
|
|
429
|
-
def tsort_each_child
|
456
|
+
def tsort_each_child(node) # :nodoc:
|
430
457
|
node.spec.dependencies.each do |dep|
|
431
458
|
next if dep.type == :development and not @development
|
432
459
|
|
@@ -434,7 +461,7 @@ class Gem::RequestSet
|
|
434
461
|
dep.match? r.spec.name, r.spec.version, @prerelease
|
435
462
|
}
|
436
463
|
|
437
|
-
unless match
|
464
|
+
unless match
|
438
465
|
next if dep.type == :development and @development_shallow
|
439
466
|
next if @soft_missing
|
440
467
|
raise Gem::DependencyError,
|