Search code examples
ruby-on-railsruby-on-rails-3rakecapistranovendor

Rake cannot find gems in vendor/gems


I'm trying to publish a Rails 3.1 (upgraded from 3.0) application. After submitting the code I ran

bundle install --path vendor/gems RAILS_ENV=production

It worked. I've got a directory vendor/gems/ruby/1.9.1, in which bin, cache, doc, gems and specifications are located. However, when I run a rake task I've got an error:

$ rake db:migrate RAILS_ENV=production
Could not find authlogic-3.0.3 in any of the sources
Run `bundle install` to install missing gems.

It's not a problem with authlogic, it's both in gems and specifications directories, and it was annotate mentioned in the error before I removed it from the gemfile.

What can be wrong?

I'm using Ubuntu 10.10, Ruby 1.9.2p0, Rails 3.1 and Rake 0.9.2. The code was deployed by capistrano, vendor directory is placed in shared folder and linked in the releases.


Solution

  • If you want to use the project's gems then you should use bundle exec command e.g.,

    bundle exec rake db:create
    

    also require authlogic gem in gem file.

    gem 'authlogic'
    

    First delete the whole gems directory from vendor/ folder. You should use this:

    bundle install --path=vendor/gems
    

    no needs for specifying the environment.