Why is my gemfile not skipping over "production" gems?
为什么我的gemfile没有跳过“生产”宝石呢?
I just installed Rails on Mac OS X Mavericks (possibly an irrelevant detail). When I do bundle install
, it gives me an error about missing pg
gem. However this is only listed in my production
environment, so shouldn't it be skipped? Commenting out my gem pg
makes bundle install
successful. Extra context:
我刚刚在Mac OS X Mavericks上安装了Rails(可能是一个无关的细节)。当我进行捆绑安装时,它会给我一个关于缺少pg gem的错误。但是这只是在我的生产环境中列出的,所以不应该跳过它吗?注释我的gem pg使bundle安装成功。额外的背景:
I just installed Rails on Mac OS X Mavericks. When I try to open my project, it seems to think I'm in "production" and tries to use my "pg" gem for Postgres. If I try to use rails s
or rails console
, I get the error that I haven't installed "pg" which should only be used in production for my DB.
我刚刚在Mac OS X Mavericks上安装了Rails。当我试图打开我的项目,它似乎认为我在“生产”,并试图使用我的“pg”宝石为Postgres。如果我尝试使用rails s或rails控制台,我得到的错误是我没有安装“pg”,它应该只用于我的DB的生产中。
I followed this tutorial: http://railsapps.github.io/installrubyonrails-mac.html
我学习了本教程:http://railsapps.github.io/installrubyonrails-mac.html
My gemfile:
我的gemfile:
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 'gon', '4.1.1'
gem "introjs-rails"
# High voltage for static pages
gem 'high_voltage', '~> 2.0.0'
gem "koala", "~> 1.8.0rc1"
gem 'acts_as_list'
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'
gem 'spork-rails', '4.0.0'
gem 'guard-spork', '1.5.0'
gem 'childprocess', '0.3.6'
end
group :test do
gem 'selenium-webdriver'
# makes it easy to programatically simulate your users' interactions with your application
gem 'capybara'
gem 'factory_girl_rails'
gem 'guard-rspec' # tims tutorial
# 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'
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 do
gem 'pg', '0.15.1'
gem 'rails_12factor', '0.0.2'
end
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'
# Use unicorn as the app server
# gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano', group: :development
# Use debugger
# gem 'debugger', group: [:development, :test]
gem 'omniauth-facebook', '1.4.0'
1 个解决方案
#1
3
By default, Bundler includes all groups. You have to explicitly exclude any groups you don't want like so:
默认情况下,Bundler包含所有组。你必须明确地排除任何你不想要的群体:
bundle install --without production
包安装,没有生产
After the first time, Bundler will remember your previous setting, so the production
group will be excluded next time you run bundle install
.
第一次之后,Bundler将记住您之前的设置,因此下次运行bundle install时将排除生产组。
#1
3
By default, Bundler includes all groups. You have to explicitly exclude any groups you don't want like so:
默认情况下,Bundler包含所有组。你必须明确地排除任何你不想要的群体:
bundle install --without production
包安装,没有生产
After the first time, Bundler will remember your previous setting, so the production
group will be excluded next time you run bundle install
.
第一次之后,Bundler将记住您之前的设置,因此下次运行bundle install时将排除生产组。