# How do you use the 'vendor' directory with 3rd party librari

**URL:** <https://www.ruby-forum.com/t/how-do-you-use-the-vendor-directory-with-3rd-party-librari/59457>\
**Category:** Rails\
**Created:** [May 3, 2006, 7:07pm UTC](https://www.ruby-forum.com/t/how-do-you-use-the-vendor-directory-with-3rd-party-librari/59457 "2006-05-03T19:07:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![matthew\_d](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/48db29/32.png) [@matthew\_d](https://www.ruby-forum.com/u/matthew_d)\
**Post date:** [May 3, 2006, 7:07pm UTC](https://www.ruby-forum.com/t/how-do-you-use-the-vendor-directory-with-3rd-party-librari/59457/1 "2006-05-03T19:07:13Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![matthew\_d](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/48db29/32.png) [@matthew\_d](https://www.ruby-forum.com/u/matthew_d)\
**Post date:** [May 4, 2006, 2:00am UTC](https://www.ruby-forum.com/t/how-do-you-use-the-vendor-directory-with-3rd-party-librari/59457/2 "2006-05-04T02:00:56Z")

</div>

I have a similar problem. I am trying to use the ferret gem on a  
shared hosting account. I can’t install any gems, so I did a “gem  
unpack ferret” in my “vendor” directory.

I get the same error message as Matthew, except with “ferret” not being  
found.

---

<div class="post-metadata">

**Author:** ![matthew\_d](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/48db29/32.png) [@matthew\_d](https://www.ruby-forum.com/u/matthew_d)\
**Post date:** [May 4, 2006, 3:27pm UTC](https://www.ruby-forum.com/t/how-do-you-use-the-vendor-directory-with-3rd-party-librari/59457/3 "2006-05-04T15:27:17Z")

</div>

On 5/4/06, Nithin R. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I have a similar problem. I am trying to use the ferret gem on a  
> shared hosting account. I can’t install any gems, so I did a “gem  
> unpack ferret” in my “vendor” directory.
> 
> I get the same error message as Matthew, except with “ferret” not being found.

I’ve got it working for the PDF writer stuff. I had to ensure that  
the paths were on the config.load\_paths:

Rails::Initializer.run do |config|

# Settings in config/environments/\* take precedence those specified

here

# We have several components that are used in the ‘vendor’ directory.

# So we need to add the appropriate load paths.

config.load\_paths += [‘color-tools’, ‘pdf-writer’].collect {  
|vendor| “#{ RAILS\_ROOT }/vendor/#{ vendor }/lib” }  
end

To my config/environment.rb. This gets it working for me, maybe it’ll  
help you.

Matt
