Tonight I created a simple Rip plugin which lets you install a RubyGems stub into the current ripenv, for faking out RubyGems.
Why is this useful? Well, Grit includes the following code:
require 'rubygems' gem "mime-types", ">=0" require 'mime/types'
Grit doesn’t really need RubyGems – it just needs
mime/types. Trying to run one of Grit’s tests, for instance, fails with
mime/types installed through any means other than RubyGems:
$ ruby test/test_diff.rb /Library/Ruby/Site/1.8/rubygems.rb:826:in `report_activate_error': Could not find RubyGem mime-types (>= 0) (Gem::LoadError) from /Library/Ruby/Site/1.8/rubygems.rb:260:in `activate' from /Library/Ruby/Site/1.8/rubygems.rb:67:in `gem' from ./test/../lib/grit.rb:20 from ./test/helper.rb:1:in `require' from ./test/helper.rb:1 from test/test_diff.rb:1:in `require' from test/test_diff.rb:1
But! after installing the plugin we can simply run
rip fake_rubygems to stub RubyGems in the active ripenv:
$ rip fake_rubygems rip: rubygems successfully faked $ ruby test/test_diff.rb Loaded suite test/test_diff Started . Finished in 0.000676 seconds.
Fantastic. Check out the plugin. For now the easiest way to install it is to manually stick it in
~/.rip/rip-commands (after creating the directory).
mkdir -p ~/.rip/rip-commands cd ~/.rip/rip-commands wget http://is.gd/1Sgvf
Next up: making plugin management simpler. Ta.