" gem.add_dependency"为另一个当地的宝石 [英] "gem.add_dependency" for another local gem

查看:81
本文介绍了" gem.add_dependency"为另一个当地的宝石的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个gem,它依赖于另一个发布的gem。
my_gem.gemspec 中,我添加了对其他gem的依赖关系:

gem.add_dependency other_gem,〜> 1.0.0



现在,我发现一个可以在 other_gem ,所以我分叉了存储库,做了我的更改并将其提交给fork(它尚未被拉入原始存储库)。



我的问题是告诉 my_gem 在本地查找 other_gem 吗?以下代码片段无效,因为:path 不是 add_dependency 调用中的一个选项,如宝石规格参考

gem.add_dependencyother_gem,〜> 1.0.0,:path => '/ path / to / local / other_gem

解决方案

您可以包括:

  gemother_gem,:path => '/ path / to / local / other_gem'



  gemother_gem,:git => git@github.com:/your_github/other_gem.git

在您的gem文件中,因为这应该覆盖gemspec


I am creating a gem, which has a dependency on another published gem. In my_gem.gemspec, I have added the dependency to the other gem:

gem.add_dependency "other_gem", "~> 1.0.0"

Now, I found a feature that can be tweaked in other_gem, so I forked the repository, made my changes and committed it to the fork (It has not been pulled into the original repository).

My question is how do I tell my_gem to lookup other_gem locally? The below code snippet is not valid, as :path is not an option in add_dependency call, as mentioned in Gem Specification Reference:

gem.add_dependency "other_gem", "~> 1.0.0", :path => '/path/to/local/other_gem

解决方案

Locally it's much easier: while you're doing development, you can include:

gem "other_gem", :path => '/path/to/local/other_gem'

or

gem "other_gem", :git => "git@github.com:/your_github/other_gem.git"

in your gemfile, as this should override the gemspec

这篇关于" gem.add_dependency"为另一个当地的宝石的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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