How to customize Gemfile per developer?

I like to have this in my Gemfile:

local_gemfile = File.dirname(__FILE__) + "/Gemfile.local"
if File.file?(local_gemfile)
  require local_gemfile
end

I also have Gemfile.local and Gemfile.lock in gitignore. I know I’m not “supposed to”, but I don’t think the caveats (such as the ones you mention in your question) are worth it.

UPDATE for Bundler 1.0.10 as of March 3, 2011

local_gemfile = File.dirname(__FILE__) + "/Gemfile.local.rb"
if File.file?(local_gemfile)
  self.instance_eval(Bundler.read_file(local_gemfile))
end

I had to use this with Rails 3 and Bundler 1.0.10.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)