[gem] uninstalling earlier versions

L

Lionel Thiry

Hello!

I'd like to know if there is any gentle way to uninstall all gems excepted the
latest versions and their depencency.

Thanks in advance
 
J

James Britt

Chad said:
$ gem cleanup

You'll need a fairly recent version of RubyGems. This was added
within the past couple of months.

Ah. Nice. SO I go and try it out, and mistype the command.

Yet it runs:

c:\>gem cl;eanup
Cleaning up installed gems...
Clean Up Complete


I see that one can abbreviate this, and I guess the trailing characters
were enough to stop it from actually running, because I then tried this:

c:\>gem cl
Cleaning up installed gems...
Attempting uninstall on rails-0.11.1
Attempting to uninstall gem 'rails'
Successfully uninstalled rails version 0.11.1
Attempting uninstall on mechanize-0.1.0
Attempting to uninstall gem 'mechanize'
Successfully uninstalled mechanize version 0.1.0
Attempting uninstall on nitro-0.14.0
Attempting to uninstall gem 'nitro'
Successfully uninstalled nitro version 0.14.0
Attempting uninstall on madeleine-0.6.1
Attempting to uninstall gem 'madeleine'
Successfully uninstalled madeleine version 0.6.1
Attempting uninstall on htmltools-1.0.8
Attempting to uninstall gem 'htmltools'
...


Wondering if 'cl' was a formal abbreviation for 'cleanup', I ran

C:\Temp>gem help cl
Usage: gem cleanup [options]

Options:
-d, --dryrun
...


But this works, too:

C:\Temp>gem help cle
Usage: gem cleanup [options]

Options:
-d, --dryrun
...


Does this willingness to interpret partial commands pose a risk if the
command is destructive? It is unlikely I would accidentally type "gem
cleanup", but "gem cl" seems plausible.


Might it be better to require complete command names on destructive
operations?

James
 
L

Lionel Thiry

Chad Fowler a écrit :
$ gem cleanup

You'll need a fairly recent version of RubyGems. This was added
within the past couple of months.

Thanks!

But I had some warnings:

---8<---
Attempting uninstall on rubyzip-0.5.5
Attempting to uninstall gem 'rubyzip'

You have requested to uninstall the gem:
rubyzip-0.5.5
instiki-0.10.0 depends on [rubyzip (= 0.5.5)]
instiki-0.9.2 depends on [rubyzip (= 0.5.5)]
If you remove this gems, one or more dependencies will not be met.
Continue with Uninstall? [Yn]
Successfully uninstalled rubyzip version 0.5.5
---8<---

and

---8<---
Attempting uninstall on rails-0.11.1
Attempting to uninstall gem 'rails'

You have requested to uninstall the gem:
rails-0.11.1
instiki-0.10.0 depends on [rails (= 0.11.1)]
If you remove this gems, one or more dependencies will not be met.
Continue with Uninstall? [Yn]
---8<---

I've said yes to both, but I don't know if it is a mistake or not. Can you tell
me more about this?
 
L

Lionel Thiry

Chad Fowler a écrit :
$ gem cleanup

You'll need a fairly recent version of RubyGems. This was added
within the past couple of months.

Thanks a lot!

I had some warnings:

---8<---
Attempting uninstall on rubyzip-0.5.5
Attempting to uninstall gem 'rubyzip'

You have requested to uninstall the gem:
rubyzip-0.5.5
instiki-0.10.0 depends on [rubyzip (= 0.5.5)]
instiki-0.9.2 depends on [rubyzip (= 0.5.5)]
If you remove this gems, one or more dependencies will not be met.
Continue with Uninstall? [Yn]
---8<---

and

---8<---
Attempting uninstall on rails-0.11.1
Attempting to uninstall gem 'rails'

You have requested to uninstall the gem:
rails-0.11.1
instiki-0.10.0 depends on [rails (= 0.11.1)]
If you remove this gems, one or more dependencies will not be met.
Continue with Uninstall? [Yn]
---8<---

I've said yes to both but I have no idea if it was the thing to do.

PS: my first post didn't succeed, this is a retry, there may be a double posting
 
J

Jim Weirich

---8<---
You have requested to uninstall the gem:
rails-0.11.1
instiki-0.10.0 depends on [rails (= 0.11.1)]
If you remove this gems, one or more dependencies will not be met.
Continue with Uninstall? [Yn]
---8<---

I've said yes to both but I have no idea if it was the thing to do.

Your version of instiki requires version 0.11.1 of rails. You presumably have
version 0.11.1 and a later version installed. The cleanup command wants to
remove 0.11.1 (since you have a later version), but the instiki program
cannot use the later version (because it explicitly says = 0.11.1). Removing
rails 0.11.1 will probably cause instiki to fail.
 
L

Lionel Thiry

Jim Weirich a écrit :
---8<---
You have requested to uninstall the gem:
rails-0.11.1
instiki-0.10.0 depends on [rails (= 0.11.1)]
If you remove this gems, one or more dependencies will not be met.
Continue with Uninstall? [Yn]
---8<---

I've said yes to both but I have no idea if it was the thing to do.


Your version of instiki requires version 0.11.1 of rails. You presumably have
version 0.11.1 and a later version installed. The cleanup command wants to
remove 0.11.1 (since you have a later version), but the instiki program
cannot use the later version (because it explicitly says = 0.11.1). Removing
rails 0.11.1 will probably cause instiki to fail.

Mmm, so I made a mistake.

But well, shouldn't the "n" anwser be the default? Who wants to break
dependencies? I personnaly didn't want it.

And is it really necessary to ask such a question? I mean, if one really wants
to remove a gem, action which could break depencies, wouldn't it be better for
him to explicitly force it? With something like:

gem unsinstall --force the_gem_I_really_want_to_remove

No? What do you think about it?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,170
Messages
2,570,925
Members
47,468
Latest member
Fannie44U3

Latest Threads

Top