在我们的rails应用程序中,我们使用两个需要rest-client
的宝石(urbanairship和nylas)。一个人想要~> 1.6.7
而另一个想要~> 1.7.1
。
通常的bundle udpate
和rm Gemfile.lock; bundle install
不起作用。
当Bundler
解析依赖关系时,我们得到了这个:
Fetching dependency metadata from https://rubygems.org/..
Resolving dependencies............................................................................................................................................
Bundler could not find compatible versions for gem "rest-client":
In Gemfile:
urbanairship (~> 3.0.1) ruby depends on
unirest (>= 1.1.2, ~> 1.1) ruby depends on
rest-client (~> 1.6.7) ruby
nylas (>= 0) ruby depends on
rest-client (~> 1.7) ruby
我们无法使用nylas
或urbanairship
的不同版本。我们正在寻找的唯一解决方案是分配其中一个并编辑.gemspec
以接受相同版本的rest-client
。
有没有更简单的解决方案?
答案 0 :(得分:0)
Finally, ended up following Chris advice.
Forked nylas
https://github.com/hartator/nylas-ruby/
Relaxed Gemfile
requirements for rest-client
. (was 1.7
)
gem 'rest-client', '~> 1.6'
Relaxed nylas.gemspec
requirements for rest-client
. (was 1.7
)
s.add_dependency(%q<rest-client>, ["~> 1.6"])
Relaxed nylas.gemspec
runtime requirements for rest-client
. (was 1.7
)
s.add_runtime_dependency(%q<rest-client>, ["~> 1.6"])
Ran specs, everything was still passing.
Added the altered gem to my application Gemfile
gem 'nylas', git: 'git@github.com:hartator/nylas-ruby.git'
Everything is working. Still wondering if there is a cleaner solution out there.
Ref: https://github.com/hartator/nylas-ruby/commit/f7ff4076e96d8a31e223ca0f12d35811d6e9d811