diff options
Diffstat (limited to 'lib/rubygems/commands')
-rw-r--r-- | lib/rubygems/commands/install_command.rb | 2 | ||||
-rw-r--r-- | lib/rubygems/commands/pristine_command.rb | 5 | ||||
-rw-r--r-- | lib/rubygems/commands/uninstall_command.rb | 21 |
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 |