Winston Lawrence

Project Manager & Occasional developer

Installing the cheat GEM

I guess that I must have installed the cheat GEM on Ruby 1.8.6, but it was so long ago that I was thinking that it was part of the Ruby base - part of the charm in using Ruby I guess. Anyway it's a quick install right just go to the command prompt : C:Userswinston>gem install cheat the console indicated that all went well [Successfully installed cheat-1.2.1; 1 gem installed; Installing ri documentation for cheat-1.2.1...; Installing RDoc documentation for cheat-1.2.1...] but on testing:C:Userswinston>cheat cheat

c:/ruby19/lib/ruby/gems/1.9.1/gems/cheat-1.2.1/lib/cheat.rb:150:in`cache_dir'
uninitialized constant Cheat::PLATFORM (NameError) from c:/ruby19/lib/ruby/gems/1.9.1/gems/cheat-1.2.1/lib/cheat.rb:16:in `sheets'
from c:/ruby19/lib/ruby/gems/1.9.1/gems/cheat-1.2.1/bin/cheat:4:in`<top  (required)>'
from c:/Ruby19/bin/cheat:19:in`load'
from c:/Ruby19/bin/cheat:19:in`<main>'

Not cool, cheat.rb is failing!
Again, looking around the net the fix appeared to be Edit c:Ruby19librubygems1.9.1cheat-1.2.1libcheat.rb and change

PLATFORM =~ /win32/ ? win32_cache_dir : File.join(File.expand_path("~"), ".cheat") to
RUBY_PLATFORM =~ /win32/ ? win32_cache_dir : File.join(File.expand_path("~"), ".cheat")
and then test:
C:Userswinston>cheat cheat
cheat: Hi, welcome to cheat (http://cheat.errtheblog.com). Thanks for trying it out.
Instructions for editing are down below. Here are a few commands to get you started.
Installation: $ gem install cheat
Recently added cheat sheets: $ cheat recent
All cheat sheets: $ cheat sheets
The `strftime' cheat sheet: $ cheat strftime
View a cheat sheet in TextMate: $ cheat strftime | mate
To edit a cheat sheet, use the --edit switch. $ cheat markaby --edit
To add a cheat sheet, use the --add switch. $ cheat readme --add

... and cheat is back in business under Ruby 1.9.1!

Winston Lawrence

If you didn't think this article was worth a nickel then send two cents :-)
It's all good and its all very much appreciated!!   Donations and subscriptions gratefully accepted