加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

ruby – 使用bundler和不同的平台gem要求

发布时间:2020-12-17 03:13:42 所属栏目:百科 来源:网络整理
导读:根据 the manual,我似乎在努力应对捆绑器的标准功能 对于使用:platforms选项或平台块的某些平台,应该要求指定gem的能力 我想根据所使用的ruby版本指定不同版本的gem source "http://rubygems.org"gem "trollop","~ 1.16.2"gem "chronic","~ 0.6.4"gem "high
根据 the manual,我似乎在努力应对捆绑器的标准功能
对于使用:platforms选项或平台块的某些平台,应该要求指定gem的能力

我想根据所使用的ruby版本指定不同版本的gem

source "http://rubygems.org"
gem "trollop","~> 1.16.2"
gem "chronic","~> 0.6.4"
gem "highline","~> 1.6.2"
gem "colorize","~> 0.5.8"
gem "queryparams","~> 0.0.3"

platforms :ruby_18 do
  gem "json"
  gem "activesupport","~>2.8.9"
end

platforms :ruby_19 do
  gem "activesupport","~>3.1.3"
end

但是,在运行bundle install时失败

You cannot specify the same gem twice with different version requirements.
You specified: activesupport (~> 2.8.9) and activesupport (~> 3.1.3)

解决方法

我很确定这是不可行的. gemfile不能具有使用不同版本指定的相同gem.不仅在不同的平台内,甚至不在不同的组中(group_ruby_18,group_ruby_19),然后通过尝试
????bundle install –without group_ruby_18

所以这也会失败.

我之前遇到过这个问题,我找到的唯一解决办法是拥有2个不同的GEMFILES.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读