如何找出哪个 gem 具有特定的依赖项?

我注释掉了一个 gem,但是‘ bundle install’仍然不能运行。如何找出哪个 gem 依赖于 sys-proctable?

$ bundle install
Fetching gem metadata from https://rubygems.org/.........
Fetching gem metadata from https://rubygems.org/..
Resolving dependencies...
Could not find sys-proctable-0.9.2 in any of the sources


$ grep proctable Gemfile
#gem 'sys-proctable', '0.9.2', :path => "vendor/gems"


$ bundle list
Resolving dependencies...
Could not find gem 'rspec-rails (= 2.11.0) ruby' in the gems available on this machine.


$ bundle viz
Resolving dependencies...
Could not find gem 'rspec-rails (= 2.11.0) ruby' in the gems available on this machine.


$ bundle -v
Bundler version 1.3.0


$ ruby -v
ruby 1.9.3p385 (2013-02-06 revision 39114) [i386-cygwin]

Gemfile: http://pastebin.com/9WWMfKtv

我已经尝试了以下故障排除步骤: https://github.com/carlhuda/bundler/blob/1-2-stable/ISSUES.md

34028 次浏览

在 bash shell 中,您可以这样做:

gem dependency name_of_the_gem --reverse-dependencies

例如:

$ gem dependency activesupport --reverse-dependencies
Gem activesupport-2.3.14
Used by
actionpack-2.3.14 (activesupport (= 2.3.14))
activerecord-2.3.14 (activesupport (= 2.3.14))
activeresource-2.3.14 (activesupport (= 2.3.14))

我知道这个答案包括一个链接,但这不是一个链接特定的答案

您总是可以检查 gem 对 Rubygems.org的相反依赖关系。在网站的右侧面板上有一个链接。

enter image description here

或者你可以访问这个网站

https://rubygems.org/gems/{gem_name}/reverse_dependencies

对你来说

Https://rubygems.org/gems/sys-proctable/reverse_dependencies

如何找出哪个 gem 依赖于 sys-proctable?

尝试 为什么插件(灵感来自 yarn why)

bundler plugin install bundler-why
bundle why tzinfo
# ransack -> activesupport -> tzinfo
# rspec-rails -> activesupport -> tzinfo
# business_time -> tzinfo

gem dependency --reverse-dependencies将遍历 路径的一个 边缘。相比之下,bundle why将遍历所有边。