当在gemfile
中指定多个全局源时,Bundler(自1.7版起)会发出警告。您可以使用源块来指定哪些gem应来自给定源,但单个gem的源选项在gemspec
中不起作用。
如何在gemspec中指定依赖项的源代码?
Gem::Specification.new do |s|
# Gemspec contents omitted for brevity
# Lets say this one comes from RubyGems.org
s.add_runtime_dependency 'aruntimedep', '~> 1.0'
# And this one needs to be sourced from a private gem server
s.add_development_dependency 'adevdep', '~> 3.0'
# Note, Bundler throws an error in this case
# s.add_development_dependency 'adevdep', '~> 3.0', :source => "mygemserver.org"
end
1条答案
按热度按时间9jyewag01#
不能。您不能在
.gemspec
文件中指定源。要尝试使其工作,您可以执行以下操作:
看问题汇报:https://github.com/bundler/bundler/issues/3576