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

后端 未结 3 940
独厮守ぢ
独厮守ぢ 2020-12-24 06:56

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 o

相关标签:
3条回答
  • 2020-12-24 07:11

    With versions:

    Gem.loaded_specs.values.map {|x| "#{x.name} #{x.version}"}
    
    0 讨论(0)
  • 2020-12-24 07:15

    I think the above answers using Gem.loaded_specs.keys show the gems on the "load path".

    However, you originally asked about gems loaded into memory, and this answer may be more helpful.

    0 讨论(0)
  • 2020-12-24 07:21

    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.

    0 讨论(0)
提交回复
热议问题