为什么当gemspec声明一个打开的约束时,bundler坚持一个确切的宝石版本号? [英] Why is bundler insisting on an exact gem version number when the gemspec states an open constraint?

查看:194
本文介绍了为什么当gemspec声明一个打开的约束时,bundler坚持一个确切的宝石版本号?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在贡献Ruby gem koudoku 并试图让Travis CI工作。

几天前,Travis与Travis建立了联系,但所有版本均失败,出现此错误消息( example ):

  Bundler找不到gemfile:
rspec-rails(〜> 2.14.0)ruby依赖于
actionpack(> = 3.0)ruby依赖于$ b $ (〜> 1.2.1)ruby
capybara(> = 0)ruby取决于
rack(1.0.0)

gemspec 中的违规行为:

  s.add_development_dependencyrspec-rails,〜> 2.14.0
s.add_development_dependency'capybara'

我将宝石分叉并更改了第二行,因此需要水豚版> = 2.4.0 ,但当我在Travis上运行我自己的版本时,我得到完全相同的错误



最令我困惑的是,当你看水豚自己的gemspec 你可以看到它没有说明它取决于机架版本1.0.0, STRONG>。 真正的依赖项位于机架版本> = 1.0.0



为什么捆绑者坚持1.0.0恰恰当水豚本身不需要这个?我怎样才能让特拉维斯运行测试?


$ b $

 ⌚17:10:45▷/ tmp / koudoku▷⭠master▷bundle 
从http:// ruby​​gems中获取gem元数据。 org / .......
解决依赖关系........
Bundler找不到gemrack的兼容版本:
在Gemfile中:
rspec-rails(〜> 2.14.0)ruby取决于
actionpack(> = 3.0)ruby取决于
rack(〜> 1.2.1)ruby

水豚(> = 0)ruby取决于
rack(1.0.0)

在我刚刚下载的源文件中,当我 git clone 'd koudoku并运行 bundle 时,发生了什么。这发生在 ruby​​ 2.1.5 上,但Travis在1.9.3上遇到同样的问题。



它看起来像你以某种方式调整你的宝石,使它们工作,而从头开始的过程被打破。我不明白为什么 rack> = 1.0.0 不适用于 1.2.1 ,但我会建议你清理你的系统(使用 rvm 或类似的方法创建新的gemset)并尝试在本地工作。



抱歉发表这个答案,但它太长,以适应评论领域。



希望它有帮助。



版本:

 ▷rvm --version 
rvm 1.26.2(master)by Wayne E. Seguin< wayneeseguin@gmail.com>,Michal Papis
▷gem --version
2.4.4
▷bundle --version
Bundler版本1.7.6

UPD 不明原因添加此行to gemspec 导致无限解决依赖关系打印点:

  s.add_development_dependencyrack,〜> 1.2.1


I'm contributing to the Ruby gem koudoku and trying to get Travis CI to work.

The gem was set up with Travis a few days ago but all builds are failing with this error message (example):

Bundler could not find compatible versions for gem "rack":
  In Gemfile:
    rspec-rails (~> 2.14.0) ruby depends on
      actionpack (>= 3.0) ruby depends on
        rack (~> 1.2.1) ruby
    capybara (>= 0) ruby depends on
      rack (1.0.0)

The offending lines in the gemspec are:

s.add_development_dependency "rspec-rails", "~> 2.14.0"
s.add_development_dependency 'capybara'

I forked the gem and changed the second line so it requires capybara version >= 2.4.0, but when I run my own build on Travis I get the exact same error.

What's confusing me the most is, when you look in Capybara's own gemspec you can see it doesn't state it depends on rack version 1.0.0 exactly. The real dependency is on rack version >= 1.0.0.

Why is bundler insisting on 1.0.0 exactly when Capybara itself doesn't require this? How can I get Travis to run the tests?

解决方案

I must admit that is not Travis-specific problem.

⌚ 17:10:45 ▷ /tmp/koudoku ▷ ⭠ master ▷ bundle
Fetching gem metadata from http://rubygems.org/.......
Resolving dependencies........
Bundler could not find compatible versions for gem "rack":
  In Gemfile:
    rspec-rails (~> 2.14.0) ruby depends on
      actionpack (>= 3.0) ruby depends on
        rack (~> 1.2.1) ruby

    capybara (>= 0) ruby depends on
      rack (1.0.0)

This is what happened to me when I git clone’d koudoku and run bundle on the freshly downloaded sources. This occurred on ruby 2.1.5, but Travis had the same problem on 1.9.3.

It looks like you have somehow tuned your gems to make them work, while the from-the-scratch process is broken. I have no clue why rack >= 1.0.0 is not working for 1.2.1, but I would suggest you to clear your system (create new gemset using rvm or like) and try to make things working locally.

Sorry for posting this as an answer, but it’s too long to fit the "comment" field.

Hope it helps.

Versions:

▷ rvm --version
rvm 1.26.2 (master) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis 
▷ gem --version
2.4.4
▷ bundle --version
Bundler version 1.7.6

UPD For unknown reason adding this line to gemspec leads to infinite Resolving dependencies dots printing:

  s.add_development_dependency "rack", "~> 1.2.1"

这篇关于为什么当gemspec声明一个打开的约束时,bundler坚持一个确切的宝石版本号?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆