Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

[PATCH] config.gem_paths

#2834

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.

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

State: hold
Milestone: 3.0.2
Assigned to: Matt Jones Matt Jones
Importance: High

Activity

  1. Michael Koziarski
    Michael Koziarski
    • Assigned user set to Matt Jones
    • Milestone changed from 2.x to 2.3.4

    June 26th, 2009 @ 06:07 AM

  2. Yehuda Katz (wycats)
    Yehuda Katz (wycats)
    • State changed from new to hold
    • Tag changed from 2-3-stable, config, configuration, gem, gem.config, gems, load_paths, patch, vendor to initializer, paths, rubygems
    • Milestone cleared.

    We're going to be reworking the way gems work for Rails 3 that will make this quite trivial to implement, so we're putting it on hold for now.

    July 2nd, 2009 @ 07:10 PM

  3. Jeremy Kemper
    Jeremy Kemper
    • Milestone set to 3.0.2
    • Importance changed from to High

    October 15th, 2010 @ 11:01 PM