Coming Soon to a Fedora Mirror near you - Fedora Core 11. With enhancements like: KDE 4.2, Python 2.6, Thunderbird 3.0, Firefox 3.1, and Radeon 3D Update. For more information check out this link: Fedora Core 11 (Leonidas) Feature List.

Painlessly Remove All Ruby Gems

January 14th, 2009

I noticed a lot of people searching for a way to delete all installed ruby gems and finding my Painless Cleanup of Ruby Gems With Similar Names page. I added this page for those of you who want to delete all installed gems instead of just cleaning them up.

Listing all gems is easy: ‘gem list’.

OK, we can list our gems, but how do we delete them all? My list looks something like this:

abstract (1.0.0)
actionmailer (2.2.2, 2.1.2, 2.1.1, 2.1.0, 2.0.2, 1.3.6)
actionpack (2.2.2, 2.1.2, 2.1.1, 2.1.0, 2.0.2, 1.13.6)
actionwebservice (1.2.6, 1.2.5, 1.2.3, 1.2.2, 1.2.1, 1.1.6)
activerecord (2.2.2, 2.1.2, 2.1.1, 2.1.0, 2.0.2, 1.15.6)
[...]
will_paginate (2.2.2)
ZenTest (3.11.0)

Now that we have a list, we need to get rid of the version info. We do this with the shell command ‘cut’. ‘cut’ removes sections from each line of files or STDOUT. We remove sections by setting a delimiter ‘-d" "’ and a field ‘-f N’ (N is the section we want to keep). In this case, we want to cut out everything to the right of the gem name. There is a space between the gem name and the version info so we will use the [space] as a delimiter. Field 1 will be everything to the left of the delimiter (our gem name) so we will insert ‘1’ as the field number.

Let’s use the two commands to generate a list of all installed gems. We accomplish this by ‘piping’ or chaining the two commands with the ‘|’ character. Our command now looks like this ‘gem list | cut -d" " -f1’. The list now looks like this:

abstract
actionmailer
actionpack
actionwebservice
activerecord
[...]
will_paginate
ZenTest

The command to uninstall all versions of a gem is: ‘gem uninstall -Iax STRING’... so uninstalling all versions of merb-helpers is: ‘gem uninstall -Iax merb-helpers’. That only uninstalls all versions of one gem and we have a list which we want to iterate through to delete all versions of all gems. We do this with the ‘xargs’ command which builds and executes command lines from STDIN or the list we generated with the command ‘gem list merb | cut -d" " -f1’.

You probably noticed there are three flags (I, a, x) in the uninstall command. The flags do the following: -I Ignore dependency requirements while uninstalling, -a Uninstall all matching versions, -x Uninstall applicable executables without confirmation. So the command ‘gem uninstall -Iax’ uninstalls all matching gems and its associated executable without regard to dependencies.

Our ‘xargs’ command to run the uninstall ALL gems is ‘xargs gem uninstall -aIx’. ‘xargs’ iterates through each line of our list and uninstalls each gem. The gem name will be appended (but not visible). Again, we ‘pipe’ or chain the cleanup command to our previous command.

'gem list | cut -d" " -f1 | xargs gem uninstall -aIx' deletes all installed ruby gems!

Successfully uninstalled abstract-1.0.0
Successfully uninstalled actionmailer-1.3.6
Successfully uninstalled actionmailer-2.0.2
[...]
Successfully uninstalled will_paginate-2.2.2
Successfully uninstalled ZenTest-3.11.0

A couple of caveats: first, I use Fedora Core Linux so the commands should work for all Linux flavors. The commands should also work for Mac users using ‘sudo’. This command will remove EVERY gem listed so be judicious.

You now have the tools to list all versions of installed gems, remove the version number leaving only the list of gems, and then executing the ‘xargs’ command to delete all installed gems.

I have been riding the bleeding edge of Merb and Datamapper for about seven or eight months. Whenever the source was updated at Github , I would pull in the changes, rebuild, then reinstall the gems. There was a time when the Merb and Datamapper contributors were bumping versions regularly and I was having problems with versions interfering with each other. I wanted only the latest and greatest gems installed.

Luckily Merb gems all start with ‘merb’ and Datamapper gems all start with ‘dm’. All I needed to do was write a shell command which lists all gems beginning with ‘merb’ or ‘dm’ and remove all but the latest and greatest. Listing gems based on the beginning of their name is easy: ‘gem list STRING’. The command to list all merb gems is: ‘gem list merb’.

OK, we can list our gems, but how do we clean them up? My list looks like this:

merb (1.0.6.1, 1.0.6, 1.0.5)
merb-action-args (1.0.6.1, 1.0.6, 1.0.5)
merb-assets (1.0.6.1, 1.0.6, 1.0.5)
merb-auth (1.0.6.1, 1.0.6, 1.0.5)
[...]
merb_datamapper (1.0.6.1, 1.0.6, 1.0.5)

Now that we have a list, we need to get rid of the version info. We do this with the shell command ‘cut’. ‘cut’ removes sections from each line of files or STDOUT. We remove sections by setting a delimiter ‘-d" "’ and a field ‘-f N’ (N is the section we want to keep). In this case, we want to cut out everything to the right of the gem name. There is a space between the gem name and the version info so we will use the [space] as a delimiter. Field 1 will be everthing to the left of the delimiter (our gem name) so we will insert ‘1’ as the field number.

Let’s use the two commands to generate a list of gems beginning with ‘merb’. We accomplish this by ‘piping’ or chaining the two commands with the ‘|’ character. Our command now looks like this ‘gem list merb | cut -d" " -f1’. The list now looks like this:

merb
merb-action-args 
merb-assets
merb-auth
[...]
merb_datamapper

The command to uninstall all gems except the latest and greatest is: ‘gem cleanup STRING’... so cleaning up merb-helpers is: ‘gem cleanup merb-helpers’. That only cleans up one gem and we have a list which we want to iterate through and cleanup. We do this with the ‘xargs’ command which builds and executes command lines from STDIN or the list we generated with the command ‘gem list merb | cut -d" " -f1’.

Our ‘xargs’ command to run gem cleanup is ‘xargs gem cleanup’. ‘xargs’ iterates through each line of our list and cleans up the gem. The gem name will be appended (but not visible). Again, we ‘pipe’ or chain the cleanup command to our previous command.

gem list merb | cut -d" " -f1 | xargs gem cleanup’ leaves us with only the latest and greatest merb gems!


Attempting to uninstall merb-action-args-1.0.6 
Successfully uninstalled merb-action-args-1.0.6
Attempting to uninstall merb-action-args-1.0.5
Successfully uninstalled merb-action-args-1.0.5                                                                                          
Attempting to uninstall merb_datamapper-1.0.6
Successfully uninstalled merb_datamapper-1.0.6
Attempting to uninstall merb_datamapper-1.0.5
Successfully uninstalled merb_datamapper-1.0.5
[...]                                                                                                
Attempting to uninstall merb-core-1.0.6
Successfully uninstalled merb-core-1.0.6
Attempting to uninstall merb-core-1.0.5
Successfully uninstalled merb-core-1.0.5 

A couple of caveats: first, I use Fedora Core Linux so the commands should work for all Linux flavors. The commands should also work for Mac users using ‘sudo’. This command will remove EVERY gem listed except the latest, so be judicous. If your app depends on a version less than the latest, you will have to selectively remove the gem manually. I highly recommend you list the gems first before you cleanup (‘gem list merb | cut -d" " -f1‘).

You now have the tools to list all gems beginning with a gem name and all its versions, remove the version number leaving only the list of gems, and then executing the ‘xargs’ command to cleanup all the selected gems.

Keyboard Not Working in KDE

December 4th, 2008

Today I ran into an issue where my keyboard stopped working in KDE (Fedora Core 10, KDE 4.1). I just updated some rpm’s which included the xorg ati drivers and thought that might have been the problem. I logged out of KDE and into XFCE where the keyboard worked fine… doh!

I googled and discovered the problem was in my ~/.kde/share/config/kaccessrc file. The SlowKeys attribute was set to true (SlowKeys=true). I set the attribute to false (SlowKeys=false) and all is well once again.

I set the SlowKeys attribute to true when I was working in Gimp. I held the shift key down and was hunting for the key I wanted to select with the shift key when a box popped up asking ‘Do You Really Want to Activate “Slow Keys”’. Unfortunately, I did not understand what the consequences would be and clicked Yes. After updating some KDE apps, I logged out of KDE and logged back in… to a keyboard which did not work.

If you encounter this popup, select No. If you find your keyboard does not work in KDE, follow the directions above.

Mozilla announced yesterday (June 11, 2008) that Firefox 3.0 will be released June 17, 2008. Mozilla also wants us to help set a world record for the most software downloaded in a 24 hour time period. I pledged to help them, won’t you?

Firefox 3.0 Release Candiate 3 June 11, 2008 “The third Firefox 3 Release Candidate is now available for download. It contains a single change for Mac OS X users only; there is no change for users running previous Firefox Release Candidate versions on Windows or Linux.”

Firefox 3.0 RC2 Released

June 4th, 2008

Wow, after just a couple of weeks after Mozilla released Firefox Release Candidate 1, they released Firefox Release Candidate 2 (on June 4th, 2008). Read about it here: Firefox 3.0 Release Candidate 2 Release Notes.

You can download Release Candidate 2 here.

Firefox 3.0 RC1 Released

May 17th, 2008

Yay! Mozilla released Firefox Release Candidate 1 on May 16, 2008. Read about it here: Firefox 3.0 Release Candidate 1 Release Notes.

One of the first things I noticed is there is a new tab on the toolbar [Most Visited]. Now the sites I visit which I have not bookmarked are now easy to reach!

I have been using Firefox 3.0 since the beta 3 release and love it! Firefox 3.0 no longer leaks like a sieve, is faster, and has some neat-o new features. You can download Release Candidate 1 here.