【发布时间】:2015-05-11 22:06:11
【问题描述】:
在我自己的 gem 中,我有一个 Gemfile,它看起来基本上是这样的:
source 'https://my.gemserver.com'
source 'https://rubygems.org'
gemspec
我的.gemspec 的所有依赖项都列为add_dependency 和add_development_dependency。
从 Bundler 1.8 开始,我收到警告:
Warning: this Gemfile contains multiple primary sources. Using `source` more than
once without a block is a security risk, and may result in installing unexpected gems.
To resolve this warning, use a block to indicate which gems should come from the
secondary source. To upgrade this warning to an error,
run `bundle config disable_multisource true`.
有没有办法解决这个警告(不通过捆绑配置静音)?我在 Rubygems 规范中找不到任何关于源选项的信息。
【问题讨论】:
-
您是否尝试过使用像 example 这样的源代码块?
-
问题是,我没有在 Gemfile 中列出我的 gem 依赖项。它们都列在 .gemspec 中。我必须在 Gemfile 中复制它们吗?那么引用 gemspec 有什么意义呢?
-
@ChristophPetschnig Here 是一篇关于
Gemfile和.gemspec持有的角色的好文章。 -
@engineersmnky 谢谢。尽管如此,它还是谈到了避免重复。使用源代码块(这很有意义)意味着重复。此外,我对 .gemspec 中的
add_development_dependency越来越怀疑。我相信这来自预捆绑器时代,那里的宝石应该属于 Gemfile。
标签: ruby rubygems bundler gemspecs