Gemfile contains the list of all the gems used in a rails app, how can i get a list of all the gems along with their dependency gems ?
Gemfile.lock can give a list of all the gems along with their dependency gems for each gem. However, the list contains duplicate entries for the gems if a gem is a dependency of more than one gem. Here is a sample from my Gemfile.lock where activesupport (= 4.2.5)
is a dependency of two different gems actionview (4.2.5)
and activejob (4.2.5)
.
actionview (4.2.5)
activesupport (= 4.2.5)
builder (~> 3.1)
erubis (~> 2.7.0)
rails-dom-testing (~> 1.0, >= 1.0.5)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
activejob (4.2.5)
activesupport (= 4.2.5)
globalid (>= 0.3.0)
The list in question can be extracted from filtering out these duplicate entries from the file. But then that's a lot of work if there are say 50 gems in my app. I am looking if someone has figured out a better solution.
Also is there a way to figure out which of these gems from the list are actually used in the application and which are just there bloating the application ?
My goal is to cleanup an old app that has some unused gems.