Discussion Forums
- Topic List
- Most Recent Posts
- Sign In for more options
I have an executable program in my application root and that needs to access couple of gems from vendor/gems folder in my app. The reason I need to have these gems in there is I cannot install new gems on my server and I need to have them in vendor folder.
Can someone please let me know how can I point to that folder and not to a file in that folder. Thank you.
You can stick this in environment.rb (or in a configuration initializer), and then you can just do require 'nameofgem' as usual. Note that this assumes that your executable loads the Rails environment.
# This loads gems from vendor/gems/
# (see http://errtheblog.com/posts/50-vendor-everything):
config.load_paths += Dir["#{RAILS_ROOT}/vendor/gems/**"].map do |dir|
File.directory?(lib = "#{dir}/lib") ? lib : dir
end
If you run this program from command line, try passing the "-I" option:
ruby -I vendor/gems/a:vendor/gems/b foo.rb
Hi everyone, Thank you all.
Jordi, thank you so much. Your suggestion worked. I am really grateful to you all.
