Cygwin, irb and utility_belt - a broken combination?
Working with Ruby occasionally requires the use of irb, the interactive Ruby shell. It’s a terrific tool for quickly exploring new things (in my case, using Ruby to experiment with using sendkeys via the Windows Script Host to automate an awkard windows app).
I’m using Cygwin to do the windows portion of my project at work, and I’ve become quite accustomed to using irb in conjunction with the very nifty utility_belt gem. I find it makes experimenting and making sub 20-liner hacks/tests even quicker, with method tab-completion and neat colorisation.
However, on Cygwin, it doesn’t “just work”. After I installed rubygems and utiltiy_belt on Cygwin, I copied the ~/.irbc file from my Linux PC, which looked something like this:
1 2 3 | require 'rubygems' require 'utility_belt' UtilityBelt::Themes.background(:dark) |
However, on Cygwin, I got this error every time I started irb (and utility_belt failed to work):
1 2 3 4 5 6 7 8 9 | User@Bulkhead ~ $ irb load error: /home/User/.irbrc NameError: uninitialized constant UtilityBelt::Themes /home/User/.irbrc:4 /usr/lib/ruby/1.8/irb/init.rb:207:in `load' /usr/lib/ruby/1.8/irb/init.rb:207:in `run_config' /usr/lib/ruby/1.8/irb/init.rb:20:in `setup' irb(main):001:0> |
Nobody else seems to be having this problem, so perhaps there’s something wrong with my installation (It’s a relatively fresh install of Cygwin though), but here’s the work-around I came up with:
1 2 3 4 | require 'rubygems' require 'utility_belt' load 'utility_belt/utility_belt.rb' UtilityBelt::Themes.background(:dark) |