如何仅从 Gemfile 中查看依赖关系树? [英] How to see the dependency tree just from Gemfile?
问题描述
执行 bundle install
Make sure that `gem install couchbase -v '1.3.3'` succeeds before bundling.
现在,我没有在 Gemfile
中包含这个 gem,所以它来自一些依赖项.我如何确定哪个 gem 依赖于这个 couchbase gem?
Now, i have not included this gem in the Gemfile
, so it's coming from some dependency. How can i figure out which gem is dependent on this couchbase gem?
由于 bundle install
失败并且我没有 Gemfile.lock
来找出这种依赖关系.
Since bundle install
is failing and I don't have Gemfile.lock
to figure out this dependency.
推荐答案
gem dependency
(没有参数)应该显示当前 Gemfile 中的所有 gem 及其依赖项.
gem dependency
(with no args) should show you all gems from current Gemfile with their dependencies.
如果您想找出哪些 gem 使用特定的(或全部)宝石.
You can also do gem dependency -R
(or just dep
instead of dependency
) if you want to find out which gems use specific (or all) gems.
对于更深层次的依赖关系,我会解析第一个 gem 依赖项的输出(可能是正则表达式?),选择 gem 的名称并在每个依赖项上调用 gem dep
,但这只是一个松散的想法.
For deeper dependencies I'd parse output (regex maybe?) of first gem dependencies, pick gem's names and call gem dep
on each of them, but that's just a loose idea.
这篇关于如何仅从 Gemfile 中查看依赖关系树?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!