aboutsummaryrefslogtreecommitdiffstats
path: root/lib/rubygems/commands/pristine_command.rb
diff options
context:
space:
mode:
authordrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-09-18 21:29:41 +0000
committerdrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-09-18 21:29:41 +0000
commit95683e5cb2d1ab8351402b09ef853dcdf875bf8d (patch)
tree44500dba22e9aa94ecc5d4fd348512d0fb236501 /lib/rubygems/commands/pristine_command.rb
parent81629f05312cc4df2193a17f13c581eda174d9af (diff)
downloadruby-95683e5cb2d1ab8351402b09ef853dcdf875bf8d.tar.gz
* 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
Diffstat (limited to 'lib/rubygems/commands/pristine_command.rb')
-rw-r--r--lib/rubygems/commands/pristine_command.rb15
1 files changed, 14 insertions, 1 deletions
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]