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
@@ -0,0 +1,33 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'rubygems/command'
|
4
|
+
require 'rubygems/commands/query_command'
|
5
|
+
|
6
|
+
class Gem::Commands::InfoCommand < Gem::Commands::QueryCommand
|
7
|
+
def initialize
|
8
|
+
super "info", "Show information for the given gem"
|
9
|
+
|
10
|
+
remove_option('--name-matches')
|
11
|
+
remove_option('-d')
|
12
|
+
|
13
|
+
defaults[:details] = true
|
14
|
+
defaults[:exact] = true
|
15
|
+
end
|
16
|
+
|
17
|
+
def description # :nodoc:
|
18
|
+
"Info prints information about the gem such as name,"\
|
19
|
+
" description, website, license and installed paths"
|
20
|
+
end
|
21
|
+
|
22
|
+
def usage # :nodoc:
|
23
|
+
"#{program_name} GEMNAME"
|
24
|
+
end
|
25
|
+
|
26
|
+
def arguments # :nodoc:
|
27
|
+
"GEMNAME name of the gem to print information about"
|
28
|
+
end
|
29
|
+
|
30
|
+
def defaults_str
|
31
|
+
"--local"
|
32
|
+
end
|
33
|
+
end
|
@@ -132,7 +132,7 @@ You can use `i` command instead of `install`.
|
|
132
132
|
end
|
133
133
|
|
134
134
|
def check_install_dir # :nodoc:
|
135
|
-
if options[:install_dir] and options[:user_install]
|
135
|
+
if options[:install_dir] and options[:user_install]
|
136
136
|
alert_error "Use --install-dir or --user-install but not both"
|
137
137
|
terminate_interaction 1
|
138
138
|
end
|
@@ -140,22 +140,22 @@ You can use `i` command instead of `install`.
|
|
140
140
|
|
141
141
|
def check_version # :nodoc:
|
142
142
|
if options[:version] != Gem::Requirement.default and
|
143
|
-
get_all_gem_names.size > 1
|
144
|
-
alert_error "Can't use --version
|
143
|
+
get_all_gem_names.size > 1
|
144
|
+
alert_error "Can't use --version with multiple gems. You can specify multiple gems with" \
|
145
|
+
" version requirements using `gem install 'my_gem:1.0.0' 'my_other_gem:~>2.0.0'`"
|
145
146
|
terminate_interaction 1
|
146
147
|
end
|
147
148
|
end
|
148
149
|
|
149
150
|
def execute
|
150
|
-
|
151
|
-
if options.include? :gemdeps then
|
151
|
+
if options.include? :gemdeps
|
152
152
|
install_from_gemdeps
|
153
153
|
return # not reached
|
154
154
|
end
|
155
155
|
|
156
156
|
@installed_specs = []
|
157
157
|
|
158
|
-
ENV.delete 'GEM_PATH' if options[:install_dir].nil?
|
158
|
+
ENV.delete 'GEM_PATH' if options[:install_dir].nil?
|
159
159
|
|
160
160
|
check_install_dir
|
161
161
|
check_version
|
@@ -188,13 +188,13 @@ You can use `i` command instead of `install`.
|
|
188
188
|
terminate_interaction
|
189
189
|
end
|
190
190
|
|
191
|
-
def install_gem
|
191
|
+
def install_gem(name, version) # :nodoc:
|
192
192
|
return if options[:conservative] and
|
193
193
|
not Gem::Dependency.new(name, version).matching_specs.empty?
|
194
194
|
|
195
195
|
req = Gem::Requirement.create(version)
|
196
196
|
|
197
|
-
if options[:ignore_dependencies]
|
197
|
+
if options[:ignore_dependencies]
|
198
198
|
install_gem_without_dependencies name, req
|
199
199
|
else
|
200
200
|
inst = Gem::DependencyInstaller.new options
|
@@ -216,11 +216,11 @@ You can use `i` command instead of `install`.
|
|
216
216
|
end
|
217
217
|
end
|
218
218
|
|
219
|
-
def install_gem_without_dependencies
|
219
|
+
def install_gem_without_dependencies(name, req) # :nodoc:
|
220
220
|
gem = nil
|
221
221
|
|
222
|
-
if local?
|
223
|
-
if name =~ /\.gem$/ and File.file? name
|
222
|
+
if local?
|
223
|
+
if name =~ /\.gem$/ and File.file? name
|
224
224
|
source = Gem::Source::SpecificFile.new name
|
225
225
|
spec = source.spec
|
226
226
|
else
|
@@ -230,7 +230,7 @@ You can use `i` command instead of `install`.
|
|
230
230
|
gem = source.download spec if spec
|
231
231
|
end
|
232
232
|
|
233
|
-
if remote? and not gem
|
233
|
+
if remote? and not gem
|
234
234
|
dependency = Gem::Dependency.new name, req
|
235
235
|
dependency.prerelease = options[:prerelease]
|
236
236
|
|
@@ -257,17 +257,22 @@ You can use `i` command instead of `install`.
|
|
257
257
|
|
258
258
|
get_all_gem_names_and_versions.each do |gem_name, gem_version|
|
259
259
|
gem_version ||= options[:version]
|
260
|
+
domain = options[:domain]
|
261
|
+
domain = :local unless options[:suggest_alternate]
|
260
262
|
|
261
263
|
begin
|
262
264
|
install_gem gem_name, gem_version
|
263
265
|
rescue Gem::InstallError => e
|
264
266
|
alert_error "Error installing #{gem_name}:\n\t#{e.message}"
|
265
267
|
exit_code |= 1
|
266
|
-
rescue Gem::GemNotFoundException
|
267
|
-
domain = options[:domain]
|
268
|
-
domain = :local unless options[:suggest_alternate]
|
268
|
+
rescue Gem::GemNotFoundException => e
|
269
269
|
show_lookup_failure e.name, e.version, e.errors, domain
|
270
270
|
|
271
|
+
exit_code |= 2
|
272
|
+
rescue Gem::UnsatisfiableDependencyError => e
|
273
|
+
show_lookup_failure e.name, e.version, e.errors, domain,
|
274
|
+
"'#{gem_name}' (#{gem_version})"
|
275
|
+
|
271
276
|
exit_code |= 2
|
272
277
|
end
|
273
278
|
end
|
@@ -287,7 +292,7 @@ You can use `i` command instead of `install`.
|
|
287
292
|
require 'rubygems/rdoc'
|
288
293
|
end
|
289
294
|
|
290
|
-
def show_install_errors
|
295
|
+
def show_install_errors(errors) # :nodoc:
|
291
296
|
return unless errors
|
292
297
|
|
293
298
|
errors.each do |x|
|
@@ -307,4 +312,3 @@ You can use `i` command instead of `install`.
|
|
307
312
|
end
|
308
313
|
|
309
314
|
end
|
310
|
-
|
@@ -59,7 +59,7 @@ lock it down to the exact version.
|
|
59
59
|
end
|
60
60
|
|
61
61
|
def complain(message)
|
62
|
-
if options[:strict]
|
62
|
+
if options[:strict]
|
63
63
|
raise Gem::Exception, message
|
64
64
|
else
|
65
65
|
say "# #{message}"
|
@@ -78,7 +78,7 @@ lock it down to the exact version.
|
|
78
78
|
|
79
79
|
spec = Gem::Specification.load spec_path(full_name)
|
80
80
|
|
81
|
-
if spec.nil?
|
81
|
+
if spec.nil?
|
82
82
|
complain "Could not find gem #{full_name}, try using the full name"
|
83
83
|
next
|
84
84
|
end
|
@@ -90,7 +90,7 @@ lock it down to the exact version.
|
|
90
90
|
next if locked[dep.name]
|
91
91
|
candidates = dep.matching_specs
|
92
92
|
|
93
|
-
if candidates.empty?
|
93
|
+
if candidates.empty?
|
94
94
|
complain "Unable to satisfy '#{dep}' from currently installed gems"
|
95
95
|
else
|
96
96
|
pending << candidates.last.full_name
|
@@ -108,4 +108,3 @@ lock it down to the exact version.
|
|
108
108
|
end
|
109
109
|
|
110
110
|
end
|
111
|
-
|
@@ -11,9 +11,9 @@ class Gem::Commands::OpenCommand < Gem::Command
|
|
11
11
|
def initialize
|
12
12
|
super 'open', 'Open gem sources in editor'
|
13
13
|
|
14
|
-
add_option('-e', '--editor
|
15
|
-
"
|
16
|
-
options[:editor] =
|
14
|
+
add_option('-e', '--editor COMMAND', String,
|
15
|
+
"Prepends COMMAND to gem path. Could be used to specify editor.") do |command, options|
|
16
|
+
options[:editor] = command || get_env_editor
|
17
17
|
end
|
18
18
|
add_option('-v', '--version VERSION', String,
|
19
19
|
"Opens specific gem version") do |version|
|
@@ -32,14 +32,14 @@ class Gem::Commands::OpenCommand < Gem::Command
|
|
32
32
|
def description # :nodoc:
|
33
33
|
<<-EOF
|
34
34
|
The open command opens gem in editor and changes current path
|
35
|
-
to gem's source directory.
|
36
|
-
|
37
|
-
$GEM_EDITOR variables.
|
35
|
+
to gem's source directory.
|
36
|
+
Editor command can be specified with -e option, otherwise rubygems
|
37
|
+
will look for editor in $EDITOR, $VISUAL and $GEM_EDITOR variables.
|
38
38
|
EOF
|
39
39
|
end
|
40
40
|
|
41
41
|
def usage # :nodoc:
|
42
|
-
"#{program_name} GEMNAME [-e
|
42
|
+
"#{program_name} GEMNAME [-e COMMAND]"
|
43
43
|
end
|
44
44
|
|
45
45
|
def get_env_editor
|
@@ -58,20 +58,26 @@ class Gem::Commands::OpenCommand < Gem::Command
|
|
58
58
|
terminate_interaction 1 unless found
|
59
59
|
end
|
60
60
|
|
61
|
-
def open_gem
|
61
|
+
def open_gem(name)
|
62
62
|
spec = spec_for name
|
63
|
+
|
63
64
|
return false unless spec
|
64
65
|
|
66
|
+
if spec.default_gem?
|
67
|
+
say "'#{name}' is a default gem and can't be opened."
|
68
|
+
return false
|
69
|
+
end
|
70
|
+
|
65
71
|
open_editor(spec.full_gem_path)
|
66
72
|
end
|
67
73
|
|
68
|
-
def open_editor
|
74
|
+
def open_editor(path)
|
69
75
|
Dir.chdir(path) do
|
70
76
|
system(*@editor.split(/\s+/) + [path])
|
71
77
|
end
|
72
78
|
end
|
73
79
|
|
74
|
-
def spec_for
|
80
|
+
def spec_for(name)
|
75
81
|
spec = Gem::Specification.find_all_by_name(name, @version).first
|
76
82
|
|
77
83
|
return spec if spec
|
@@ -2,11 +2,8 @@
|
|
2
2
|
require 'rubygems/command'
|
3
3
|
require 'rubygems/local_remote_options'
|
4
4
|
require 'rubygems/gemcutter_utilities'
|
5
|
-
require 'rubygems/text'
|
6
5
|
|
7
6
|
class Gem::Commands::OwnerCommand < Gem::Command
|
8
|
-
|
9
|
-
include Gem::Text
|
10
7
|
include Gem::LocalRemoteOptions
|
11
8
|
include Gem::GemcutterUtilities
|
12
9
|
|
@@ -33,6 +30,7 @@ permission to.
|
|
33
30
|
super 'owner', 'Manage gem owners of a gem on the push server'
|
34
31
|
add_proxy_option
|
35
32
|
add_key_option
|
33
|
+
add_otp_option
|
36
34
|
defaults.merge! :add => [], :remove => []
|
37
35
|
|
38
36
|
add_option '-a', '--add EMAIL', 'Add an owner' do |value, options|
|
@@ -61,13 +59,13 @@ permission to.
|
|
61
59
|
show_owners name
|
62
60
|
end
|
63
61
|
|
64
|
-
def show_owners
|
62
|
+
def show_owners(name)
|
65
63
|
response = rubygems_api_request :get, "api/v1/gems/#{name}/owners.yaml" do |request|
|
66
64
|
request.add_field "Authorization", api_key
|
67
65
|
end
|
68
66
|
|
69
67
|
with_response response do |resp|
|
70
|
-
owners = Gem::SafeYAML.load
|
68
|
+
owners = Gem::SafeYAML.load resp.body
|
71
69
|
|
72
70
|
say "Owners for gem: #{name}"
|
73
71
|
owners.each do |owner|
|
@@ -76,20 +74,21 @@ permission to.
|
|
76
74
|
end
|
77
75
|
end
|
78
76
|
|
79
|
-
def add_owners
|
77
|
+
def add_owners(name, owners)
|
80
78
|
manage_owners :post, name, owners
|
81
79
|
end
|
82
80
|
|
83
|
-
def remove_owners
|
81
|
+
def remove_owners(name, owners)
|
84
82
|
manage_owners :delete, name, owners
|
85
83
|
end
|
86
84
|
|
87
|
-
def manage_owners
|
85
|
+
def manage_owners(method, name, owners)
|
88
86
|
owners.each do |owner|
|
89
87
|
begin
|
90
|
-
response =
|
91
|
-
|
92
|
-
|
88
|
+
response = send_owner_request(method, name, owner)
|
89
|
+
|
90
|
+
if need_otp? response
|
91
|
+
response = send_owner_request(method, name, owner, true)
|
93
92
|
end
|
94
93
|
|
95
94
|
action = method == :delete ? "Removing" : "Adding"
|
@@ -101,4 +100,14 @@ permission to.
|
|
101
100
|
end
|
102
101
|
end
|
103
102
|
|
103
|
+
private
|
104
|
+
|
105
|
+
def send_owner_request(method, name, owner, use_otp = false)
|
106
|
+
rubygems_api_request method, "api/v1/gems/#{name}/owners" do |request|
|
107
|
+
request.set_form_data 'email' => owner
|
108
|
+
request.add_field "Authorization", api_key
|
109
|
+
request.add_field "OTP", options[:otp] if use_otp
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
104
113
|
end
|
@@ -24,7 +24,8 @@ class Gem::Commands::PristineCommand < Gem::Command
|
|
24
24
|
|
25
25
|
add_option('--skip=gem_name',
|
26
26
|
'used on --all, skip if name == gem_name') do |value, options|
|
27
|
-
options[:skip]
|
27
|
+
options[:skip] ||= []
|
28
|
+
options[:skip] << value
|
28
29
|
end
|
29
30
|
|
30
31
|
add_option('--[no-]extensions',
|
@@ -45,6 +46,12 @@ class Gem::Commands::PristineCommand < Gem::Command
|
|
45
46
|
options[:env_shebang] = value
|
46
47
|
end
|
47
48
|
|
49
|
+
add_option('-n', '--bindir DIR',
|
50
|
+
'Directory where executables are',
|
51
|
+
'located') do |value, options|
|
52
|
+
options[:bin_dir] = File.expand_path(value)
|
53
|
+
end
|
54
|
+
|
48
55
|
add_version_option('restore to', 'pristine condition')
|
49
56
|
end
|
50
57
|
|
@@ -81,13 +88,13 @@ extensions will be restored.
|
|
81
88
|
end
|
82
89
|
|
83
90
|
def execute
|
84
|
-
specs = if options[:all]
|
91
|
+
specs = if options[:all]
|
85
92
|
Gem::Specification.map
|
86
93
|
|
87
94
|
# `--extensions` must be explicitly given to pristine only gems
|
88
95
|
# with extensions.
|
89
96
|
elsif options[:extensions_set] and
|
90
|
-
options[:extensions] and options[:args].empty?
|
97
|
+
options[:extensions] and options[:args].empty?
|
91
98
|
Gem::Specification.select do |spec|
|
92
99
|
spec.extensions and not spec.extensions.empty?
|
93
100
|
end
|
@@ -97,7 +104,7 @@ extensions will be restored.
|
|
97
104
|
end.flatten
|
98
105
|
end
|
99
106
|
|
100
|
-
if specs.to_a.empty?
|
107
|
+
if specs.to_a.empty?
|
101
108
|
raise Gem::Exception,
|
102
109
|
"Failed to find gems #{options[:args]} #{options[:version]}"
|
103
110
|
end
|
@@ -115,24 +122,21 @@ extensions will be restored.
|
|
115
122
|
next
|
116
123
|
end
|
117
124
|
|
118
|
-
if
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
if spec.bundled_gem_in_old_ruby?
|
124
|
-
say "Skipped #{spec.full_name}, it is bundled with old Ruby"
|
125
|
-
next
|
125
|
+
if options.has_key? :skip
|
126
|
+
if options[:skip].include? spec.name
|
127
|
+
say "Skipped #{spec.full_name}, it was given through options"
|
128
|
+
next
|
129
|
+
end
|
126
130
|
end
|
127
131
|
|
128
|
-
unless spec.extensions.empty? or options[:extensions] or options[:only_executables]
|
132
|
+
unless spec.extensions.empty? or options[:extensions] or options[:only_executables]
|
129
133
|
say "Skipped #{spec.full_name}, it needs to compile an extension"
|
130
134
|
next
|
131
135
|
end
|
132
136
|
|
133
137
|
gem = spec.cache_file
|
134
138
|
|
135
|
-
unless File.exist? gem or options[:only_executables]
|
139
|
+
unless File.exist? gem or options[:only_executables]
|
136
140
|
require 'rubygems/remote_fetcher'
|
137
141
|
|
138
142
|
say "Cached gem for #{spec.full_name} not found, attempting to fetch..."
|
@@ -150,22 +154,25 @@ extensions will be restored.
|
|
150
154
|
end
|
151
155
|
|
152
156
|
env_shebang =
|
153
|
-
if options.include? :env_shebang
|
157
|
+
if options.include? :env_shebang
|
154
158
|
options[:env_shebang]
|
155
159
|
else
|
156
160
|
install_defaults = Gem::ConfigFile::PLATFORM_DEFAULTS['install']
|
157
161
|
install_defaults.to_s['--env-shebang']
|
158
162
|
end
|
159
163
|
|
164
|
+
bin_dir = options[:bin_dir] if options[:bin_dir]
|
165
|
+
|
160
166
|
installer_options = {
|
161
167
|
:wrappers => true,
|
162
168
|
:force => true,
|
163
169
|
:install_dir => spec.base_dir,
|
164
170
|
:env_shebang => env_shebang,
|
165
171
|
:build_args => spec.build_args,
|
172
|
+
:bin_dir => bin_dir
|
166
173
|
}
|
167
174
|
|
168
|
-
if options[:only_executables]
|
175
|
+
if options[:only_executables]
|
169
176
|
installer = Gem::Installer.for_spec(spec, installer_options)
|
170
177
|
installer.generate_bin
|
171
178
|
else
|
@@ -33,6 +33,7 @@ command. For further discussion see the help for the yank command.
|
|
33
33
|
|
34
34
|
add_proxy_option
|
35
35
|
add_key_option
|
36
|
+
add_otp_option
|
36
37
|
|
37
38
|
add_option('--host HOST',
|
38
39
|
'Push to another gemcutter-compatible host',
|
@@ -79,7 +80,7 @@ command. For further discussion see the help for the yank command.
|
|
79
80
|
|
80
81
|
if latest_rubygems_version < Gem.rubygems_version and
|
81
82
|
Gem.rubygems_version.prerelease? and
|
82
|
-
Gem::Version.new('2.0.0.rc.2') != Gem.rubygems_version
|
83
|
+
Gem::Version.new('2.0.0.rc.2') != Gem.rubygems_version
|
83
84
|
alert_error <<-ERROR
|
84
85
|
You are using a beta release of RubyGems (#{Gem::VERSION}) which is not
|
85
86
|
allowed to push gems. Please downgrade or upgrade to a release version.
|
@@ -96,7 +97,7 @@ You can upgrade or downgrade to the latest release version with:
|
|
96
97
|
|
97
98
|
gem_data = Gem::Package.new(name)
|
98
99
|
|
99
|
-
unless @host
|
100
|
+
unless @host
|
100
101
|
@host = gem_data.spec.metadata['default_gem_server']
|
101
102
|
end
|
102
103
|
|
@@ -113,11 +114,10 @@ You can upgrade or downgrade to the latest release version with:
|
|
113
114
|
|
114
115
|
say "Pushing gem to #{@host || Gem.host}..."
|
115
116
|
|
116
|
-
response =
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
request.add_field "Authorization", api_key
|
117
|
+
response = send_push_request(name, args)
|
118
|
+
|
119
|
+
if need_otp? response
|
120
|
+
response = send_push_request(name, args, true)
|
121
121
|
end
|
122
122
|
|
123
123
|
with_response response
|
@@ -125,6 +125,16 @@ You can upgrade or downgrade to the latest release version with:
|
|
125
125
|
|
126
126
|
private
|
127
127
|
|
128
|
+
def send_push_request(name, args, use_otp = false)
|
129
|
+
rubygems_api_request(*args) do |request|
|
130
|
+
request.body = Gem.read_binary name
|
131
|
+
request.add_field "Content-Length", request.body.size
|
132
|
+
request.add_field "Content-Type", "application/octet-stream"
|
133
|
+
request.add_field "Authorization", api_key
|
134
|
+
request.add_field "OTP", options[:otp] if use_otp
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
128
138
|
def get_hosts_for(name)
|
129
139
|
gem_metadata = Gem::Package.new(name).spec.metadata
|
130
140
|
|
@@ -134,4 +144,3 @@ You can upgrade or downgrade to the latest release version with:
|
|
134
144
|
]
|
135
145
|
end
|
136
146
|
end
|
137
|
-
|