Gemfile.lock file management

Hi,

I would like to know what is the best way to manage Gemfile.lock file.

I read that the Gemfile.lock should be check in version control.

The fact is that commiting the generated Gemfile.lock will install the development and test gems on the production platform.

Should I have to run

$> bundle install --without development test

before commiting the Gemfile.lock?

Thanks in advance,

Mickael

No need, that will not change the Gemfile.lock contents assuming you have previously run "bundle install". You should run it with --without development test on your production machine after checking out from your VCS, to install the required gems excluding those for development and test.

Colin

I was only checking the content of the Gemfile.lock in the production platform, not the installed gems.

Indeed only the needed gems are installed not the development and test ones

Thanks,

Mickael

Not if you have them properly separated out in your Gemfile (w/o .lock). Use groups to designate gems that are only for certain environments, or at least should be omitted from at least one other environment. For instance:

===8<---cut here---

source 'http://rubygems.org'

gem 'rails', '3.2.0'

# Gems used only for assets and not required # in production environments by default. group :assets do   gem 'sass-rails', '~> 3.2.3'   gem 'coffee-rails', '~> 3.2.1'   gem 'uglifier', '>= 1.0.3' end

gem 'jquery-rails'

gem 'devise' gem 'omniauth'

group :development do   gem 'rspec-rails'   gem 'sqlite3' end

group :test do   gem 'turn', :require => false   gem 'rspec-rails'   gem 'sqlite3'   gem 'factory_girl'   gem 'webrat', '0.7.1' end

group :production do   # for heroku   gem 'pg' end

===8<---cut here---

-Dave