I'm trying to get a Ruby on Rails project started on Dreamhost, ruby version 1.8.7 I can't check the rails version because of the rake problem but I believe it's at least 3.0. I was having trouble getting the mysql2 connector to work with rake db:migrate
and I was trying different versions of gems, and I installed a local version of bundle on ~/.gems, then uninstalled it, and now bundle and rake don't see the gems installed in /usr/lib/ruby/gems/1.8/bin.
I tried following http://wiki.dreamhost.com/Rails_3 to see if it was a path issue before I realized the local bundle gem may have caused the problem, and I erased my PATH by not including :$PATH at the end of the export command the first time. I looked up common $PATH variables and after following the link above the following are set to:
$GEM_HOME = ~/.gems
$GEM_PATH = /usr/lib/ruby/gems/1.8
$PATH = ~/.gems/bin:/usr/lib/ruby/gems/1.8/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games
So now I'm not quite sure if there was something in the $PATH that is now missing, or if it was the bundle install/uninstall in ~/.gems that make it so when I try to run rake db:migrate
or bundle exec rails console
I get the error "Could not find rake-0.8.7 in any of the sources".
EDIT: I tried following the directions on http://forums.site5.com/showthread.php?p=87539 so I added the GEM_PATH in environment.rb which points to the local and shared gem directories, ran irb
and tried require 'rubygems'
and require 'rake'
which both worked, $:
showed the correct version of rake, but still get the same error when trying to run rake db:migrate
in the RoR app directory, "Could not find rake-0.8.7 in any of the sources".
EDIT: After getting rvm setup I was at the same spot, but after reading http://muffinlabs.com/content/rvm-and-bundler-dreamhost I changed the GEM_HOME and GEM_PATH vars (in config/evironment.rb instead of config.ru) to the rvm setup ones and rake no longer gives the "Could not find rake" error. The mysql2 adapter still doesn't work but that's another issue.