rubygems-update 2.7.11 → 3.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +67 -0
- data/.travis.yml +24 -18
- data/CODE_OF_CONDUCT.md +10 -8
- data/CONTRIBUTING.md +148 -0
- data/History.txt +458 -8
- data/MAINTAINERS.txt +1 -0
- data/Manifest.txt +16 -9
- data/POLICIES.md +92 -0
- data/README.md +53 -26
- data/Rakefile +77 -211
- 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 +65 -0
- data/bundler/bundler.gemspec +7 -1
- data/bundler/lib/bundler/build_metadata.rb +1 -1
- 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/cli.rb +63 -21
- 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/parallel_installer.rb +5 -0
- data/bundler/lib/bundler/installer.rb +29 -6
- data/bundler/lib/bundler/plugin/events.rb +61 -0
- data/bundler/lib/bundler/plugin.rb +10 -3
- data/bundler/lib/bundler/resolver.rb +2 -2
- data/bundler/lib/bundler/rubygems_gem_installer.rb +7 -0
- data/bundler/lib/bundler/runtime.rb +8 -2
- data/bundler/lib/bundler/settings/validator.rb +23 -0
- data/bundler/lib/bundler/settings.rb +24 -3
- data/bundler/lib/bundler/shared_helpers.rb +19 -3
- data/bundler/lib/bundler/source/metadata.rb +2 -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/lib/bundler.rb +26 -8
- 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/bundler/man/bundle.ronn +3 -0
- 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 +22 -5
- data/lib/rubygems/commands/build_command.rb +41 -7
- 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 +21 -7
- data/lib/rubygems/commands/pristine_command.rb +23 -16
- data/lib/rubygems/commands/push_command.rb +19 -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 +86 -48
- 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 +50 -18
- 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 +5 -8
- 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 -19
- data/lib/rubygems/dependency.rb +15 -15
- data/lib/rubygems/dependency_installer.rb +30 -33
- data/lib/rubygems/dependency_list.rb +9 -10
- 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 -8
- 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/ext.rb +0 -1
- data/lib/rubygems/gem_runner.rb +2 -2
- data/lib/rubygems/gemcutter_utilities.rb +46 -12
- 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 +3 -29
- data/lib/rubygems/installer.rb +97 -55
- data/lib/rubygems/installer_test_case.rb +2 -16
- 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/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 +13 -4
- data/lib/rubygems/package/tar_reader/entry.rb +20 -4
- data/lib/rubygems/package/tar_reader.rb +2 -4
- data/lib/rubygems/package/tar_test_case.rb +2 -8
- data/lib/rubygems/package/tar_writer.rb +13 -15
- data/lib/rubygems/package.rb +90 -63
- 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 +2 -313
- data/lib/rubygems/remote_fetcher.rb +29 -82
- 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.rb +17 -16
- data/lib/rubygems/request_set/gem_dependency_api.rb +46 -49
- data/lib/rubygems/request_set/lockfile/parser.rb +18 -29
- data/lib/rubygems/request_set/lockfile/tokenizer.rb +9 -9
- data/lib/rubygems/request_set/lockfile.rb +12 -12
- data/lib/rubygems/request_set.rb +52 -25
- data/lib/rubygems/requirement.rb +32 -21
- 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/resolver.rb +14 -16
- data/lib/rubygems/s3_uri_signer.rb +183 -0
- data/lib/rubygems/safe_yaml.rb +18 -10
- 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/security.rb +21 -22
- data/lib/rubygems/security_option.rb +0 -1
- data/lib/rubygems/server.rb +21 -21
- 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.rb +16 -25
- 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 +219 -558
- data/lib/rubygems/specification_policy.rb +407 -0
- data/lib/rubygems/stub_specification.rb +12 -17
- data/lib/rubygems/test_case.rb +161 -75
- data/lib/rubygems/test_utilities.rb +20 -35
- data/lib/rubygems/text.rb +6 -6
- data/lib/rubygems/uninstaller.rb +38 -27
- data/lib/rubygems/uri_formatter.rb +1 -2
- data/lib/rubygems/user_interaction.rb +37 -89
- data/lib/rubygems/util/licenses.rb +27 -1
- data/lib/rubygems/util/list.rb +1 -1
- data/lib/rubygems/util.rb +32 -14
- data/lib/rubygems/validator.rb +4 -5
- data/lib/rubygems/version.rb +15 -15
- data/lib/rubygems/version_option.rb +2 -3
- data/lib/rubygems.rb +71 -102
- data/rubygems-update.gemspec +43 -0
- data/setup.rb +2 -8
- data/test/rubygems/ca_cert.pem +74 -65
- data/test/rubygems/client.pem +103 -45
- data/test/rubygems/rubygems_plugin.rb +0 -1
- data/test/rubygems/simple_gem.rb +1 -1
- data/test/rubygems/ssl_cert.pem +78 -17
- data/test/rubygems/ssl_key.pem +25 -13
- data/test/rubygems/test_bundled_ca.rb +1 -1
- data/test/rubygems/test_config.rb +7 -2
- data/test/rubygems/test_gem.rb +205 -132
- data/test/rubygems/test_gem_bundler_version_finder.rb +4 -0
- data/test/rubygems/test_gem_command.rb +0 -1
- data/test/rubygems/test_gem_command_manager.rb +18 -3
- data/test/rubygems/test_gem_commands_build_command.rb +220 -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 +54 -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 +50 -15
- 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 +161 -8
- 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 +16 -10
- data/test/rubygems/test_gem_install_update_options.rb +1 -20
- data/test/rubygems/test_gem_installer.rb +154 -119
- 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 +77 -31
- data/test/rubygems/test_gem_package_old.rb +0 -1
- data/test/rubygems/test_gem_package_tar_header.rb +42 -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 +43 -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 -136
- data/test/rubygems/test_gem_remote_fetcher.rb +241 -141
- data/test/rubygems/test_gem_request.rb +9 -9
- 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 +82 -64
- 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 +24 -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 +5 -6
- 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 +366 -198
- data/test/rubygems/test_gem_stream_ui.rb +15 -32
- data/test/rubygems/test_gem_stub_specification.rb +0 -2
- data/test/rubygems/test_gem_text.rb +4 -0
- data/test/rubygems/test_gem_uninstaller.rb +42 -3
- 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 +31 -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 +20 -12
- data/util/cops/deprecations.rb +52 -0
- data/util/create_certs.rb +6 -7
- data/util/create_certs.sh +27 -0
- data/util/create_encrypted_key.rb +4 -5
- data/util/patch_with_prs.rb +1 -1
- data/util/rubocop +8 -0
- data/util/update_bundled_ca_certificates.rb +12 -13
- data/util/update_changelog.rb +1 -1
- metadata +61 -51
- 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/test/rubygems/fix_openssl_warnings.rb +0 -13
@@ -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.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,14 +276,14 @@ 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 << ")"
|
284
285
|
|
285
|
-
ua << " #{RUBY_ENGINE}" if
|
286
|
+
ua << " #{RUBY_ENGINE}" if RUBY_ENGINE != 'ruby'
|
286
287
|
|
287
288
|
ua
|
288
289
|
end
|
@@ -43,12 +43,13 @@ class Gem::RequestSet::GemDependencyAPI
|
|
43
43
|
:mri_20 => %w[ruby],
|
44
44
|
:mri_21 => %w[ruby],
|
45
45
|
:rbx => %w[rbx],
|
46
|
-
:
|
47
|
-
:
|
48
|
-
:
|
49
|
-
:
|
50
|
-
:
|
51
|
-
|
46
|
+
:truffleruby => %w[truffleruby],
|
47
|
+
:ruby => %w[ruby rbx maglev truffleruby],
|
48
|
+
:ruby_18 => %w[ruby rbx maglev truffleruby],
|
49
|
+
:ruby_19 => %w[ruby rbx maglev truffleruby],
|
50
|
+
:ruby_20 => %w[ruby rbx maglev truffleruby],
|
51
|
+
:ruby_21 => %w[ruby rbx maglev truffleruby],
|
52
|
+
}.freeze
|
52
53
|
|
53
54
|
mswin = Gem::Platform.new 'x86-mswin32'
|
54
55
|
mswin64 = Gem::Platform.new 'x64-mswin64'
|
@@ -85,10 +86,11 @@ class Gem::RequestSet::GemDependencyAPI
|
|
85
86
|
:ruby_19 => Gem::Platform::RUBY,
|
86
87
|
:ruby_20 => Gem::Platform::RUBY,
|
87
88
|
:ruby_21 => Gem::Platform::RUBY,
|
89
|
+
:truffleruby => Gem::Platform::RUBY,
|
88
90
|
:x64_mingw => x64_mingw,
|
89
91
|
:x64_mingw_20 => x64_mingw,
|
90
92
|
:x64_mingw_21 => x64_mingw
|
91
|
-
}
|
93
|
+
}.freeze
|
92
94
|
|
93
95
|
gt_eq_0 = Gem::Requirement.new '>= 0'
|
94
96
|
tilde_gt_1_8_0 = Gem::Requirement.new '~> 1.8.0'
|
@@ -126,10 +128,11 @@ class Gem::RequestSet::GemDependencyAPI
|
|
126
128
|
:ruby_19 => tilde_gt_1_9_0,
|
127
129
|
:ruby_20 => tilde_gt_2_0_0,
|
128
130
|
:ruby_21 => tilde_gt_2_1_0,
|
131
|
+
:truffleruby => gt_eq_0,
|
129
132
|
:x64_mingw => gt_eq_0,
|
130
133
|
:x64_mingw_20 => tilde_gt_2_0_0,
|
131
134
|
:x64_mingw_21 => tilde_gt_2_1_0,
|
132
|
-
}
|
135
|
+
}.freeze
|
133
136
|
|
134
137
|
WINDOWS = { # :nodoc:
|
135
138
|
:mingw => :only,
|
@@ -160,7 +163,7 @@ class Gem::RequestSet::GemDependencyAPI
|
|
160
163
|
:x64_mingw => :only,
|
161
164
|
:x64_mingw_20 => :only,
|
162
165
|
:x64_mingw_21 => :only,
|
163
|
-
}
|
166
|
+
}.freeze
|
164
167
|
|
165
168
|
##
|
166
169
|
# The gems required by #gem statements in the gem.deps.rb file
|
@@ -191,7 +194,7 @@ class Gem::RequestSet::GemDependencyAPI
|
|
191
194
|
# Creates a new GemDependencyAPI that will add dependencies to the
|
192
195
|
# Gem::RequestSet +set+ based on the dependency API description in +path+.
|
193
196
|
|
194
|
-
def initialize
|
197
|
+
def initialize(set, path)
|
195
198
|
@set = set
|
196
199
|
@path = path
|
197
200
|
|
@@ -228,7 +231,7 @@ class Gem::RequestSet::GemDependencyAPI
|
|
228
231
|
# Adds +dependencies+ to the request set if any of the +groups+ are allowed.
|
229
232
|
# This is used for gemspec dependencies.
|
230
233
|
|
231
|
-
def add_dependencies
|
234
|
+
def add_dependencies(groups, dependencies) # :nodoc:
|
232
235
|
return unless (groups & @without_groups).empty?
|
233
236
|
|
234
237
|
dependencies.each do |dep|
|
@@ -241,7 +244,7 @@ class Gem::RequestSet::GemDependencyAPI
|
|
241
244
|
##
|
242
245
|
# Finds a gemspec with the given +name+ that lives at +path+.
|
243
246
|
|
244
|
-
def find_gemspec
|
247
|
+
def find_gemspec(name, path) # :nodoc:
|
245
248
|
glob = File.join path, "#{name}.gemspec"
|
246
249
|
|
247
250
|
spec_files = Dir[glob]
|
@@ -269,7 +272,7 @@ class Gem::RequestSet::GemDependencyAPI
|
|
269
272
|
# In installing mode certain restrictions are ignored such as ruby version
|
270
273
|
# mismatch checks.
|
271
274
|
|
272
|
-
def installing=
|
275
|
+
def installing=(installing) # :nodoc:
|
273
276
|
@installing = installing
|
274
277
|
end
|
275
278
|
|
@@ -353,7 +356,7 @@ class Gem::RequestSet::GemDependencyAPI
|
|
353
356
|
# tag: ::
|
354
357
|
# Use the given tag for git:, gist: and github: dependencies.
|
355
358
|
|
356
|
-
def gem
|
359
|
+
def gem(name, *requirements)
|
357
360
|
options = requirements.pop if requirements.last.kind_of?(Hash)
|
358
361
|
options ||= {}
|
359
362
|
|
@@ -369,9 +372,9 @@ class Gem::RequestSet::GemDependencyAPI
|
|
369
372
|
duplicate = @dependencies.include? name
|
370
373
|
|
371
374
|
@dependencies[name] =
|
372
|
-
if requirements.empty? and not source_set
|
375
|
+
if requirements.empty? and not source_set
|
373
376
|
Gem::Requirement.default
|
374
|
-
elsif source_set
|
377
|
+
elsif source_set
|
375
378
|
Gem::Requirement.source_set
|
376
379
|
else
|
377
380
|
Gem::Requirement.create requirements
|
@@ -387,7 +390,7 @@ class Gem::RequestSet::GemDependencyAPI
|
|
387
390
|
|
388
391
|
gem_requires name, options
|
389
392
|
|
390
|
-
if duplicate
|
393
|
+
if duplicate
|
391
394
|
warn <<-WARNING
|
392
395
|
Gem dependencies file #{@path} requires #{name} more than once.
|
393
396
|
WARNING
|
@@ -401,8 +404,8 @@ Gem dependencies file #{@path} requires #{name} more than once.
|
|
401
404
|
#
|
402
405
|
# Returns +true+ if the gist or git option was handled.
|
403
406
|
|
404
|
-
def gem_git
|
405
|
-
if gist = options.delete(:gist)
|
407
|
+
def gem_git(name, options) # :nodoc:
|
408
|
+
if gist = options.delete(:gist)
|
406
409
|
options[:git] = "https://gist.github.com/#{gist}.git"
|
407
410
|
end
|
408
411
|
|
@@ -424,7 +427,7 @@ Gem dependencies file #{@path} requires #{name} more than once.
|
|
424
427
|
#
|
425
428
|
# Returns reference for the git gem.
|
426
429
|
|
427
|
-
def gem_git_reference
|
430
|
+
def gem_git_reference(options) # :nodoc:
|
428
431
|
ref = options.delete :ref
|
429
432
|
branch = options.delete :branch
|
430
433
|
tag = options.delete :tag
|
@@ -457,7 +460,7 @@ Gem dependencies file #{@path} includes git reference for both ref/branch and ta
|
|
457
460
|
#
|
458
461
|
# Returns +true+ if the custom source option was handled.
|
459
462
|
|
460
|
-
def gem_git_source
|
463
|
+
def gem_git_source(name, options) # :nodoc:
|
461
464
|
return unless git_source = (@git_sources.keys & options.keys).last
|
462
465
|
|
463
466
|
source_callback = @git_sources[git_source]
|
@@ -478,7 +481,7 @@ Gem dependencies file #{@path} includes git reference for both ref/branch and ta
|
|
478
481
|
# Handles the :group and :groups +options+ for the gem with the given
|
479
482
|
# +name+.
|
480
483
|
|
481
|
-
def gem_group
|
484
|
+
def gem_group(name, options) # :nodoc:
|
482
485
|
g = options.delete :group
|
483
486
|
all_groups = g ? Array(g) : []
|
484
487
|
|
@@ -497,7 +500,7 @@ Gem dependencies file #{@path} includes git reference for both ref/branch and ta
|
|
497
500
|
#
|
498
501
|
# Returns +true+ if the path option was handled.
|
499
502
|
|
500
|
-
def gem_path
|
503
|
+
def gem_path(name, options) # :nodoc:
|
501
504
|
return unless directory = options.delete(:path)
|
502
505
|
|
503
506
|
pin_gem_source name, :path, directory
|
@@ -514,7 +517,7 @@ Gem dependencies file #{@path} includes git reference for both ref/branch and ta
|
|
514
517
|
#
|
515
518
|
# Returns +true+ if the source option was handled.
|
516
519
|
|
517
|
-
def gem_source
|
520
|
+
def gem_source(name, options) # :nodoc:
|
518
521
|
return unless source = options.delete(:source)
|
519
522
|
|
520
523
|
pin_gem_source name, :source, source
|
@@ -530,7 +533,7 @@ Gem dependencies file #{@path} includes git reference for both ref/branch and ta
|
|
530
533
|
# Handles the platforms: option from +options+. Returns true if the
|
531
534
|
# platform matches the current platform.
|
532
535
|
|
533
|
-
def gem_platforms
|
536
|
+
def gem_platforms(options) # :nodoc:
|
534
537
|
platform_names = Array(options.delete :platform)
|
535
538
|
platform_names.concat Array(options.delete :platforms)
|
536
539
|
platform_names.concat @current_platforms if @current_platforms
|
@@ -543,7 +546,7 @@ Gem dependencies file #{@path} includes git reference for both ref/branch and ta
|
|
543
546
|
|
544
547
|
next false unless Gem::Platform.match platform
|
545
548
|
|
546
|
-
if engines = ENGINE_MAP[platform_name]
|
549
|
+
if engines = ENGINE_MAP[platform_name]
|
547
550
|
next false unless engines.include? Gem.ruby_engine
|
548
551
|
end
|
549
552
|
|
@@ -564,9 +567,9 @@ Gem dependencies file #{@path} includes git reference for both ref/branch and ta
|
|
564
567
|
# Records the require: option from +options+ and adds those files, or the
|
565
568
|
# default file to the require list for +name+.
|
566
569
|
|
567
|
-
def gem_requires
|
568
|
-
if options.include? :require
|
569
|
-
if requires = options.delete(:require)
|
570
|
+
def gem_requires(name, options) # :nodoc:
|
571
|
+
if options.include? :require
|
572
|
+
if requires = options.delete(:require)
|
570
573
|
@requires[name].concat Array requires
|
571
574
|
end
|
572
575
|
else
|
@@ -587,7 +590,7 @@ Gem dependencies file #{@path} includes git reference for both ref/branch and ta
|
|
587
590
|
# gem 'activerecord'
|
588
591
|
# end
|
589
592
|
|
590
|
-
def git
|
593
|
+
def git(repository)
|
591
594
|
@current_repository = repository
|
592
595
|
|
593
596
|
yield
|
@@ -601,7 +604,7 @@ Gem dependencies file #{@path} includes git reference for both ref/branch and ta
|
|
601
604
|
# for use in gems built from git repositories. You must provide a block
|
602
605
|
# that accepts a git repository name for expansion.
|
603
606
|
|
604
|
-
def git_source
|
607
|
+
def git_source(name, &callback)
|
605
608
|
@git_sources[name] = callback
|
606
609
|
end
|
607
610
|
|
@@ -634,7 +637,7 @@ Gem dependencies file #{@path} includes git reference for both ref/branch and ta
|
|
634
637
|
# The group to add development dependencies to. By default this is
|
635
638
|
# :development. Only one group may be specified.
|
636
639
|
|
637
|
-
def gemspec
|
640
|
+
def gemspec(options = {})
|
638
641
|
name = options.delete(:name) || '{,*}'
|
639
642
|
path = options.delete(:path) || '.'
|
640
643
|
development_group = options.delete(:development_group) || :development
|
@@ -679,7 +682,7 @@ Gem dependencies file #{@path} includes git reference for both ref/branch and ta
|
|
679
682
|
# development`. See `gem help install` and `gem help gem_dependencies` for
|
680
683
|
# further details.
|
681
684
|
|
682
|
-
def group
|
685
|
+
def group(*groups)
|
683
686
|
@current_groups = groups
|
684
687
|
|
685
688
|
yield
|
@@ -692,7 +695,7 @@ Gem dependencies file #{@path} includes git reference for both ref/branch and ta
|
|
692
695
|
# Pins the gem +name+ to the given +source+. Adding a gem with the same
|
693
696
|
# name from a different +source+ will raise an exception.
|
694
697
|
|
695
|
-
def pin_gem_source
|
698
|
+
def pin_gem_source(name, type = :default, source = nil)
|
696
699
|
source_description =
|
697
700
|
case type
|
698
701
|
when :default then '(default)'
|
@@ -754,7 +757,7 @@ Gem dependencies file #{@path} includes git reference for both ref/branch and ta
|
|
754
757
|
# NOTE: There is inconsistency in what environment a platform matches. You
|
755
758
|
# may need to read the source to know the exact details.
|
756
759
|
|
757
|
-
def platform
|
760
|
+
def platform(*platforms)
|
758
761
|
@current_platforms = platforms
|
759
762
|
|
760
763
|
yield
|
@@ -779,9 +782,9 @@ Gem dependencies file #{@path} includes git reference for both ref/branch and ta
|
|
779
782
|
# You may also provide +engine:+ and +engine_version:+ options to restrict
|
780
783
|
# this gem dependencies file to a particular ruby engine and its engine
|
781
784
|
# version. This matching is performed by using the RUBY_ENGINE and
|
782
|
-
#
|
785
|
+
# RUBY_ENGINE_VERSION constants.
|
783
786
|
|
784
|
-
def ruby
|
787
|
+
def ruby(version, options = {})
|
785
788
|
engine = options[:engine]
|
786
789
|
engine_version = options[:engine_version]
|
787
790
|
|
@@ -791,26 +794,24 @@ Gem dependencies file #{@path} includes git reference for both ref/branch and ta
|
|
791
794
|
|
792
795
|
return true if @installing
|
793
796
|
|
794
|
-
unless RUBY_VERSION == version
|
797
|
+
unless RUBY_VERSION == version
|
795
798
|
message = "Your Ruby version is #{RUBY_VERSION}, " +
|
796
799
|
"but your #{gem_deps_file} requires #{version}"
|
797
800
|
|
798
801
|
raise Gem::RubyVersionMismatch, message
|
799
802
|
end
|
800
803
|
|
801
|
-
if engine and engine != Gem.ruby_engine
|
804
|
+
if engine and engine != Gem.ruby_engine
|
802
805
|
message = "Your Ruby engine is #{Gem.ruby_engine}, " +
|
803
806
|
"but your #{gem_deps_file} requires #{engine}"
|
804
807
|
|
805
808
|
raise Gem::RubyVersionMismatch, message
|
806
809
|
end
|
807
810
|
|
808
|
-
if engine_version
|
809
|
-
|
810
|
-
|
811
|
-
if engine_version != my_engine_version then
|
811
|
+
if engine_version
|
812
|
+
if engine_version != RUBY_ENGINE_VERSION
|
812
813
|
message =
|
813
|
-
"Your Ruby engine version is #{Gem.ruby_engine} #{
|
814
|
+
"Your Ruby engine version is #{Gem.ruby_engine} #{RUBY_ENGINE_VERSION}, " +
|
814
815
|
"but your #{gem_deps_file} requires #{engine} #{engine_version}"
|
815
816
|
|
816
817
|
raise Gem::RubyVersionMismatch, message
|
@@ -834,7 +835,7 @@ Gem dependencies file #{@path} includes git reference for both ref/branch and ta
|
|
834
835
|
# * The +prepend:+ option is not supported. If you wish to order sources
|
835
836
|
# then list them in your preferred order.
|
836
837
|
|
837
|
-
def source
|
838
|
+
def source(url)
|
838
839
|
Gem.sources.clear if @default_sources
|
839
840
|
|
840
841
|
@default_sources = false
|
@@ -842,8 +843,4 @@ Gem dependencies file #{@path} includes git reference for both ref/branch and ta
|
|
842
843
|
Gem.sources << url
|
843
844
|
end
|
844
845
|
|
845
|
-
# TODO: remove this typo name at RubyGems 3.0
|
846
|
-
|
847
|
-
Gem::RequestSet::GemDepedencyAPI = self # :nodoc:
|
848
|
-
|
849
846
|
end
|