Rails3 and Gemfile
I’ve had some problems with the new bundle install in rails 3. Specifically, on my laptop, in the development environment, I use sqlite. But in production, I use mysql. I was getting all sorts of errors on my laptop about the mysql gem not working and on the production server the errors were about a problem with the sqlite gem. Ideally, I wanted the development server to ignore mysql and the production server to ignore sqlite. Here’s how it was done.
Gemfile:
source 'http://rubygems.org' gem 'rails', '3.0.0' gem 'authlogic', :git => 'git://github.com/odorcicd/authlogic.git', :branch => 'rails3' gem 'declarative_authorization' gem 'rmagick', :require => 'RMagick' group :development do gem 'sqlite3-ruby', :require => 'sqlite3' end group :production do gem 'mysql', '2.8.1' end
On laptop,
$ sudo bundle install --without production test Fetching source index for http://rubygems.org/ Using rake (0.8.7) Using abstract (1.0.0) Using activesupport (3.0.0) Using builder (2.1.2) Using i18n (0.4.1) Using activemodel (3.0.0) Using erubis (2.6.6) Using rack (1.2.1) Using rack-mount (0.6.13) Using rack-test (0.5.4) Using tzinfo (0.3.23) Using actionpack (3.0.0) Using mime-types (1.16) Using polyglot (0.3.1) Using treetop (1.4.8) Using mail (2.2.5) Using actionmailer (3.0.0) Using arel (1.0.1) Using activerecord (3.0.0) Using activeresource (3.0.0) Using authlogic (2.1.3) from git://github.com/odorcicd/authlogic.git (at rails3) Using bundler (1.0.0) Using thor (0.14.0) Using railties (3.0.0) Using rails (3.0.0) Using declarative_authorization (0.5) Using rmagick (2.13.1) Using sqlite3-ruby (1.3.1) Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
And on my production server.
# sudo bundle install --without development test Using rake (0.8.7) Using abstract (1.0.0) Using activesupport (3.0.0) Using builder (2.1.2) Using i18n (0.4.1) Using activemodel (3.0.0) Using erubis (2.6.6) Using rack (1.2.1) Using rack-mount (0.6.13) Using rack-test (0.5.4) Using tzinfo (0.3.23) Using actionpack (3.0.0) Using mime-types (1.16) Using polyglot (0.3.1) Using treetop (1.4.8) Using mail (2.2.5) Using actionmailer (3.0.0) Using arel (1.0.1) Using activerecord (3.0.0) Using activeresource (3.0.0) Using authlogic (2.1.3) from git://github.com/odorcicd/authlogic.git (at rails3) Using bundler (1.0.0) Using thor (0.14.0) Using railties (3.0.0) Using rails (3.0.0) Using declarative_authorization (0.5) Using mysql (2.8.1) Using rmagick (2.13.1) Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
Working as it should.