config.gem and Rake tasks

Hey all,

So currently there's no way to automatically get Rake tasks from your config.gems.

Issue and discussion here:

You'll note that the idea is not to require the environment (in order to figure out what gems the project is using). I'm thinking this could be solved by suggesting the use of a separate initializer for gems (that was my original idea with gems.yml). This way we keep the best of both worlds: a separate file with a clear purpose and the fact that it's Ruby code.

If we do this, then I guess we could just load that initializer (if it exists) passing a config object and figure out which gems are installed and then add their rails/tasks to Rake.



I just put a big comment on the ticket with my thoughts.

Basically, I think preinitializer.rb should be used to activate gems, whether that is manually via the ‘gem’ method, through some call to an initialization-decoupled version of the config.gems code, or some third party tool like GemInstaller.

The rails initialization code should be structured (if it is not already) to process the loaded gems, init files, rake tasks, etc that are already on the load path, regardless of how they got there (it can be any method as long as it is called from preinitializer.rb before any initialization happens).

Thanks, – Chad