Rails Bundle - 一颗宝石两个版本

发布于 2024-12-27 14:22:37 字数 567 浏览 2 评论 0原文

我有旧的 Rails 应用程序。并且这个应用程序需要不同版本的相同 gem。

例如,它现在使用

gem 'actionmailer' 2.3.5 和 'actionmailer' 2.3.2 gem 'actionpack', '2.3.5' 和 'actionpack', '2.3.2'

不要问我为什么 =) 这是旧应用程序,而且非常庞大。当前的 Rails 版本 2.3.5

现在我尝试使用 Bunler 进行 Gems 控制。但 Bundler 不允许在配置中使用同一个 gem 两次。或者我可以看到这样的错误:

Bundler 找不到 gem“actionpack”的兼容版本:在 宝石文件: datanoise-actionwebservice (= 2.3.2) ruby​​ 依赖于 动作包(= 2.3.2)红宝石

rails (= 2.3.5) ruby​​ 依赖于
  动作包 (2.3.5)

​​ 那么,我是否可以解决这个问题并且我不能使用 Bundler?

I have old rails application. And this application need the same gem with different versions.

For example, it use now

gem 'actionmailer' 2.3.5 and 'actionmailer' 2.3.2
gem 'actionpack', '2.3.5' and 'actionpack', '2.3.2'

Dont ask me why =) This is old app and very massive. Current rails version 2.3.5

Now i try to use bundler for my gems control. But Bundler can`t allows use one gem twice in config. Or i can see error like this:

Bundler could not find compatible versions for gem "actionpack": In
Gemfile:
datanoise-actionwebservice (= 2.3.2) ruby depends on
actionpack (= 2.3.2) ruby

rails (= 2.3.5) ruby depends on
  actionpack (2.3.5)

So, can i solve this problem or not and i can`t use Bundler?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

小红帽 2025-01-03 14:22:37

不可以,您必须将 datanoise-actionwebservice 升级到版本 2.3.5,或将 rails 降级到 2.3.2。

如果可能的话,我建议升级datanoise-actionwebservice

No, you must either upgrade your datanoise-actionwebservice to version 2.3.5, or downgrade your rails to 2.3.2.

I suggest upgrading the datanoise-actionwebservice if possible.

负佳期 2025-01-03 14:22:37

datanoise-actionwebservice 似乎对其 gemspec 中的 actionpack 和 activerecord 版本有非常(可能太)限制。但是我看到它在内部尝试使用 '>= 2.3.0' 版本加载这些 gem(请参阅 lib/action_web_service.rb)。

我建议尝试分叉这个 gem 并修补它的 gemspec,因此 actionpack 和 activerecord 的版本要求更改为 '>= 2.3.2'。

然后更新项目的 Gemfile 以使用修补版本:

gem 'datanoise-actionwebservice', :git => "http://github.com/youraccount/actionwebservice.git"

希望它也适用于 2.3.5。

datanoise-actionwebservice seems to be very (probably too) restrictive about actionpack and activerecord versions in it's gemspec. However I see that internally it tries to load these gems with '>= 2.3.0' versions (see lib/action_web_service.rb).

I'd suggest trying forking this gem and patching it's gemspec, so the version requirements for actionpack and activerecord are changed to '>= 2.3.2'.

Then update your project's Gemfile to use the patched version:

gem 'datanoise-actionwebservice', :git => "http://github.com/youraccount/actionwebservice.git"

Hopefully it will work with 2.3.5 as well.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文