我如何找出哪个宝石有特定的依赖性?


70

我注释掉了一个宝石,但是“捆绑安装”仍然无法运行。我如何找出哪个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]

宝石文件:http://pastebin.com/9WWMfKtv

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


1
Gemfile.lock通常会向您显示您的依赖关系,但由于捆绑程序未成功完成,因此我不确定它是否已为您生成。
理查德·布朗

Answers:


107

在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 dependency --pipe sys-proctable印刷test-unit --version '>= 2.4.0',但创业板是不是在我的Gemfile之一:grep test-unit Gemfile
Chloe

2
@Chloe可以这样尝试一下:gem依赖sys-proctable --reverse-dependencies,我在命令中添加了反向依赖选项。
fmendez

是! 这样可行!Used by guard-spork-1.2.0 (sys-proctable (>= 0))
Chloe

4
对我来说,它仅在指定-b参数(“ -b-​-both-允许本地和远程操作”)
时才起作用

6
如果未实际安装gem,则此方法不起作用。
马克·里德

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.