Ruby

Still waiting for a Bulk Gems update…

I need to post about this again because life was just getting impossible on my cheapo virtual box. Well, I say cheap but it probably still has 75Mb of free memory that was just being hosed by RubyGems.

I tried updating to Ruby 1.8.7 but that had no effect because the culprit is really Gem itself.

The final solution (after naturally getting off 1.8.6, do it today…) turned out to be building and installing Gem from the 2.0 source tarball. Since getting away from 1.1.1 my Gem experience has been a lot smoother. Ramaze and the monsterous Merb installed smartly and without fuss. Don’t suffer for longer than you have to!

Standard
Java

Waiting for my Ruby Gems Bulk Update

One of the huge pains in the ass when using CRuby (MRI) RubyGems is that if you haven’t updated your gems in a while you can easily send your machine into a spin when you innocently type sudo gem update.

The message:

Bulk updating Gem source index

appears and then you just sit there… for hours… while gem… tries to parse… the yaml… which is obviously… much faster… than streaming… XML.

JRuby doesn’t seem to have the same issues, presumably something to do with the implementation not being so memory hungry.

Anyway if you are having this problem too you’ll be glad to know that a happy ending is possible via use of the –bulk-threshold parameter. Simply use a command line like the following and your low resource system will not actually process in chunks rather locking up your swap memory.

sudo gem update --bulk-threshold 10009
Standard
Ruby, Scripting

Dumb Ruby Gems mistake

So on and off over the last week I have been trying to get RedCloth to work in both Ruby and JRuby. Despite getting the gem I kept getting a failure when I tried to require ‘redcloth’. When I finally got Textile support working in Java before I had managed to weave the two or three lines of Textile magic the tutorials promised I shrugged and took the task off my GTD list.

Except that today my stubborn side told me to take a look at the Ruby Gems documentation after seeing an answer to a similar problem on a mailing list. Sure enough there in Chapter 3 was the explanation that you need to require Ruby Gems before the actual Gem you want to use.

Heading to irb and sure enough:

require 'rubygems'
require 'redcloth'

Does the trick and I am finally appreciating the library. Now maybe I’m slow or perhaps the same code on the RedCloth page should have included a full script that would regardless of what was in your RUBYOPT environment variable.

Standard