How can I develop two gems together with Bundler?

馋奶兔 提交于 2019-12-11 12:37:28

问题


I am developing two gems, let's call them foo and bar. Also foo has a runtime dependency on bar. I am developing both these gems with bundler.

How can I specify bar as a dependency of foo and have bundler resolve that dependency to a local path, without polluting my Gemfile? At the moment the only way I can see to do this is to put gem "bar", path: "path/to/bar" in foo's Gemfile, and remove it once bar is on rubygems, but this solution is obviously unsatisfactory as it will break on anybody else's machine until that date.


回答1:


It is not clear if the dependency is runtime or compile time.

Have you tried installing bar using the local .gem file? Once installed in GEM_HOME, your foo gem should detect it

cd /path/to/bar
rake install

then

cd /path/to/foo
rake build



回答2:


You can specify the dependency as a git branch, and then map it to a local path using the instructions here: http://ryanbigg.com/2013/08/bundler-local-paths/



来源:https://stackoverflow.com/questions/19761326/how-can-i-develop-two-gems-together-with-bundler

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