如何跟踪和检查捆绑的Ruby gem中的依赖项

时间:2021-08-14 07:16:36

Bundler will automatically install any dependencies for the specified gems, however it doesn't output which dependencies map to which gems in the standard output. That information is useful when one of the dependencies fails the installation.

Bundler将自动为指定的gem安装任何依赖项,但是它不会输出哪些依赖项映射到标准输出中的哪些gem。当其中一个依赖项未能通过安装时,该信息很有用。

Is there a way to set Bundler to be more verbose and inform about the dependencies while installing?

有没有办法将Bundler设置得更详细,并在安装时通知有关依赖项?

I am using Bundler 1.0.2

我使用的是Bundler 1.0.2

2 个解决方案

#1


11  

To see a visual representation of the dependency tree run bundle viz:

要查看依赖关系树的可视化表示,请运行bundle viz:

apt-get install graphviz && gem install ruby-graphviz && bundle viz

It will generate a PNG file of the tree.

它将生成树的PNG文件。

#2


5  

A less exciting, but equally effective way is to just do:

一个不那么激动但同样有效的方法就是:

gem dep

which will generate a Gemfile.lock style output with dependency information. You could pipe this output to less:

这将生成具有依赖项信息的Gemfile.lock样式输出。你可以把这个输出管道减少:

gem dep | less

Or, if you are searching for a failing dependency, you could grep it with some context. For instance, to find out where my failing Thin dependency was coming from (fails with JRuby), I did:

或者,如果您正在搜索失败的依赖项,则可以使用某些上下文进行grep。例如,为了找出我的Thin依赖失败的来源(JRuby失败),我做了:

gem dep | grep -C 15 thin

#1


11  

To see a visual representation of the dependency tree run bundle viz:

要查看依赖关系树的可视化表示,请运行bundle viz:

apt-get install graphviz && gem install ruby-graphviz && bundle viz

It will generate a PNG file of the tree.

它将生成树的PNG文件。

#2


5  

A less exciting, but equally effective way is to just do:

一个不那么激动但同样有效的方法就是:

gem dep

which will generate a Gemfile.lock style output with dependency information. You could pipe this output to less:

这将生成具有依赖项信息的Gemfile.lock样式输出。你可以把这个输出管道减少:

gem dep | less

Or, if you are searching for a failing dependency, you could grep it with some context. For instance, to find out where my failing Thin dependency was coming from (fails with JRuby), I did:

或者,如果您正在搜索失败的依赖项,则可以使用某些上下文进行grep。例如,为了找出我的Thin依赖失败的来源(JRuby失败),我做了:

gem dep | grep -C 15 thin