From 95683e5cb2d1ab8351402b09ef853dcdf875bf8d Mon Sep 17 00:00:00 2001 From: drbrain Date: Wed, 18 Sep 2013 21:29:41 +0000 Subject: * lib/rubygems: Update to RubyGems 2.2.0.preview.1 This brings several new features to RubyGems summarized here: https://github.com/rubygems/rubygems/blob/v2.2.0.preview.1/History.txt * test/rubygems: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42967 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/rubygems/commands/pristine_command.rb | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'lib/rubygems/commands/pristine_command.rb') diff --git a/lib/rubygems/commands/pristine_command.rb b/lib/rubygems/commands/pristine_command.rb index 3f3bca45be..b54e7eac93 100644 --- a/lib/rubygems/commands/pristine_command.rb +++ b/lib/rubygems/commands/pristine_command.rb @@ -12,6 +12,7 @@ class Gem::Commands::PristineCommand < Gem::Command 'Restores installed gems to pristine condition from files located in the gem cache', :version => Gem::Requirement.default, :extensions => true, + :extensions_set => false, :all => false add_option('--all', @@ -23,7 +24,8 @@ class Gem::Commands::PristineCommand < Gem::Command add_option('--[no-]extensions', 'Restore gems with extensions', 'in addition to regular gems') do |value, options| - options[:extensions] = value + options[:extensions_set] = true + options[:extensions] = value end add_option('--only-executables', @@ -62,6 +64,9 @@ If the cached gem cannot be found it will be downloaded. If --no-extensions is provided pristine will not attempt to restore a gem with an extension. + +If --extensions is given (but not --all or gem names) only gems with +extensions will be restored. EOF end @@ -72,6 +77,14 @@ with an extension. def execute specs = if options[:all] then Gem::Specification.map + + # `--extensions` must be explicitly given to pristine only gems + # with extensions. + elsif options[:extensions_set] and + options[:extensions] and options[:args].empty? then + Gem::Specification.select do |spec| + spec.extensions and not spec.extensions.empty? + end else get_all_gem_names.map do |gem_name| Gem::Specification.find_all_by_name gem_name, options[:version] -- cgit v1.2.3