From c00e84327f14845bd484e76b5ee5dfeb1fa9ce3d Mon Sep 17 00:00:00 2001 From: hsbt Date: Sun, 8 Oct 2017 01:32:18 +0000 Subject: Merge rubygems master. This is RC version of Rubygems 2.7.0. https://github.com/rubygems/rubygems/commit/688fb7e83c13c3fe7c2bb03c49a2db4c82852aee git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60133 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/rubygems/install_update_options.rb | 33 +++++---------------------------- 1 file changed, 5 insertions(+), 28 deletions(-) (limited to 'lib/rubygems/install_update_options.rb') diff --git a/lib/rubygems/install_update_options.rb b/lib/rubygems/install_update_options.rb index 5559c94370..190372739b 100644 --- a/lib/rubygems/install_update_options.rb +++ b/lib/rubygems/install_update_options.rb @@ -6,37 +6,18 @@ #++ require 'rubygems' - -# forward-declare - -module Gem::Security # :nodoc: - class Policy # :nodoc: - end -end +require 'rubygems/security_option' ## # Mixin methods for install and update options for Gem::Commands module Gem::InstallUpdateOptions + include Gem::SecurityOption ## # Add the install/update options to the option parser. def add_install_update_options - # TODO: use @parser.accept - OptionParser.accept Gem::Security::Policy do |value| - require 'rubygems/security' - - raise OptionParser::InvalidArgument, 'OpenSSL not installed' unless - defined?(Gem::Security::HighSecurity) - - value = Gem::Security::Policies[value] - valid = Gem::Security::Policies.keys.sort - message = "#{value} (#{valid.join ', '} are valid)" - raise OptionParser::InvalidArgument, message if value.nil? - value - end - add_option(:"Install/Update", '-i', '--install-dir DIR', 'Gem repository directory to get installed', 'gems') do |value, options| @@ -124,11 +105,7 @@ module Gem::InstallUpdateOptions options[:wrappers] = value end - add_option(:"Install/Update", '-P', '--trust-policy POLICY', - Gem::Security::Policy, - 'Specify gem trust policy') do |value, options| - options[:security_policy] = value - end + add_security_option add_option(:"Install/Update", '--ignore-dependencies', 'Do not install any required dependent gems') do |value, options| @@ -136,8 +113,8 @@ module Gem::InstallUpdateOptions end add_option(:"Install/Update", '--[no-]format-executable', - 'Make installed executable names match ruby.', - 'If ruby is ruby18, foo_exec will be', + 'Make installed executable names match Ruby.', + 'If Ruby is ruby18, foo_exec will be', 'foo_exec18') do |value, options| options[:format_executable] = value end -- cgit v1.2.3