~ubuntu-branches/ubuntu/quantal/ruby1.9.1/quantal

« back to all changes in this revision

Viewing changes to lib/rubygems/commands/uninstall_command.rb

  • Committer: Bazaar Package Importer
  • Author(s): Lucas Nussbaum
  • Date: 2011-09-24 19:16:17 UTC
  • mfrom: (1.1.8 upstream) (13.1.7 experimental)
  • Revision ID: james.westby@ubuntu.com-20110924191617-o1qz4rcmqjot8zuy
Tags: 1.9.3~rc1-1
* New upstream release: 1.9.3 RC1.
  + Includes load.c fixes. Closes: #639959.
* Upload to unstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
49
49
      options[:user_install] = value
50
50
    end
51
51
 
 
52
    add_option('--[no-]format-executable',
 
53
               'Assume executable names match Ruby\'s prefix and suffix.') do |value, options|
 
54
      options[:format_executable] = value
 
55
    end
 
56
 
52
57
    add_version_option
53
58
    add_platform_option
54
59
  end
68
73
  end
69
74
 
70
75
  def execute
 
76
    original_path = Gem.path
 
77
 
71
78
    get_all_gem_names.each do |gem_name|
72
79
      begin
73
80
        Gem::Uninstaller.new(gem_name, options).uninstall
 
81
      rescue Gem::InstallError => e
 
82
        alert e.message
74
83
      rescue Gem::GemNotInHomeException => e
75
84
        spec = e.spec
76
85
        alert("In order to remove #{spec.name}, please execute:\n" \
77
86
              "\tgem uninstall #{spec.name} --install-dir=#{spec.installation_path}")
 
87
      ensure
 
88
        Gem.use_paths(*original_path)
78
89
      end
79
90
    end
80
91
  end