How to see the dependency tree just from Gemfile?

寵の児 提交于 2019-12-18 10:38:53

问题


I am getting the following error when doing bundle install

Make sure that `gem install couchbase -v '1.3.3'` succeeds before bundling.

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?

Since bundle install is failing and I don't have Gemfile.lock to figure out this dependency.


回答1:


gem dependency (with no args) should show you all gems from current Gemfile with their dependencies.

Edit:

You can also do gem dependency -R (or just dep insted of dependency) if you want to find out which gems use specific (or all) gems.

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.




回答2:


You can also use bundler to create a dependency graph.

Install graphviz:

gem install ruby-graphviz

and then:

bundle viz

Here are an example of a newly created Rails app:

You can also play with the options:

bundle help viz 


来源:https://stackoverflow.com/questions/19050654/how-to-see-the-dependency-tree-just-from-gemfile

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!