Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any way to tell which gems and plugins are loaded at runtime for a Rails process?

Is there any command either in debugger or ruby-debug to get a list of all gems and/or plugins loaded in memory for a Rails process? I understand only the 'require' gems are loaded but I would like to quickly see what got loaded during runtime.

like image 961
Chirag Patel Avatar asked Apr 30 '10 22:04

Chirag Patel


People also ask

Can you console log in rails?

One of the best tools in a rails developers arsenal is the rails console, being extremely useful for brainstorming, debugging, and testing. Having it log active record queries directly to the console can improve readability and convenience over looking through the development logs to see what SQL queries have been run.

What are plugins in Ruby?

Plugins provide: A way for developers to share bleeding-edge ideas without hurting the stable code base. A segmented architecture so that units of code can be fixed or updated on their own release schedule. An outlet for the core developers so that they don't have to include every cool new feature under the sun.

How do you exit a debugger in rails?

You can exit the debugging session at any time and continue your application execution with the continue (or c ) command. Or, to exit both the debugging session and your application, use the quit (or q ) command.


2 Answers

This should get you everything loaded through rubygems:

Gem.loaded_specs.keys 

I don't know of a universal way to see which rails plugins are loaded, you can look at the source for Rails::Initializer (pre 3.0) & figure out what your version of rails is doing. Hopefully you know which plugins should be loading & can confirm that from the console when debugging.

like image 122
jdeseno Avatar answered Sep 18 '22 18:09

jdeseno


With versions:

Gem.loaded_specs.values.map {|x| "#{x.name} #{x.version}"} 
like image 26
dmd Avatar answered Sep 19 '22 18:09

dmd