2 个 gem 需要相同依赖项的不同版本 [英] 2 gems need different versions of the same dependency

查看:23
本文介绍了2 个 gem 需要相同依赖项的不同版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用 Rails 3,我试图找出我认为应该非常简单的东西......

Using Rails 3, I'm trying to figure out what I think should be pretty straightforward...

我有 2 个 gem,它们需要相同 gem 依赖项的 2 个不同版本.两个版本的依赖 gem 都安装在我的系统上,但我仍然从 Rails 收到错误:Bundler 找不到 gem XXX 的兼容版本".

I have 2 gems that require 2 different versions of the same gem dependency. Both versions of the dependent gem are installed on my system but I still get an error from Rails: "Bundler could not find compatible versions for gem XXX".

处理这种情况的最佳做法是什么?

What is the best practice to handle a scenario like this?

推荐答案

我会按照@BaroqueBobcat 的建议去做.我只想补充一点——如果你需要最新的 Twitter gem 并且不能等待 Groupon2 的维护者更新他的 gem——你可以在 GitHub 上 fork Groupon2,更新它的 gemspec,通过运行它的测试看看它是否仍然有效(如果没有,请尝试修复它)并在您的 Gemfile 中使用其 Git URL 包含您自己的版本,如下所示: gem "groupon2", :git => "https://github.com/yourgithubuser/groupon2.git".

I'd go for what @BaroqueBobcat suggests. I just want to add that - if you need the latest Twitter gem and can't wait for the maintainer of Groupon2 to update his gem - you can fork the Groupon2 on GitHub, update its gemspec, see if it still works by running its tests (and try to fix it if it doesn't) and include your own version using its Git URL in your Gemfile like so: gem "groupon2", :git => "https://github.com/yourgithubuser/groupon2.git".

如果你想变得更好,你可以向 Groupon2 的维护者提供你的更改,并请求奖励积分:)

If you want to be nice you can offer your changes to the maintainer of Groupon2 with a pull request for bonus points :)

这篇关于2 个 gem 需要相同依赖项的不同版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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