Hi,
I’m wondering how to use the ‘vendor’ directory in a Rails app. I
know that you can put plugins and engines into the ‘vendor/plugins’
directory and that svn:externals can be used for that, but I was
wondering how & where I put a 3rd party library? My specific case is
the pdf-writer code, which I’d rather have inside my app than as a
Ruby gem (for no particular reason).
What I’ve done is put the following into the svn:externals for the
‘vendor’ directory:
pdf-writer svn://rubyforge.org/var/svn/ruby-pdf/tags/v1-1-3/pdf-writer
color-tools
svn://rubyforge.org/var/svn/ruby-pdf/tags/version-1-3-0/color-tools
I’ve then done a ‘svn update’ and got the code (so now I have
‘vendor/pdf-writer’ and ‘vendor/color-tools’) but when I run the
‘script/server’ I simply see:
=> Booting WEBrick…
So I ran ‘script/console’ to see what was going on and I get:
Loading development environment.
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in
require__': no such file to load -- pdf/writer (MissingSourceFile) from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in
require’
from
/usr/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:147:in
require' from ./script/../config/../config/../lib/pdf_render.rb:1 from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in
require’
from
/usr/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:147:in
require' from ./script/../config/../config/environment.rb:18 from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in
require’
from /usr/lib/ruby/1.8/irb/init.rb:252:in load_modules' from /usr/lib/ruby/1.8/irb/init.rb:250:in
load_modules’
from /usr/lib/ruby/1.8/irb/init.rb:21:in setup' from /usr/lib/ruby/1.8/irb.rb:54:in
start’
from /usr/bin/irb:13
m
This code was working with the pdf-writer installed as a Ruby gem so I
know it’s right, so it must be either (a) me putting those
svn:externals in the wrong place, (b) me missing something in the
configuration setup, © me completely missing the point of the vendor
directory and what code can go there. Do I have to explicitly add the
‘vendor/pdf-writer’ and ‘vendor/color-tools’ to the require path or
something?
Any help much appreciated, particular a pointer to a webpage that
explains this (which I’ve yet to find).
Matt