Load plugins from an external folder

How to load plugins which aren’t in the folder vendor/plugins (in my
case in another rails project)

regards

i did it in that way, adding this to environment.rb :

plug_dir = Dir.new("#{RAILS_ROOT}/…/other_rails_dir/vendor/plugins")
plug_dir.entries.each do |plug|
%w(. …).include?(plug) && next
path = File.join(plug_dir.path, plug)
if(File.directory?(path))
$: << File.join(path, ‘lib’)
require File.join(path, ‘init’)
end
end

someone has a simplier solution?

not sure about plugins… but gems can be accessed using following:

ENV[‘GEM_HOME’]=’/usr/lib/ruby/gems/1.8’
ENV[‘GEM_PATH’]=’/home/ckh/gems’
in dispatch.fcgi

ENV[‘GEM_HOME’] is default gem path and second option is for custom
one…

you can try same for plugins… but not 100% sure

Ajit

Jean-sébastien Jney wrote:

How to load plugins which aren’t in the folder vendor/plugins (in my
case in another rails project)

regards

try

environment.rb

Rails::Initializer.run do |config|
config.plugin_paths += [“#{RAILS_ROOT}/other/path/to/plugins”]
end

see freddy cheung’s blog post about it

http://www.texperts.com/2007/06/21/on-sharing-code-between-rails-apps/

On Jun 20, 9:51 pm, Matthew R. Jacobs <rails-mailing-l…@andreas-
s.net> wrote:

see freddy cheung’s blog post about it

钛刻专家——官网

damn you matthew, pimping my own blog posts before I get round to
it ! :slight_smile:

Fred