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/installer.rb
CHANGED
@@ -34,7 +34,7 @@ class Gem::Installer
|
|
34
34
|
# Paths where env(1) might live. Some systems are broken and have it in
|
35
35
|
# /bin
|
36
36
|
|
37
|
-
ENV_PATHS = %w[/usr/bin/env /bin/env]
|
37
|
+
ENV_PATHS = %w[/usr/bin/env /bin/env].freeze
|
38
38
|
|
39
39
|
##
|
40
40
|
# Deprecated in favor of Gem::Ext::BuildError
|
@@ -101,7 +101,7 @@ class Gem::Installer
|
|
101
101
|
##
|
102
102
|
# Construct an installer object for the gem file located at +path+
|
103
103
|
|
104
|
-
def self.at
|
104
|
+
def self.at(path, options = {})
|
105
105
|
security_policy = options[:security_policy]
|
106
106
|
package = Gem::Package.new path, security_policy
|
107
107
|
new package, options
|
@@ -110,11 +110,15 @@ class Gem::Installer
|
|
110
110
|
class FakePackage
|
111
111
|
attr_accessor :spec
|
112
112
|
|
113
|
+
attr_accessor :dir_mode
|
114
|
+
attr_accessor :prog_mode
|
115
|
+
attr_accessor :data_mode
|
116
|
+
|
113
117
|
def initialize(spec)
|
114
118
|
@spec = spec
|
115
119
|
end
|
116
120
|
|
117
|
-
def extract_files
|
121
|
+
def extract_files(destination_dir, pattern = '*')
|
118
122
|
FileUtils.mkdir_p destination_dir
|
119
123
|
|
120
124
|
spec.files.each do |file|
|
@@ -125,7 +129,7 @@ class Gem::Installer
|
|
125
129
|
end
|
126
130
|
end
|
127
131
|
|
128
|
-
def copy_to
|
132
|
+
def copy_to(path)
|
129
133
|
end
|
130
134
|
end
|
131
135
|
|
@@ -133,7 +137,7 @@ class Gem::Installer
|
|
133
137
|
# Construct an installer object for an ephemeral gem (one where we don't
|
134
138
|
# actually have a .gem file, just a spec)
|
135
139
|
|
136
|
-
def self.for_spec
|
140
|
+
def self.for_spec(spec, options = {})
|
137
141
|
# FIXME: we should have a real Package class for this
|
138
142
|
new FakePackage.new(spec), options
|
139
143
|
end
|
@@ -179,7 +183,13 @@ class Gem::Installer
|
|
179
183
|
|
180
184
|
process_options
|
181
185
|
|
182
|
-
|
186
|
+
@package.dir_mode = options[:dir_mode]
|
187
|
+
@package.prog_mode = options[:prog_mode]
|
188
|
+
@package.data_mode = options[:data_mode]
|
189
|
+
|
190
|
+
@bin_dir = options[:bin_dir] if options[:bin_dir]
|
191
|
+
|
192
|
+
if options[:user_install] and not options[:unpack]
|
183
193
|
@gem_home = Gem.user_dir
|
184
194
|
@bin_dir = Gem.bindir gem_home unless options[:bin_dir]
|
185
195
|
check_that_user_bin_dir_is_in_path
|
@@ -199,7 +209,7 @@ class Gem::Installer
|
|
199
209
|
#
|
200
210
|
# Otherwise +filename+ is overwritten.
|
201
211
|
|
202
|
-
def check_executable_overwrite
|
212
|
+
def check_executable_overwrite(filename) # :nodoc:
|
203
213
|
return if @force
|
204
214
|
|
205
215
|
generated_bin = File.join @bin_dir, formatted_program_filename(filename)
|
@@ -235,7 +245,7 @@ class Gem::Installer
|
|
235
245
|
|
236
246
|
question = "#{spec.name}'s executable \"#{filename}\" conflicts with ".dup
|
237
247
|
|
238
|
-
if ruby_executable
|
248
|
+
if ruby_executable
|
239
249
|
question << (existing || 'an unknown executable')
|
240
250
|
|
241
251
|
return if ask_yes_no "#{question}\nOverwrite the executable?", false
|
@@ -288,7 +298,7 @@ class Gem::Installer
|
|
288
298
|
run_pre_install_hooks
|
289
299
|
|
290
300
|
# Set loaded_from to ensure extension_dir is correct
|
291
|
-
if @options[:install_as_default]
|
301
|
+
if @options[:install_as_default]
|
292
302
|
spec.loaded_from = default_spec_file
|
293
303
|
else
|
294
304
|
spec.loaded_from = spec_file
|
@@ -298,9 +308,10 @@ class Gem::Installer
|
|
298
308
|
FileUtils.rm_rf gem_dir
|
299
309
|
FileUtils.rm_rf spec.extension_dir
|
300
310
|
|
301
|
-
|
311
|
+
dir_mode = options[:dir_mode]
|
312
|
+
FileUtils.mkdir_p gem_dir, :mode => dir_mode && 0700
|
302
313
|
|
303
|
-
if @options[:install_as_default]
|
314
|
+
if @options[:install_as_default]
|
304
315
|
extract_bin
|
305
316
|
write_default_spec
|
306
317
|
else
|
@@ -315,6 +326,8 @@ class Gem::Installer
|
|
315
326
|
write_cache_file
|
316
327
|
end
|
317
328
|
|
329
|
+
File.chmod(dir_mode, gem_dir) if dir_mode
|
330
|
+
|
318
331
|
say spec.post_install_message if options[:post_install_message] && !spec.post_install_message.nil?
|
319
332
|
|
320
333
|
Gem::Installer.install_lock.synchronize { Gem::Specification.reset }
|
@@ -331,7 +344,7 @@ class Gem::Installer
|
|
331
344
|
|
332
345
|
def run_pre_install_hooks # :nodoc:
|
333
346
|
Gem.pre_install_hooks.each do |hook|
|
334
|
-
if hook.call(self) == false
|
347
|
+
if hook.call(self) == false
|
335
348
|
location = " at #{$1}" if hook.inspect =~ /@(.*:\d+)/
|
336
349
|
|
337
350
|
message = "pre-install hook#{location} failed for #{spec.full_name}"
|
@@ -342,7 +355,7 @@ class Gem::Installer
|
|
342
355
|
|
343
356
|
def run_post_build_hooks # :nodoc:
|
344
357
|
Gem.post_build_hooks.each do |hook|
|
345
|
-
if hook.call(self) == false
|
358
|
+
if hook.call(self) == false
|
346
359
|
FileUtils.rm_rf gem_dir
|
347
360
|
|
348
361
|
location = " at #{$1}" if hook.inspect =~ /@(.*:\d+)/
|
@@ -368,7 +381,7 @@ class Gem::Installer
|
|
368
381
|
@specs ||= begin
|
369
382
|
specs = []
|
370
383
|
|
371
|
-
|
384
|
+
Gem::Util.glob_files_in_dir("*.gemspec", File.join(gem_home, "specifications")).each do |path|
|
372
385
|
spec = Gem::Specification.load path.untaint
|
373
386
|
specs << spec if spec
|
374
387
|
end
|
@@ -385,7 +398,7 @@ class Gem::Installer
|
|
385
398
|
# dependency :: Gem::Dependency
|
386
399
|
|
387
400
|
def ensure_dependency(spec, dependency)
|
388
|
-
unless installation_satisfies_dependency? dependency
|
401
|
+
unless installation_satisfies_dependency? dependency
|
389
402
|
raise Gem::InstallError, "#{spec.name} requires #{dependency}"
|
390
403
|
end
|
391
404
|
true
|
@@ -453,7 +466,7 @@ class Gem::Installer
|
|
453
466
|
# Creates windows .bat files for easy running of commands
|
454
467
|
|
455
468
|
def generate_windows_script(filename, bindir)
|
456
|
-
if Gem.win_platform?
|
469
|
+
if Gem.win_platform?
|
457
470
|
script_name = filename + ".bat"
|
458
471
|
script_path = File.join bindir, File.basename(script_name)
|
459
472
|
File.open script_path, 'w' do |file|
|
@@ -468,7 +481,7 @@ class Gem::Installer
|
|
468
481
|
return if spec.executables.nil? or spec.executables.empty?
|
469
482
|
|
470
483
|
begin
|
471
|
-
Dir.mkdir @bin_dir
|
484
|
+
Dir.mkdir @bin_dir, *[options[:dir_mode] && 0700].compact
|
472
485
|
rescue SystemCallError
|
473
486
|
raise unless File.directory? @bin_dir
|
474
487
|
end
|
@@ -479,18 +492,19 @@ class Gem::Installer
|
|
479
492
|
filename.untaint
|
480
493
|
bin_path = File.join gem_dir, spec.bindir, filename
|
481
494
|
|
482
|
-
unless File.exist? bin_path
|
495
|
+
unless File.exist? bin_path
|
483
496
|
# TODO change this to a more useful warning
|
484
497
|
warn "`#{bin_path}` does not exist, maybe `gem pristine #{spec.name}` will fix it?"
|
485
498
|
next
|
486
499
|
end
|
487
500
|
|
488
501
|
mode = File.stat(bin_path).mode
|
489
|
-
|
502
|
+
dir_mode = options[:prog_mode] || (mode | 0111)
|
503
|
+
FileUtils.chmod dir_mode, bin_path unless dir_mode == mode
|
490
504
|
|
491
505
|
check_executable_overwrite filename
|
492
506
|
|
493
|
-
if @wrappers
|
507
|
+
if @wrappers
|
494
508
|
generate_bin_script filename, @bin_dir
|
495
509
|
else
|
496
510
|
generate_bin_symlink filename, @bin_dir
|
@@ -511,8 +525,9 @@ class Gem::Installer
|
|
511
525
|
|
512
526
|
FileUtils.rm_f bin_script_path # prior install may have been --no-wrappers
|
513
527
|
|
514
|
-
File.open bin_script_path, 'wb',
|
528
|
+
File.open bin_script_path, 'wb', 0700 do |file|
|
515
529
|
file.print app_script_text(filename)
|
530
|
+
file.chmod(options[:prog_mode] || 0755)
|
516
531
|
end
|
517
532
|
|
518
533
|
verbose bin_script_path
|
@@ -528,8 +543,8 @@ class Gem::Installer
|
|
528
543
|
src = File.join gem_dir, spec.bindir, filename
|
529
544
|
dst = File.join bindir, formatted_program_filename(filename)
|
530
545
|
|
531
|
-
if File.exist? dst
|
532
|
-
if File.symlink? dst
|
546
|
+
if File.exist? dst
|
547
|
+
if File.symlink? dst
|
533
548
|
link = File.readlink(dst).split File::SEPARATOR
|
534
549
|
cur_version = Gem::Version.create(link[-3].sub(/^.*-/, ''))
|
535
550
|
return if spec.version < cur_version
|
@@ -563,7 +578,7 @@ class Gem::Installer
|
|
563
578
|
path = File.join gem_dir, spec.bindir, bin_file_name
|
564
579
|
first_line = File.open(path, "rb") {|file| file.gets}
|
565
580
|
|
566
|
-
if /\A#!/ =~ first_line
|
581
|
+
if /\A#!/ =~ first_line
|
567
582
|
# Preserve extra words on shebang line, like "-w". Thanks RPA.
|
568
583
|
shebang = first_line.sub(/\A\#!.*?ruby\S*((\s+\S+)+)/, "#!#{Gem.ruby}")
|
569
584
|
opts = $1
|
@@ -588,9 +603,9 @@ class Gem::Installer
|
|
588
603
|
end
|
589
604
|
|
590
605
|
"#!#{which}"
|
591
|
-
elsif not ruby_name
|
606
|
+
elsif not ruby_name
|
592
607
|
"#!#{Gem.ruby}#{opts}"
|
593
|
-
elsif opts
|
608
|
+
elsif opts
|
594
609
|
"#!/bin/sh\n'exec' #{ruby_name.dump} '-x' \"$0\" \"$@\"\n#{shebang}"
|
595
610
|
else
|
596
611
|
# Create a plain shebang line.
|
@@ -616,9 +631,9 @@ class Gem::Installer
|
|
616
631
|
end
|
617
632
|
|
618
633
|
def ensure_required_ruby_version_met # :nodoc:
|
619
|
-
if rrv = spec.required_ruby_version
|
620
|
-
|
621
|
-
|
634
|
+
if rrv = spec.required_ruby_version
|
635
|
+
ruby_version = Gem.ruby_version
|
636
|
+
unless rrv.satisfied_by? ruby_version
|
622
637
|
raise Gem::RuntimeRequirementNotMetError,
|
623
638
|
"#{spec.name} requires Ruby version #{rrv}. The current ruby version is #{ruby_version}."
|
624
639
|
end
|
@@ -626,8 +641,8 @@ class Gem::Installer
|
|
626
641
|
end
|
627
642
|
|
628
643
|
def ensure_required_rubygems_version_met # :nodoc:
|
629
|
-
if rrgv = spec.required_rubygems_version
|
630
|
-
unless rrgv.satisfied_by? Gem.rubygems_version
|
644
|
+
if rrgv = spec.required_rubygems_version
|
645
|
+
unless rrgv.satisfied_by? Gem.rubygems_version
|
631
646
|
rg_version = Gem::VERSION
|
632
647
|
raise Gem::RuntimeRequirementNotMetError,
|
633
648
|
"#{spec.name} requires RubyGems version #{rrgv}. The current RubyGems version is #{rg_version}. " +
|
@@ -687,16 +702,16 @@ class Gem::Installer
|
|
687
702
|
File::ALT_SEPARATOR
|
688
703
|
|
689
704
|
path = ENV['PATH']
|
690
|
-
if Gem.win_platform?
|
705
|
+
if Gem.win_platform?
|
691
706
|
path = path.downcase
|
692
707
|
user_bin_dir = user_bin_dir.downcase
|
693
708
|
end
|
694
709
|
|
695
710
|
path = path.split(File::PATH_SEPARATOR)
|
696
711
|
|
697
|
-
unless path.include? user_bin_dir
|
712
|
+
unless path.include? user_bin_dir
|
698
713
|
unless !Gem.win_platform? && (path.include? user_bin_dir.sub(ENV['HOME'], '~'))
|
699
|
-
unless self.class.path_warning
|
714
|
+
unless self.class.path_warning
|
700
715
|
alert_warning "You don't have #{user_bin_dir} in your PATH,\n\t gem executables will not run."
|
701
716
|
self.class.path_warning = true
|
702
717
|
end
|
@@ -705,31 +720,14 @@ class Gem::Installer
|
|
705
720
|
end
|
706
721
|
|
707
722
|
def verify_gem_home(unpack = false) # :nodoc:
|
708
|
-
FileUtils.mkdir_p gem_home
|
723
|
+
FileUtils.mkdir_p gem_home, :mode => options[:dir_mode] && 0700
|
709
724
|
raise Gem::FilePermissionError, gem_home unless
|
710
725
|
unpack or File.writable?(gem_home)
|
711
726
|
end
|
712
727
|
|
713
|
-
def
|
714
|
-
|
715
|
-
|
716
|
-
end
|
717
|
-
|
718
|
-
if spec.raw_require_paths.any?{|path| path =~ /\r\n|\r|\n/ }
|
719
|
-
raise Gem::InstallError, "#{spec} has an invalid require_paths"
|
720
|
-
end
|
721
|
-
|
722
|
-
if spec.extensions.any?{|ext| ext =~ /\r\n|\r|\n/ }
|
723
|
-
raise Gem::InstallError, "#{spec} has an invalid extensions"
|
724
|
-
end
|
725
|
-
|
726
|
-
unless spec.specification_version.to_s =~ /\A\d+\z/
|
727
|
-
raise Gem::InstallError, "#{spec} has an invalid specification_version"
|
728
|
-
end
|
729
|
-
|
730
|
-
if spec.dependencies.any? {|dep| dep.type =~ /\r\n|\r|\n/ || dep.name =~ /\r\n|\r|\n/ }
|
731
|
-
raise Gem::InstallError, "#{spec} has an invalid dependencies"
|
732
|
-
end
|
728
|
+
def verify_spec_name
|
729
|
+
return if spec.name =~ Gem::Specification::VALID_NAME_PATTERN
|
730
|
+
raise Gem::InstallError, "#{spec} has an invalid name"
|
733
731
|
end
|
734
732
|
|
735
733
|
##
|
@@ -751,11 +749,11 @@ require 'rubygems'
|
|
751
749
|
|
752
750
|
version = "#{Gem::Requirement.default}.a"
|
753
751
|
|
754
|
-
|
755
|
-
|
756
|
-
str = str.
|
757
|
-
if str
|
758
|
-
version =
|
752
|
+
str = ARGV.first
|
753
|
+
if str
|
754
|
+
str = str.b[/\\A_(.*)_\\z/, 1]
|
755
|
+
if str and Gem::Version.correct?(str)
|
756
|
+
version = str
|
759
757
|
ARGV.shift
|
760
758
|
end
|
761
759
|
end
|
@@ -773,17 +771,38 @@ TEXT
|
|
773
771
|
# return the stub script text used to launch the true Ruby script
|
774
772
|
|
775
773
|
def windows_stub_script(bindir, bin_file_name)
|
776
|
-
|
777
|
-
|
774
|
+
rb_config = RbConfig::CONFIG
|
775
|
+
rb_topdir = RbConfig::TOPDIR || File.dirname(rb_config["bindir"])
|
776
|
+
|
777
|
+
# get ruby executable file name from RbConfig
|
778
|
+
ruby_exe = "#{rb_config['RUBY_INSTALL_NAME']}#{rb_config['EXEEXT']}"
|
779
|
+
ruby_exe = "ruby.exe" if ruby_exe.empty?
|
780
|
+
|
781
|
+
if File.exist?(File.join bindir, ruby_exe)
|
782
|
+
# stub & ruby.exe withing same folder. Portable
|
783
|
+
<<-TEXT
|
778
784
|
@ECHO OFF
|
779
|
-
|
780
|
-
|
781
|
-
|
782
|
-
|
783
|
-
|
784
|
-
|
785
|
+
@"%~dp0ruby.exe" "%~dpn0" %*
|
786
|
+
TEXT
|
787
|
+
elsif bindir.downcase.start_with? rb_topdir.downcase
|
788
|
+
# stub within ruby folder, but not standard bin. Portable
|
789
|
+
require 'pathname'
|
790
|
+
from = Pathname.new bindir
|
791
|
+
to = Pathname.new "#{rb_topdir}/bin"
|
792
|
+
rel = to.relative_path_from from
|
793
|
+
<<-TEXT
|
794
|
+
@ECHO OFF
|
795
|
+
@"%~dp0#{rel}/ruby.exe" "%~dpn0" %*
|
796
|
+
TEXT
|
797
|
+
else
|
798
|
+
# outside ruby folder, maybe -user-install or bundler. Portable, but ruby
|
799
|
+
# is dependent on PATH
|
800
|
+
<<-TEXT
|
801
|
+
@ECHO OFF
|
802
|
+
@ruby.exe "%~dpn0" %*
|
803
|
+
TEXT
|
804
|
+
end
|
785
805
|
end
|
786
|
-
|
787
806
|
##
|
788
807
|
# Builds extensions. Valid types of extensions are extconf.rb files,
|
789
808
|
# configure scripts and rakefiles or mkrf_conf files.
|
@@ -828,7 +847,7 @@ TEXT
|
|
828
847
|
# Prefix and suffix the program filename the same as ruby.
|
829
848
|
|
830
849
|
def formatted_program_filename(filename)
|
831
|
-
if @format_executable
|
850
|
+
if @format_executable
|
832
851
|
self.class.exec_format % File.basename(filename)
|
833
852
|
else
|
834
853
|
filename
|
@@ -857,12 +876,10 @@ TEXT
|
|
857
876
|
def pre_install_checks
|
858
877
|
verify_gem_home options[:unpack]
|
859
878
|
|
860
|
-
# The name and require_paths must be verified first, since it could contain
|
861
|
-
# ruby code that would be eval'ed in #ensure_loadable_spec
|
862
|
-
verify_spec
|
863
|
-
|
864
879
|
ensure_loadable_spec
|
865
880
|
|
881
|
+
verify_spec_name
|
882
|
+
|
866
883
|
if options[:install_as_default]
|
867
884
|
Gem.ensure_default_gem_subdirectories gem_home
|
868
885
|
else
|
@@ -887,7 +904,8 @@ TEXT
|
|
887
904
|
|
888
905
|
build_info_dir = File.join gem_home, 'build_info'
|
889
906
|
|
890
|
-
|
907
|
+
dir_mode = options[:dir_mode]
|
908
|
+
FileUtils.mkdir_p build_info_dir, :mode => dir_mode && 0700
|
891
909
|
|
892
910
|
build_info_file = File.join build_info_dir, "#{spec.full_name}.info"
|
893
911
|
|
@@ -896,6 +914,8 @@ TEXT
|
|
896
914
|
io.puts arg
|
897
915
|
end
|
898
916
|
end
|
917
|
+
|
918
|
+
File.chmod(dir_mode, build_info_dir) if dir_mode
|
899
919
|
end
|
900
920
|
|
901
921
|
##
|
@@ -1,7 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
require 'rubygems/test_case'
|
3
3
|
require 'rubygems/installer'
|
4
|
-
require 'rubygems/deprecate'
|
5
4
|
|
6
5
|
class Gem::Installer
|
7
6
|
|
@@ -107,18 +106,6 @@ class Gem::InstallerTestCase < Gem::TestCase
|
|
107
106
|
Gem::Installer.path_warning = false
|
108
107
|
end
|
109
108
|
|
110
|
-
def util_gem_bindir spec = @spec # :nodoc:
|
111
|
-
spec.bin_dir
|
112
|
-
end
|
113
|
-
|
114
|
-
def util_gem_dir spec = @spec # :nodoc:
|
115
|
-
spec.gem_dir
|
116
|
-
end
|
117
|
-
|
118
|
-
extend Gem::Deprecate
|
119
|
-
deprecate :util_gem_bindir, "@spec.bin_dir", 2016, 10
|
120
|
-
deprecate :util_gem_dir, "@spec.gem_dir", 2016, 10
|
121
|
-
|
122
109
|
##
|
123
110
|
# The path where installed executables live
|
124
111
|
|
@@ -196,4 +183,3 @@ class Gem::InstallerTestCase < Gem::TestCase
|
|
196
183
|
end
|
197
184
|
|
198
185
|
end
|
199
|
-
|
@@ -24,8 +24,10 @@ module Gem::LocalRemoteOptions
|
|
24
24
|
raise OptionParser::InvalidArgument, value
|
25
25
|
end
|
26
26
|
|
27
|
-
|
28
|
-
|
27
|
+
valid_uri_schemes = ["http", "https", "file", "s3"]
|
28
|
+
unless valid_uri_schemes.include?(uri.scheme)
|
29
|
+
msg = "Invalid uri scheme for #{value}\nPreface URLs with one of #{valid_uri_schemes.map{|s| "#{s}://"}}"
|
30
|
+
raise ArgumentError, msg
|
29
31
|
end
|
30
32
|
|
31
33
|
value
|
@@ -106,7 +108,7 @@ module Gem::LocalRemoteOptions
|
|
106
108
|
|
107
109
|
source << '/' if source !~ /\/\z/
|
108
110
|
|
109
|
-
if options.delete :sources_cleared
|
111
|
+
if options.delete :sources_cleared
|
110
112
|
Gem.sources = [source]
|
111
113
|
else
|
112
114
|
Gem.sources << source unless Gem.sources.include?(source)
|
@@ -146,4 +148,3 @@ module Gem::LocalRemoteOptions
|
|
146
148
|
end
|
147
149
|
|
148
150
|
end
|
149
|
-
|