In Gemfile:
gem 'gemfile_interpreter'
Or global:
gem install gemfile_interpreter
Example for JSON output:
gemfile_interpreter /path/to/project/to/check
Example for YAML output:
gemfile_interpreter /path/to/project/to/check --yaml
See gemfile_interpreter -h
interpreter = GemfileInterpreter.new('/path/to/project/to/check')
# => gemfile = 'Gemfile, lockfile = 'Gemfile.lock'
interpreter.parsed # => list of gems
# custom Gemfile
GemfileInterpreter.new('/path/to/project/to/check', gemfile: 'MyGemfile')
# => gemfile = 'MyGemfile, lockfile = 'MyGemfile.lock'
# custom Gemfile and Gemfile.lock
GemfileInterpreter.new('/path/to/project/to/check', gemfile: 'MyGemfile', lockfile: 'MyLockfile')
# => gemfile = 'MyGemfile, lockfile = 'MyLockfile'