I am working on an engine for Rails as a plugin. I would like him to be able to make the necessary changes to the Rails configuration at boot, so that he can define his Gem dependencies as well as add some boot paths.
The plugin init.rb file has access to the configuration object, but it is effectively read-only, you can specify a gem, but it does not matter, the initializer should already be running at this point.
I have this now, requiring a file with a new Rails :: Initializer block as follows:
Rails::Initializer.run do |config|
config.gem "authlogic", :version => ">= 2.0.9"
end
This works, but crowds out any existing configuration in the main application environment. rb.
Maybe I can solve this problem by adding a generator to the engine that adds something to environment.rb that loads the plugin configuration at the right stage, or maybe there is a way to add the file to config / initializers to complete this task. Not sure how best to do it.
source
share