Cap 2.1, Rails 1.2.5, rake task, and Dreamhost problem

[Cross-posted from the Capistrano group]

I am experiencing a Catch-22 problem:

  • Deploying a simple rails 1.2.5 app on a Dreamhost account.

  • Dreamhost only has Rails 1.2.3 installed, so I’ve installed my own
    Ruby, rubygems, Rails, etc., which is working almost perfectly. (The
    exception is the problem I am describing here.)

  • There is an :after_update_code task that calls a rake task to deploy
    a tagged version of Rails to a shared location (patterned after Mike
    Clark’s “Managing Rails Versions with Capistrano” and Matthew Bass’s
    “Converting Mike’s Capistrano Cadillac into a Camero” blog posts, and
    my own improvements (Parked at Loopia). The task is
    running this:

cd #{release_path} && rake deploy_edge #{rails_version}
SHARED_PATH=#{deploy_to}/shared

deploy_edge is in the pastie, above, and works locally on my Mac and
when executed from the shell on the host.

  • The rake task is failing with the following error:

    • executing “cd /home/me/blah.org/releases/20071126062713 && rake
      deploy_edge TAG=rel_1-2-5 SHARED_PATH=/home/me/blah.org/shared”
      servers: [“blah.org”]
      [blah.org] executing command
      *** [err :: blah.org] /usr/bin/rake:17:Warning: require_gem is
      obsolete. Use gem instead.
      *** [err :: blah.org] Cannot find gem for Rails =1.2.5.0:
      *** [err :: blah.org] Install the missing gem with ‘gem install -
      v=1.2.5 rails’, or
      *** [err :: blah.org] change environment.rb to define
      RAILS_GEM_VERSION with your desired version.
  • When I run “rake deploy_edge TAG=rel_1-2-5 SHARED_PATH=/home/me/
    blah.org/shared” from the host shell, it works perfectly, but it’s
    using the rake that I installed, which is using the Rails 1.2.5 that
    is in my own gems directory. From the error above, Dreamhost’s rake is
    being run (/usr/bin/rake) against Dreamhost’s gems, which don’t
    include Rails 1.2.5.

  • My .bash_profile in my shell is what puts my own bin directory in
    front of Dreamhost’s, which is how my Ruby/gem/rake/Rails gets found
    when I run from the shell. However, Capistrano doesn’t appear to be
    using my .bash_profile to set the PATH.

Question: what do I need to do to set the PATH s.t. Capistrano shell
commands find my private Ruby/gem/rake/Rails?

Thank you in advance.

Ed