2

I'd like to enumerate the paths for all of the plugins in a Rails application. Essentially #{RAILS_ROOT}/vendor/plugins/*, but that does not include plugins provided by gems, or specified explicitly, et cetera.

I've found one solution which I'll provide in an answer so you can vote for it, but it's pretty ugly. (Is that the proper etiquette?)

1 Answer 1

1
# really what we want is a reference to the Initializer used in
# config/boot.rb.  But since we can't monkey patch that file, we'll
# use a fake instead.

class FakeInitializer
  attr_reader :configuration

  def initialize(config = Rails.configuration)
    @configuration = config
  end
end

init = FakeInitializer.new(Rails.configuration)
Rails.configuration.plugin_loader.new(init).plugins.map &:directory
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.