When using Capistrano to deploy a Rails project you may run into a problem with installing gems from a git source. This is about working around a really unhelpfull error that just says : "The --deployment flag requires a Gemfile.lock. Please make sure you have checked your Gemfile.lock into version control before deploying."
I just spent a while on this one and finally traced it to differences in the 'releases' directory between my servers. It seems like Capistrano picks one server to use as a sort of template server, and then just picks the last directory (sorted alphabetically) in 'releases' on the template server and thinks that is where bundler should be run.
In my case on my "template server" I had a dir in 'releases' called 'git_init'. That directory was not on one of my other servers. So when Capistrano tried to run "undle install --gemfile /home/deployer//releases/git_init/Gemfile ..." it would fail on the servers where there was no 'git_init' directory inside 'releases'. I removed the 'git_init' directory from the one server that had it and my deployments started working just fine.
I'm not sure why Cap doesn't use the release number that it generates in order to get a hold of the current release directory, but that's what it does.
I hope this post will help out anyone that's running into this problem.