Create a temporary directory for us to work in
$ cd ~ $ mkdir tmp-redcloth $ cd tmp-redcloth
Install RedCloth 4.2.6
Use bundler to install RedCloth 4.2.6 into our temporary directory.
$ cat > Gemfile source :rubygems gem 'RedCloth', '4.2.6' <ctrl-d> $ bundle install --path gems Fetching source index for http://rubygems.org/ Installing RedCloth (4.2.6) with native extensions Using bundler (1.0.7) Your bundle is complete! It was installed into ./gems
Attempt to load RedCloth
NOTE. I'm explicitly setting RUBYOPT to an empty string as my default setting is to require rubygems which will load the older, working, version I currently have installed.
$ cd gems/ruby/1.8/gems/RedCloth-4.2.6
Ensure that it's not just working by magic.
$ RUBYOPT='' ruby -e'require "RedCloth"' -e:1:in `require': no such file to load -- RedCloth (LoadError) from -e:1
Check to see whether we can load it after we've added 'lib' to the load path.
$ RUBYOPT='' ruby -e'$LOAD_PATH << "lib"; require "RedCloth"' -e:1:in `require': no such file to load -- RedCloth (LoadError) from -e:1
Check to see whether we can load it after we've added both 'lib' and 'lib/case_sensitive_require' to the load path.
$ RUBYOPT='' ruby -e'$LOAD_PATH << "lib"; $LOAD_PATH << "lib/case_sensitive_require"; require "RedCloth"' ./lib/case_sensitive_require/../redcloth.rb:12:in `require': no such file to load -- redcloth_scan (LoadError) Couldn't load redcloth_scan The $LOAD_PATH was: /Users/chrisroos/.rvm/rubies/ree-1.8.7-2010.01/lib/ruby/site_ruby/1.8 /Users/chrisroos/.rvm/rubies/ree-1.8.7-2010.01/lib/ruby/site_ruby/1.8/i686-darwin10.3.0 /Users/chrisroos/.rvm/rubies/ree-1.8.7-2010.01/lib/ruby/site_ruby /Users/chrisroos/.rvm/rubies/ree-1.8.7-2010.01/lib/ruby/vendor_ruby/1.8 /Users/chrisroos/.rvm/rubies/ree-1.8.7-2010.01/lib/ruby/vendor_ruby/1.8/i686-darwin10.3.0 /Users/chrisroos/.rvm/rubies/ree-1.8.7-2010.01/lib/ruby/vendor_ruby /Users/chrisroos/.rvm/rubies/ree-1.8.7-2010.01/lib/ruby/1.8 /Users/chrisroos/.rvm/rubies/ree-1.8.7-2010.01/lib/ruby/1.8/i686-darwin10.3.0 . lib lib/case_sensitive_require from ./lib/case_sensitive_require/../redcloth.rb:12 from ./lib/case_sensitive_require/RedCloth.rb:6:in `require' from ./lib/case_sensitive_require/RedCloth.rb:6 from -e:1:in `require' from -e:1
It now complains that it's missing redcloth_scan. Let's find out where it is.
$ find . -name "redcloth_scan*" ./ext/redcloth_scan ./ext/redcloth_scan/redcloth_scan.bundle ./ext/redcloth_scan/redcloth_scan.c ./ext/redcloth_scan/redcloth_scan.o ./lib/lib/case_sensitive_require/redcloth_scan.bundle ./lib/redcloth_scan.jar
I think the version we need to use is the one in lib/lib/case_sensitive_require so let's add that to the load path and see what happens.
$ RUBYOPT='' ruby -e'$LOAD_PATH << "lib"; $LOAD_PATH << "lib/case_sensitive_require"; $LOAD_PATH << "lib/lib/case_sensitive_require"; require "RedCloth"'
And now we can require it successfully.