1 |
--- ruby-1.9.3-p0/lib/rubygems/uninstaller.rb.orig 2011-10-31 10:22:36.321579483 +0100 |
2 |
+++ ruby-1.9.3-p0/lib/rubygems/uninstaller.rb 2011-10-31 10:34:25.563626119 +0100 |
3 |
@@ -51,15 +51,14 @@ |
4 |
@bin_dir = options[:bin_dir] |
5 |
@format_executable = options[:format_executable] |
6 |
|
7 |
+ if options[:force] |
8 |
+ @force_all = true |
9 |
+ @force_ignore = true |
10 |
+ end |
11 |
+ |
12 |
# only add user directory if install_dir is not set |
13 |
@user_install = false |
14 |
@user_install = options[:user_install] unless options[:install_dir] |
15 |
- |
16 |
- if @user_install then |
17 |
- Gem.use_paths Gem.user_dir, @gem_home |
18 |
- else |
19 |
- Gem.use_paths @gem_home |
20 |
- end |
21 |
end |
22 |
|
23 |
## |
24 |
@@ -69,10 +68,24 @@ |
25 |
def uninstall |
26 |
list = Gem::Specification.find_all_by_name(@gem, @version) |
27 |
|
28 |
+ list, other_repo_specs = list.partition do |spec| |
29 |
+ @gem_home == spec.base_dir or |
30 |
+ (@user_install and spec.base_dir == Gem.user_dir) |
31 |
+ end |
32 |
+ |
33 |
if list.empty? then |
34 |
- raise Gem::InstallError, "gem #{@gem.inspect} is not installed" |
35 |
+ raise Gem::InstallError, "gem #{@gem.inspect} is not installed" if |
36 |
+ other_repo_specs.empty? |
37 |
+ |
38 |
+ other_repos = other_repo_specs.map { |spec| spec.base_dir }.uniq |
39 |
+ |
40 |
+ message = ["#{@gem} is not installed in GEM_HOME, try:"] |
41 |
+ message.concat other_repos.map { |repo| |
42 |
+ "\tgem uninstall -i #{repo} #{@gem}" |
43 |
+ } |
44 |
|
45 |
- elsif list.size > 1 and @force_all then |
46 |
+ raise Gem::InstallError, message.join("\n") |
47 |
+ elsif @force_all then |
48 |
remove_all list |
49 |
|
50 |
elsif list.size > 1 then |
51 |
@@ -250,12 +263,10 @@ |
52 |
msg << "\t#{spec.full_name}" |
53 |
|
54 |
spec.dependent_gems.each do |dep_spec, dep, satlist| |
55 |
- msg << |
56 |
- ("#{dep_spec.name}-#{dep_spec.version} depends on " + |
57 |
- "[#{dep.name} (#{dep.requirement})]") |
58 |
+ msg << "#{dep_spec.name}-#{dep_spec.version} depends on #{dep}" |
59 |
end |
60 |
|
61 |
- msg << 'If you remove this gems, one or more dependencies will not be met.' |
62 |
+ msg << 'If you remove this gem, one or more dependencies will not be met.' |
63 |
msg << 'Continue with Uninstall?' |
64 |
return ask_yes_no(msg.join("\n"), true) |
65 |
end |
66 |
|
67 |
--- ruby-1.9.3-p0/test/rubygems/test_gem_uninstaller.rb.orig 2011-11-03 08:58:31.411272176 +0100 |
68 |
+++ ruby-1.9.3-p0/test/rubygems/test_gem_uninstaller.rb 2011-11-03 08:58:43.010272351 +0100 |
69 |
@@ -225,7 +225,7 @@ |
70 |
|
71 |
uninstaller = Gem::Uninstaller.new('a') |
72 |
|
73 |
- use_ui Gem::MockGemUi.new("2\n") do |
74 |
+ use_ui Gem::MockGemUi.new("2\ny\n") do |
75 |
uninstaller.uninstall |
76 |
end |