ruby-on-railsrubyrubygemsbundler

How do I figure out which gem(s) caused a particular gem to be bundled?


Is there a simple (Bundle?) command to determine which gem(s) caused a particular gem to be bundled and added to my Gemfile.lock?

There are one or two similar questions but they only seem to address the general problem of figuring out which gems out there depend on a given gem.

Another question is the closest to this one but it's overly specific and didn't get a good general answer.

Eventually I found the info I was after using bundle viz and eyeballing the resulting image until I found it and traced it back to its parent but it seems like something bundle should be able to tell me with a one line command.

I also tried grep -r rest-client ~/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0 which kind of told me but the results were messy and also included a bunch of other gems that weren't from this particular app.

Is there a simpler way for next time?


Solution

  • Normally Gemfile.lock documents which dependencies were generated from other dependencies, it's listed in a rough tree form, but you may have to do some digging to get to the right spot.