How to override gem dependency?

笑着哭i 提交于 2019-12-05 07:16:04

The standard advise is to use the higher version compatible.

I do this way, but I think bundler has a defined command for it.

First remove the line of gem 'omniauth' at your Gemfile. Run bundle install, then you must add again the line with gem 'omniauth' to your Gemfile, run bundle install again.

If you look at Gemfile.lock, this install hashie 2.0.5, the higher compatible.

edited: why it works?

First I check omniauth dependencies with hashie: hashie < 4, >= 1.2, then the same with restforce: hashie < 2.1, >= 1.2.0. At this point, I know that any version of hashie between 1.2 and 2.0.x must work. Then we must to remove the constraint at Gemfile.lock of continue using hassie 3.3.1, removing 'omniauth' from Gemfile it's done. After that, when install restforce, the bundler find the new version compatible with restforce '2.0.5'. And when you add again omniauth bundler don't update dependencies that are accomplished.

I think bundle update is actually what you were after. That sorts out dependencies and installs different versions of gems if required, giving you the most up-to-date gems possible.

Be careful however, as updating gems can introduce compatibility issues.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!