开发者

Installing gems tries to load the gems in my custom rake tasks before installing it

开发者 https://www.devze.com 2023-01-04 02:14 出处:网络
I\'m developing an application using rails 2.3.5, gitorious and deploy with vlad, the OS is Linux Mint 9 Isadora.

I'm developing an application using rails 2.3.5, gitorious and deploy with vlad, the OS is Linux Mint 9 Isadora.

vlad:setup and vlad:update are ok. But when I vlad:migrate and have the same error than if I ssh on the server and try a rake gems:install

rake aborted!

no such file to load -- ya2yaml

/var/www/path/to/releases/20100622030150/Rakefile:10 (See full trace by running task with --trace)

My config/environment.rb is good:

RAILS_GEM_VERSION = '2.3.5' unless defined? RAILS_GEM_VERSION  
# Bootstrap the Rails environment, frameworks, and default configuration  
require File.join(File.dirname(__FILE__), 'boot')  
Rails::Initializer.run do |config|  
  config.gem "haml"

I have a custom task in lib/tasks/db_fixtures.rake that requires ya2yaml:

namespace :export do
desc 'Create YAML test fixtures from data in an existing database.
Defaults to development database.  Set RAILS_ENV to override.'
require 'rubygems'
require 'ya2yaml'
task :fixtures => [:environment] do

When I rename this file it is not loaded by rake and I don't have the error anymore when I rake gems:install

So my guess is that it looks like rake gems:install tries to load the libs in my custom tasks before installing the gems for some reason and throw me an e开发者_开发技巧rror.

What would be a solution?

Thanks,


this might work? delay the requires on your rake task by moving them into the task itself

task :fixtures => [:environment] do
    require 'rubygems'
    require 'ya2yaml'
    # ...

by default running rake tasks 'loads' all of the rake files

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号