当gemfile
中指定了多个全局源时,
Bundler since v1.7会发出警告。您可以使用source blocks指定哪些宝石应来自特定来源,但单个宝石的source选项在gemspec
中不起作用。
如何指定gemspec中依赖项的来源? E.g。
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
答案 0 :(得分:0)
不。您无法在.gemspec文件中指定源。
要使其发挥作用,您可以执行以下操作:
#Gemfile
source 'https://rubygems.org'
source 'https://mygemserver.org' do
gem 'adevdep'
end
#gemspec
Gem::Specification.new do |s|
# Lets say this one comes from RubyGems.org
s.add_runtime_dependency 'aruntimedep', '~> 1.0'
s.add_development_dependency 'adevdep', '~> 0.2'
end