no such file to load — /vendor/rails/railties/lib/initializer
July 30th, 2008When deploying with capistrano, using git, and rails as a submodule in vendor/rails, you might run into the following error:
** [out :: domain] (in /var/www/apps/domain/releases/20080730043012) ** [out :: domain] rake aborted! ** [out :: domain] no such file to load –/var/www/apps/domain/releases/20080730043012/config/../vendor/rails/railties/lib/initializer ** [out :: domain] /var/www/apps/domain/releases/20080730043012/Rakefile:4 ** [out :: domain] (See full trace by running task with –trace)
When you check to see why it can’t find the file you’ll see /vendor/rails is empty. Once you understand why it’s empty (because it’s a git submodule), you’ll realize that capistrano isn’t doing the necessary commands to initialize that submodule. These commands are:
git submodule init git submodule update
Luckily, capistrano has added support for this by using the following in your deploy.rb.
set :git_enable_submodules, true
That will cause capistrano to execute the necessary commands for submodules:
if configuration[:git_enable_submodules]
execute << "#{git} submodule #{verbose} init"
execute << "#{git} submodule #{verbose} update"
end