diff options
author | ryan <ryan@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-01-28 23:46:47 +0000 |
---|---|---|
committer | ryan <ryan@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-01-28 23:46:47 +0000 |
commit | 934f537b458778f4786716c95b73fc72bc1ce256 (patch) | |
tree | 6abdecd9956995a7f82c9f969c80657b4301f6bd /lib/rubygems/uninstaller.rb | |
parent | b511e1bfbe649b938e317e00ad1795f1b9623758 (diff) | |
download | ruby-934f537b458778f4786716c95b73fc72bc1ce256.tar.gz |
Import rubygems 1.5.0 (release candidate @ 09893d9)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30717 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rubygems/uninstaller.rb')
-rw-r--r-- | lib/rubygems/uninstaller.rb | 55 |
1 files changed, 27 insertions, 28 deletions
diff --git a/lib/rubygems/uninstaller.rb b/lib/rubygems/uninstaller.rb index 185926e949..df45771846 100644 --- a/lib/rubygems/uninstaller.rb +++ b/lib/rubygems/uninstaller.rb @@ -127,43 +127,42 @@ class Gem::Uninstaller # +gemspec+. def remove_executables(spec) - return if spec.nil? + return if spec.nil? or spec.executables.empty? - unless spec.executables.empty? then - bindir = @bin_dir ? @bin_dir : Gem.bindir(spec.installation_path) + bindir = @bin_dir ? @bin_dir : Gem.bindir(spec.installation_path) - list = @source_index.find_name(spec.name).delete_if { |s| - s.version == spec.version - } + list = @source_index.find_name(spec.name).delete_if { |s| + s.version == spec.version + } - executables = spec.executables.clone + executables = spec.executables.clone - list.each do |s| - s.executables.each do |exe_name| - executables.delete exe_name - end + list.each do |s| + s.executables.each do |exe_name| + executables.delete exe_name end + end - return if executables.empty? + return if executables.empty? - answer = if @force_executables.nil? then - ask_yes_no("Remove executables:\n" \ - "\t#{spec.executables.join(", ")}\n\nin addition to the gem?", - true) # " # appease ruby-mode - don't ask - else - @force_executables - end + remove = if @force_executables.nil? then + ask_yes_no("Remove executables:\n" \ + "\t#{spec.executables.join ', '}\n\n" \ + "in addition to the gem?", + true) + else + @force_executables + end - unless answer then - say "Executables and scripts will remain installed." - else - raise Gem::FilePermissionError, bindir unless File.writable? bindir + unless remove then + say "Executables and scripts will remain installed." + else + raise Gem::FilePermissionError, bindir unless File.writable? bindir - spec.executables.each do |exe_name| - say "Removing #{exe_name}" - FileUtils.rm_f File.join(bindir, exe_name) - FileUtils.rm_f File.join(bindir, "#{exe_name}.bat") - end + spec.executables.each do |exe_name| + say "Removing #{exe_name}" + FileUtils.rm_f File.join(bindir, exe_name) + FileUtils.rm_f File.join(bindir, "#{exe_name}.bat") end end end |