Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get list of gems being used by a Bundler project

Tags:

ruby

bundler

gem

Is there a way to get the list of gems or paths to gems that are being loaded for the current project by Bundler (it's a Rails 3) project.

I'm looking for something like:

Gem.path

but that returns only the ones being actively required by Bundler in the Gemfile.

like image 462
pupeno Avatar asked Nov 16 '10 15:11

pupeno


People also ask

Where are bundler gems installed?

As a result, bundle install --deployment installs gems to the vendor/bundle directory in the application. This may be overridden using the --path option.

Where does Ruby bundler install gems?

--path vendor/bundle : install gems to the vendor/bundle project directory. In this case, Bundler adds the . bundle/config file to a project's root. RubyMine processes this configuration file to detect that gems are installed into vendor/bundle.

How do I get Gemfile?

A gemfile is automatically created when you start a new rails application. type rails new appName and then it will be generated automatically. It will also be populated with some gems.

What is Gemfile for?

A Gemfile is a file that is created to describe the gem dependencies required to run a Ruby program. A Gemfile should always be placed in the root of the project directory.


1 Answers

What I was looking for was this:

Gem.loaded_specs.values.map { |g| g.full_gem_path }
like image 145
pupeno Avatar answered Oct 15 '22 09:10

pupeno