This project is archived and is in readonly mode.

#2834 ✓hold
dreamcat4 (at gmail)

[PATCH] config.gem_paths

Reported by dreamcat4 (at gmail) | June 24th, 2009 @ 11:33 PM | in 3.0.2

This is a patch to allow configurable search paths for gems in addition to the vendor/gems directory. However this is rather tricky to add because there seems to be 3 main times when rails will want to load up and work with vendor/gems.

1) the Rake tasks to freeze / unfreeze gems
2) the Rails startup code in the very beginning, will try to load once the gems
3) the time after environment.rb and after the config,gem in run initializer do |config|.

So far I have succeeded in doing muliple paths for 3), but not 1) and 2).

Its basically an equivalent of config.plugin_paths for plugins (which is already in rails).
I can put in my environment.rb a configuration line like this:

config.gem_paths = ["#{PLUGIN_PATH}/vendor/gems", "gem_path2", "gem_path3"]

However this setting the load paths is happen too late in the environment.rb file, for the rake tasks. The problem is that these rake tasks and early initialization code don't read the environment.rb file so am finding the gems management code a little too complex to be able to accomodate this one.

There are other plans to re-think the gem code (ticket #1721). This patch is to work right now in the rails 2.3 gems code. Ideally i'd like to convert my patch to a separate file (monkey-patch) that could be installed in the app's config directory, instead of touching the rails source files.

This patch wont interfere the operation of any standard rails app which stores its gems in vendor/gems. This default load path is preserved. For a multi-path app, it may generate some warnings / error for the rake tasks. Runtime behaviour should be fine but no tests.

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Attachments

Referenced by

Pages