summaryrefslogtreecommitdiff
path: root/lib/rubygems/commands
diff options
context:
space:
mode:
authorhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-11-28 03:08:14 +0000
committerhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-11-28 03:08:14 +0000
commit5dbc6583c93621a7e992163bd27991bd3d3d9378 (patch)
tree93d60f32d81d9ee58b538586f44acccbbc27c230 /lib/rubygems/commands
parentb52761e4f71326099374515e494b1667b2bbf84b (diff)
Merge rubygems upstream from https://github.com/rubygems/rubygems/commit/2c499655f29070c809dfea9f5fda6fac6850e62e
https://github.com/rubygems/rubygems/pull/2493 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66065 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rubygems/commands')
-rw-r--r--lib/rubygems/commands/install_command.rb2
-rw-r--r--lib/rubygems/commands/pristine_command.rb5
-rw-r--r--lib/rubygems/commands/uninstall_command.rb21
3 files changed, 18 insertions, 10 deletions
diff --git a/lib/rubygems/commands/install_command.rb b/lib/rubygems/commands/install_command.rb
index fca14681ee..776b58651f 100644
--- a/lib/rubygems/commands/install_command.rb
+++ b/lib/rubygems/commands/install_command.rb
@@ -142,7 +142,7 @@ You can use `i` command instead of `install`.
if options[:version] != Gem::Requirement.default and
get_all_gem_names.size > 1
alert_error "Can't use --version with multiple gems. You can specify multiple gems with" \
- " version requirments using `gem install 'my_gem:1.0.0' 'my_other_gem:~>2.0.0'`"
+ " version requirements using `gem install 'my_gem:1.0.0' 'my_other_gem:~>2.0.0'`"
terminate_interaction 1
end
end
diff --git a/lib/rubygems/commands/pristine_command.rb b/lib/rubygems/commands/pristine_command.rb
index b686d8341d..41decde856 100644
--- a/lib/rubygems/commands/pristine_command.rb
+++ b/lib/rubygems/commands/pristine_command.rb
@@ -129,11 +129,6 @@ extensions will be restored.
end
end
- if spec.bundled_gem_in_old_ruby?
- say "Skipped #{spec.full_name}, it is bundled with old Ruby"
- next
- end
-
unless spec.extensions.empty? or options[:extensions] or options[:only_executables]
say "Skipped #{spec.full_name}, it needs to compile an extension"
next
diff --git a/lib/rubygems/commands/uninstall_command.rb b/lib/rubygems/commands/uninstall_command.rb
index 3f975ce3bc..9de0ea722b 100644
--- a/lib/rubygems/commands/uninstall_command.rb
+++ b/lib/rubygems/commands/uninstall_command.rb
@@ -114,7 +114,18 @@ that is a dependency of an existing gem. You can use the
"#{program_name} GEMNAME [GEMNAME ...]"
end
+ def check_version # :nodoc:
+ if options[:version] != Gem::Requirement.default and
+ get_all_gem_names.size > 1
+ alert_error "Can't use --version with multiple gems. You can specify multiple gems with" \
+ " version requirements using `gem uninstall 'my_gem:1.0.0' 'my_other_gem:~>2.0.0'`"
+ terminate_interaction 1
+ end
+ end
+
def execute
+ check_version
+
if options[:all] and not options[:args].empty?
uninstall_specific
elsif options[:all]
@@ -138,8 +149,9 @@ that is a dependency of an existing gem. You can use the
def uninstall_specific
deplist = Gem::DependencyList.new
- get_all_gem_names.uniq.each do |name|
- gem_specs = Gem::Specification.find_all_by_name(name)
+ get_all_gem_names_and_versions.each do |name, version|
+ requirement = Array(version || options[:version])
+ gem_specs = Gem::Specification.find_all_by_name(name, *requirement)
say("Gem '#{name}' is not installed") if gem_specs.empty?
gem_specs.each do |spec|
deplist.add spec
@@ -148,8 +160,9 @@ that is a dependency of an existing gem. You can use the
deps = deplist.strongly_connected_components.flatten.reverse
- deps.map(&:name).uniq.each do |gem_name|
- uninstall_gem(gem_name)
+ deps.each do |dep|
+ options[:version] = dep.version
+ uninstall_gem(dep.name)
end
end