1 min read

Parsing a Gemfile

Parsing a Gemfile programmatically to find out what it contains
Parsing a Gemfile
Photo by Jason D / Unsplash

Parsing a Gemfile programmatically to find out what it contains.

It's easy to look at the gems you currently have loaded in the current runtime but if you need to read some other Gemfile and inpect its contents then this works:

gems = Bundler::Definition.build('Gemfile', nil, {}).dependencies