0

When I do $ bundle install, it attempts to get gems only meant for production, despite me being on development.

I double checked that I'm on development: echo $RAILS_ENV # outputs "development"

Here is a copy of my gem file. If I remove :staging in the last block, then my bundle installs correctly and ignores this group. Why would adding :staging cause my app to include these gems?

source 'https://rubygems.org'
ruby '2.0.0'
#ruby-gemset=railstutorial_rails_4_0

gem 'rails', '4.0.0'
gem 'bootstrap-sass', '~> 3.0.1.0.rc'
gem 'bcrypt-ruby', '3.0.1'
# generates names, email addresses, and other placeholders for factories.
gem 'faker'
gem 'will_paginate', '3.0.4'
gem 'bootstrap-will_paginate', '0.0.9'
gem 'aws-sdk', '1.11.1'
gem 'd3-rails', '~>3.3.7'
# used for file ajax uploads
gem 'remotipart', '~> 1.2'
# used for making server side variables accessible in JS
gem "iconv", "~> 1.0.4"
gem "roo", "~> 1.13.2"
gem 'underscore-rails'

gem 'gon', '4.1.0'
# gem "introjs-rails"
# High voltage for static pages
gem 'high_voltage', '~> 2.0.0'
gem "koala", "~> 1.8.0rc1"
gem 'acts_as_list'
gem "bugsnag"
gem 'devise'
# EC2 server is passenger
gem 'passenger'
# easily create seeds
gem 'seed_dump'
#add crossfilter for exploring high dimensional datasets and dcjs for charts
gem 'crossfilter-rails'
# gem 'dcjs-rails'
gem 'activeadmin', github: 'gregbell/active_admin'
# Monitor site speed.
gem 'newrelic_rpm'

group :development, :test do
  gem 'sqlite3', '1.3.8'
  # rspec-rails includes RSpec itself in a wrapper to make it play nicely with Rails.
  gem 'rspec-rails'
  # replaces Rails' default fixtures for feeding test data to the test suite with much more preferable factories
  gem 'factory_girl_rails'
  # watches your application and tests and runs specs for you automatically when it detects changes.
  gem 'guard-rspec'
end

group :test do
  # runs a browser
    gem 'selenium-webdriver'
  # makes it easy to programatically simulate your users' interactions with your application
    gem 'capybara'
  # Shows growl notifications (os x only)
  gem 'growl'
  # opens your default web browser upon failed integration specs to show you what your application is rendering.
  gem 'launchy' # tims tutorial
  # helps clear out db after using selenium in tests
  gem 'database_cleaner' # tims tutorial
end

gem 'sass-rails', '4.0.1'
gem 'uglifier', '2.1.1'
gem 'coffee-rails', '4.0.1'
gem 'jquery-rails', '3.0.4'
# fuck turbolinks.
# gem 'turbolinks', '1.1.1'
gem 'jbuilder', '1.0.2'
# added for resizing panes on d3fiddle pages
gem 'jquery-ui-rails'
# added for code highlighting on d3fiddle pages
gem 'codemirror-rails'

group :doc do
  gem 'sdoc', '0.3.20', require: false
end

group :production, :staging do
    gem 'pg', '0.15.1'
    gem 'rails_12factor', '0.0.2'
end
Don P
  • 60,113
  • 114
  • 300
  • 432

1 Answers1

0

Use bundle install --without staging production.You can find more information about bundle here.

Update:

It is because of Bundler.require(:default, Rails.env) present in config/application.rb that bundle does not install gems present in test and production by default.

Peeyush
  • 6,144
  • 5
  • 23
  • 37
  • 1
    Yes that will work, but doesn't solve the issue of why it's trying to load an environment that doesnt match 'development'. – Don P Mar 21 '14 at 07:53
  • That's because it does not know whether to load/not-load the `staging` environment. It's not present in rails by default, you need to add it. – Peeyush Mar 21 '14 at 07:56
  • Bundler doesn't know anything about `development` or `staging` other than the fact they're groups you've defined. If you don't want Bundler to install everything, you have to explicitly tell it that. – colinm Mar 21 '14 at 08:00
  • So how does Bundler know not to install test and production usually? When im on local, I just run `bundle install` and it already only excludes the test and production gems. – Don P Mar 23 '14 at 00:14