From a21d403f21473b21b5766c2483b4325240e9edda Mon Sep 17 00:00:00 2001 From: hsbt Date: Mon, 1 Feb 2016 12:43:26 +0000 Subject: * lib/rubygems.rb, lib/rubygems/*, test/rubygems/*: Update rubygems-2.5.2. It supports to enable frozen string literal and add `--norc` option for disable to `.gemrc` configuration. See 2.5.2 release notes for other fixes and enhancements. https://github.com/rubygems/rubygems/blob/a8aa3bac723f045c52471c7b9328310a048561e0/History.txt#L3 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53707 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/rubygems/commands/build_command.rb | 6 +++++- lib/rubygems/commands/cert_command.rb | 2 +- lib/rubygems/commands/check_command.rb | 2 +- lib/rubygems/commands/cleanup_command.rb | 2 +- lib/rubygems/commands/contents_command.rb | 2 +- lib/rubygems/commands/dependency_command.rb | 6 +++--- lib/rubygems/commands/environment_command.rb | 7 +++---- lib/rubygems/commands/fetch_command.rb | 2 +- lib/rubygems/commands/generate_index_command.rb | 2 +- lib/rubygems/commands/help_command.rb | 2 +- lib/rubygems/commands/install_command.rb | 2 +- lib/rubygems/commands/list_command.rb | 2 +- lib/rubygems/commands/lock_command.rb | 2 +- lib/rubygems/commands/mirror_command.rb | 2 +- lib/rubygems/commands/open_command.rb | 2 +- lib/rubygems/commands/outdated_command.rb | 2 +- lib/rubygems/commands/owner_command.rb | 2 +- lib/rubygems/commands/pristine_command.rb | 2 +- lib/rubygems/commands/push_command.rb | 2 +- lib/rubygems/commands/query_command.rb | 18 +++++++++++------ lib/rubygems/commands/rdoc_command.rb | 2 +- lib/rubygems/commands/search_command.rb | 2 +- lib/rubygems/commands/server_command.rb | 2 +- lib/rubygems/commands/setup_command.rb | 2 +- lib/rubygems/commands/sources_command.rb | 2 +- lib/rubygems/commands/specification_command.rb | 2 +- lib/rubygems/commands/stale_command.rb | 2 +- lib/rubygems/commands/uninstall_command.rb | 2 +- lib/rubygems/commands/unpack_command.rb | 2 +- lib/rubygems/commands/update_command.rb | 2 +- lib/rubygems/commands/which_command.rb | 2 +- lib/rubygems/commands/yank_command.rb | 27 ++++++++++--------------- 32 files changed, 61 insertions(+), 57 deletions(-) (limited to 'lib/rubygems/commands') diff --git a/lib/rubygems/commands/build_command.rb b/lib/rubygems/commands/build_command.rb index facc5226af..38c45e46f0 100644 --- a/lib/rubygems/commands/build_command.rb +++ b/lib/rubygems/commands/build_command.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'rubygems/command' require 'rubygems/package' @@ -42,6 +42,10 @@ with gem spec: def execute gemspec = get_one_gem_name + unless File.exist? gemspec + gemspec += '.gemspec' if File.exist? gemspec + '.gemspec' + end + if File.exist? gemspec then spec = Gem::Specification.load gemspec diff --git a/lib/rubygems/commands/cert_command.rb b/lib/rubygems/commands/cert_command.rb index 073c6bd195..7adf5b01b1 100644 --- a/lib/rubygems/commands/cert_command.rb +++ b/lib/rubygems/commands/cert_command.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'rubygems/command' require 'rubygems/security' begin diff --git a/lib/rubygems/commands/check_command.rb b/lib/rubygems/commands/check_command.rb index 9d2b086951..818cb05f55 100644 --- a/lib/rubygems/commands/check_command.rb +++ b/lib/rubygems/commands/check_command.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'rubygems/command' require 'rubygems/version_option' require 'rubygems/validator' diff --git a/lib/rubygems/commands/cleanup_command.rb b/lib/rubygems/commands/cleanup_command.rb index a0bb3d576a..46f89f1bb8 100644 --- a/lib/rubygems/commands/cleanup_command.rb +++ b/lib/rubygems/commands/cleanup_command.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'rubygems/command' require 'rubygems/dependency_list' require 'rubygems/uninstaller' diff --git a/lib/rubygems/commands/contents_command.rb b/lib/rubygems/commands/contents_command.rb index de756939c0..e0f2eedb5d 100644 --- a/lib/rubygems/commands/contents_command.rb +++ b/lib/rubygems/commands/contents_command.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'English' require 'rubygems/command' require 'rubygems/version_option' diff --git a/lib/rubygems/commands/dependency_command.rb b/lib/rubygems/commands/dependency_command.rb index b9e33a94e0..97fd812ffa 100644 --- a/lib/rubygems/commands/dependency_command.rb +++ b/lib/rubygems/commands/dependency_command.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'rubygems/command' require 'rubygems/local_remote_options' require 'rubygems/version_option' @@ -100,7 +100,7 @@ use with other commands. end def display_readable specs, reverse # :nodoc: - response = '' + response = String.new specs.each do |spec| response << print_dependencies(spec) @@ -153,7 +153,7 @@ use with other commands. end def print_dependencies(spec, level = 0) # :nodoc: - response = '' + response = String.new response << ' ' * level + "Gem #{spec.full_name}\n" unless spec.dependencies.empty? then spec.dependencies.sort_by { |dep| dep.name }.each do |dep| diff --git a/lib/rubygems/commands/environment_command.rb b/lib/rubygems/commands/environment_command.rb index 47b62f03af..e825c761ad 100644 --- a/lib/rubygems/commands/environment_command.rb +++ b/lib/rubygems/commands/environment_command.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'rubygems/command' class Gem::Commands::EnvironmentCommand < Gem::Command @@ -72,7 +72,7 @@ lib/rubygems/defaults/operating_system.rb end def execute - out = '' + out = String.new arg = options[:args][0] out << case arg @@ -104,7 +104,7 @@ lib/rubygems/defaults/operating_system.rb end def show_environment # :nodoc: - out = "RubyGems Environment:\n" + out = "RubyGems Environment:\n".dup out << " - RUBYGEMS VERSION: #{Gem::VERSION}\n" @@ -158,4 +158,3 @@ lib/rubygems/defaults/operating_system.rb end end - diff --git a/lib/rubygems/commands/fetch_command.rb b/lib/rubygems/commands/fetch_command.rb index 3aecdc3b08..19559a7774 100644 --- a/lib/rubygems/commands/fetch_command.rb +++ b/lib/rubygems/commands/fetch_command.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'rubygems/command' require 'rubygems/local_remote_options' require 'rubygems/version_option' diff --git a/lib/rubygems/commands/generate_index_command.rb b/lib/rubygems/commands/generate_index_command.rb index c0fadba64f..01f1f88405 100644 --- a/lib/rubygems/commands/generate_index_command.rb +++ b/lib/rubygems/commands/generate_index_command.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'rubygems/command' require 'rubygems/indexer' diff --git a/lib/rubygems/commands/help_command.rb b/lib/rubygems/commands/help_command.rb index 4c176f372e..de3f175fad 100644 --- a/lib/rubygems/commands/help_command.rb +++ b/lib/rubygems/commands/help_command.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'rubygems/command' class Gem::Commands::HelpCommand < Gem::Command diff --git a/lib/rubygems/commands/install_command.rb b/lib/rubygems/commands/install_command.rb index 6e243df441..5f0934aa17 100644 --- a/lib/rubygems/commands/install_command.rb +++ b/lib/rubygems/commands/install_command.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'rubygems/command' require 'rubygems/install_update_options' require 'rubygems/dependency_installer' diff --git a/lib/rubygems/commands/list_command.rb b/lib/rubygems/commands/list_command.rb index 1f85cd3fcd..1acb49e5fb 100644 --- a/lib/rubygems/commands/list_command.rb +++ b/lib/rubygems/commands/list_command.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'rubygems/command' require 'rubygems/commands/query_command' diff --git a/lib/rubygems/commands/lock_command.rb b/lib/rubygems/commands/lock_command.rb index 5a56e91933..3eebfadc05 100644 --- a/lib/rubygems/commands/lock_command.rb +++ b/lib/rubygems/commands/lock_command.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'rubygems/command' class Gem::Commands::LockCommand < Gem::Command diff --git a/lib/rubygems/commands/mirror_command.rb b/lib/rubygems/commands/mirror_command.rb index 3816876a92..801c9c8927 100644 --- a/lib/rubygems/commands/mirror_command.rb +++ b/lib/rubygems/commands/mirror_command.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'rubygems/command' unless defined? Gem::Commands::MirrorCommand diff --git a/lib/rubygems/commands/open_command.rb b/lib/rubygems/commands/open_command.rb index 63bff16db0..957d369b26 100644 --- a/lib/rubygems/commands/open_command.rb +++ b/lib/rubygems/commands/open_command.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'English' require 'rubygems/command' require 'rubygems/version_option' diff --git a/lib/rubygems/commands/outdated_command.rb b/lib/rubygems/commands/outdated_command.rb index f7cfc08f70..70f6c02801 100644 --- a/lib/rubygems/commands/outdated_command.rb +++ b/lib/rubygems/commands/outdated_command.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'rubygems/command' require 'rubygems/local_remote_options' require 'rubygems/spec_fetcher' diff --git a/lib/rubygems/commands/owner_command.rb b/lib/rubygems/commands/owner_command.rb index b002ff18d4..e507c988d6 100644 --- a/lib/rubygems/commands/owner_command.rb +++ b/lib/rubygems/commands/owner_command.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'rubygems/command' require 'rubygems/local_remote_options' require 'rubygems/gemcutter_utilities' diff --git a/lib/rubygems/commands/pristine_command.rb b/lib/rubygems/commands/pristine_command.rb index 991272ae85..a5a348dc72 100644 --- a/lib/rubygems/commands/pristine_command.rb +++ b/lib/rubygems/commands/pristine_command.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'rubygems/command' require 'rubygems/package' require 'rubygems/installer' diff --git a/lib/rubygems/commands/push_command.rb b/lib/rubygems/commands/push_command.rb index a8e0819e82..035a03e5e7 100644 --- a/lib/rubygems/commands/push_command.rb +++ b/lib/rubygems/commands/push_command.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'rubygems/command' require 'rubygems/local_remote_options' require 'rubygems/gemcutter_utilities' diff --git a/lib/rubygems/commands/query_command.rb b/lib/rubygems/commands/query_command.rb index 4782eb98ef..d6196b44ed 100644 --- a/lib/rubygems/commands/query_command.rb +++ b/lib/rubygems/commands/query_command.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'rubygems/command' require 'rubygems/local_remote_options' require 'rubygems/spec_fetcher' @@ -50,6 +50,12 @@ class Gem::Commands::QueryCommand < Gem::Command options[:all] = value end + add_option('-e', '--exact', + 'Name of gem(s) to query on matches the', + 'provided STRING') do |value, options| + options[:exact] = value + end + add_option( '--[no-]prerelease', 'Display prerelease versions') do |value, options| options[:prerelease] = value @@ -79,7 +85,8 @@ is too hard to use. elsif !options[:name].source.empty? name = Array(options[:name]) else - name = options[:args].to_a.map{|arg| /#{arg}/i } + args = options[:args].to_a + name = options[:exact] ? args : args.map{|arg| /#{arg}/i } end prerelease = options[:prerelease] @@ -162,7 +169,7 @@ is too hard to use. :latest end - if name.source.empty? + if name.respond_to?(:source) && name.source.empty? spec_tuples = fetcher.detect(type) { true } else spec_tuples = fetcher.detect(type) do |name_tuple| @@ -277,7 +284,7 @@ is too hard to use. end def spec_authors entry, spec - authors = "Author#{spec.authors.length > 1 ? 's' : ''}: " + authors = "Author#{spec.authors.length > 1 ? 's' : ''}: ".dup authors << spec.authors.join(', ') entry << format_text(authors, 68, 4) end @@ -291,7 +298,7 @@ is too hard to use. def spec_license entry, spec return if spec.license.nil? or spec.license.empty? - licenses = "License#{spec.licenses.length > 1 ? 's' : ''}: " + licenses = "License#{spec.licenses.length > 1 ? 's' : ''}: ".dup licenses << spec.licenses.join(', ') entry << "\n" << format_text(licenses, 68, 4) end @@ -341,4 +348,3 @@ is too hard to use. end end - diff --git a/lib/rubygems/commands/rdoc_command.rb b/lib/rubygems/commands/rdoc_command.rb index 72aa972017..6992040dca 100644 --- a/lib/rubygems/commands/rdoc_command.rb +++ b/lib/rubygems/commands/rdoc_command.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'rubygems/command' require 'rubygems/version_option' require 'rubygems/rdoc' diff --git a/lib/rubygems/commands/search_command.rb b/lib/rubygems/commands/search_command.rb index 06cc997d4c..933436d84d 100644 --- a/lib/rubygems/commands/search_command.rb +++ b/lib/rubygems/commands/search_command.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'rubygems/command' require 'rubygems/commands/query_command' diff --git a/lib/rubygems/commands/server_command.rb b/lib/rubygems/commands/server_command.rb index f41bda40da..245156d50d 100644 --- a/lib/rubygems/commands/server_command.rb +++ b/lib/rubygems/commands/server_command.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'rubygems/command' require 'rubygems/server' diff --git a/lib/rubygems/commands/setup_command.rb b/lib/rubygems/commands/setup_command.rb index d3ef9ef94e..ebb08d24d7 100644 --- a/lib/rubygems/commands/setup_command.rb +++ b/lib/rubygems/commands/setup_command.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'rubygems/command' ## diff --git a/lib/rubygems/commands/sources_command.rb b/lib/rubygems/commands/sources_command.rb index 0ff5e075f5..9832afd214 100644 --- a/lib/rubygems/commands/sources_command.rb +++ b/lib/rubygems/commands/sources_command.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'rubygems/command' require 'rubygems/remote_fetcher' require 'rubygems/spec_fetcher' diff --git a/lib/rubygems/commands/specification_command.rb b/lib/rubygems/commands/specification_command.rb index 4e291c6ab1..ad8840adc2 100644 --- a/lib/rubygems/commands/specification_command.rb +++ b/lib/rubygems/commands/specification_command.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'rubygems/command' require 'rubygems/local_remote_options' require 'rubygems/version_option' diff --git a/lib/rubygems/commands/stale_command.rb b/lib/rubygems/commands/stale_command.rb index 6930c1cfde..0524ee1e2b 100644 --- a/lib/rubygems/commands/stale_command.rb +++ b/lib/rubygems/commands/stale_command.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'rubygems/command' class Gem::Commands::StaleCommand < Gem::Command diff --git a/lib/rubygems/commands/uninstall_command.rb b/lib/rubygems/commands/uninstall_command.rb index 52d4450bfb..fe97790194 100644 --- a/lib/rubygems/commands/uninstall_command.rb +++ b/lib/rubygems/commands/uninstall_command.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'rubygems/command' require 'rubygems/version_option' require 'rubygems/uninstaller' diff --git a/lib/rubygems/commands/unpack_command.rb b/lib/rubygems/commands/unpack_command.rb index 08eaf01314..ffa429de6f 100644 --- a/lib/rubygems/commands/unpack_command.rb +++ b/lib/rubygems/commands/unpack_command.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'rubygems/command' require 'rubygems/installer' require 'rubygems/version_option' diff --git a/lib/rubygems/commands/update_command.rb b/lib/rubygems/commands/update_command.rb index 8d76a8ce8e..d654a5fa4e 100644 --- a/lib/rubygems/commands/update_command.rb +++ b/lib/rubygems/commands/update_command.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'rubygems/command' require 'rubygems/command_manager' require 'rubygems/dependency_installer' diff --git a/lib/rubygems/commands/which_command.rb b/lib/rubygems/commands/which_command.rb index c01dc18ee0..c028d5d49f 100644 --- a/lib/rubygems/commands/which_command.rb +++ b/lib/rubygems/commands/which_command.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'rubygems/command' class Gem::Commands::WhichCommand < Gem::Command diff --git a/lib/rubygems/commands/yank_command.rb b/lib/rubygems/commands/yank_command.rb index ec99bd7df6..0d6575b272 100644 --- a/lib/rubygems/commands/yank_command.rb +++ b/lib/rubygems/commands/yank_command.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'rubygems/command' require 'rubygems/local_remote_options' require 'rubygems/version_option' @@ -32,7 +32,7 @@ as the reason for the removal request. end def usage # :nodoc: - "#{program_name} GEM -v VERSION [-p PLATFORM] [--undo] [--key KEY_NAME]" + "#{program_name} GEM -v VERSION [-p PLATFORM] [--key KEY_NAME] [--host HOST]" end def initialize @@ -41,25 +41,25 @@ as the reason for the removal request. add_version_option("remove") add_platform_option("remove") - add_option('--undo') do |value, options| - options[:undo] = true + add_option('--host HOST', + 'Yank from another gemcutter-compatible host') do |value, options| + options[:host] = value end add_key_option + @host = nil end def execute - sign_in + @host = options[:host] + + sign_in @host version = get_version_from_requirements(options[:version]) platform = get_platform_from_requirements(options) if version then - if options[:undo] then - unyank_gem(version, platform) - else - yank_gem(version, platform) - end + yank_gem(version, platform) else say "A version argument is required: #{usage}" terminate_interaction @@ -71,16 +71,11 @@ as the reason for the removal request. yank_api_request(:delete, version, platform, "api/v1/gems/yank") end - def unyank_gem(version, platform) - say "Unyanking gem from #{host}..." - yank_api_request(:put, version, platform, "api/v1/gems/unyank") - end - private def yank_api_request(method, version, platform, api) name = get_one_gem_name - response = rubygems_api_request(method, api) do |request| + response = rubygems_api_request(method, api, host) do |request| request.add_field("Authorization", api_key) data = { -- cgit v1.2.3