如何忽略Heroku上的宝石源?

时间:2022-03-26 07:10:18

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, e.g:

我有一个Rails应用程序,其中包含一些用于本地测试的私有宝石;在Heroku上我不需要在生产中访问它们。它们作为源块加载到gemfile中,例如:

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?

当我尝试部署到Heroku时,构建失败('无法从https:// myprivaterepo'获取规范),因为Heroku无法访问gem源。我已经设置了一个BUNDLE_WITHOUT配置变量来忽略开发和测试宝石,但是这仍然不能阻止构建尝试从这个源获取宝石。我如何防止这种情况,以便Heroku完全忽略这些宝石及其来源?

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

使用Ruby 2.2.4,Rails 4.2,Heroku-16堆栈。

1 个解决方案

#1


0  

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

试试这个:heroku config:set BUNDLE_WITHOUT =“development:test”

or

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

gem'mycustomgem',来源:“https://myprivaterepo.com”如果ENV ['RAILS_ENV']!='production'

#1


0  

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

试试这个:heroku config:set BUNDLE_WITHOUT =“development:test”

or

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

gem'mycustomgem',来源:“https://myprivaterepo.com”如果ENV ['RAILS_ENV']!='production'