简体   繁体   中英

How can I ignore a gem source on Heroku?

I have a Rails app with some private gems used for testing locally; I do not need to access them in production, on Heroku. They are loaded in the gemfile as source block, eg:

group :development, :test do
  source "https://myprivaterepo" do
    gem "mycustomgem", "~> 1.0"
  end
end

When I try to deploy to Heroku, the build fails ('could not fetch specs from https://myprivaterepo ') because Heroku cannot access the gem source. I have set a BUNDLE_WITHOUT config var to ignore development and test gems, but this still doesn't prevent the build trying to fetch gems from this source. How can I prevent this, so that Heroku just ignores these gems and their source completely?

Using Ruby 2.2.4, Rails 4.2, Heroku-16 stack.

try this: heroku config:set BUNDLE_WITHOUT="development:test"

or

gem 'mycustomgem', source: "https://myprivaterepo.com" if ENV['RAILS_ENV'] != 'production'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM