Depending on your vendor directory
RubyGems are great for local development, making it easy to stay on top of things, such as when your favorite libraries are updated.
But when you’re getting ready to deploy your application, you want to keep everything in sync. Chances are that we may not have installed the BizarroGem on the TextDrive Shared servers, or if we have, there’s no guarantees that we’re using the same version as you are, since we don’t run gem update every day.
But there’s a simple solution; the almighty vendor/ dir in your rails application root. It’s added to the $LOAD_PATH (where ruby looks for files to require) when Rails is loaded.
We like to recommend sticking your external dependencies in there, for the BizarroGem we could put it in vendor/bizarro_gem and load it from the environment, or some other suitable place, with a simple
require 'bizarrogem/bizarro_gem'
Not only are you keeping your dependencies easily in sync between your production and development server, you’re also sure that everyone else working with you are using the same version of everything when it comes to external libs. And you can easily keep everything in Subversion to track changes, making the deployment a breeze.
If you don’t want to dig up the gem source directory on your system (usually in /usr/local/lib/ruby/gems/1.8/gems/) you can use the unpack feature of Rubygems, just type:
$ gem unpack BizarroGem
and it’ll “unpack” the installed gem into the current directory.
This is the approach we took when building Strongspace. For instance, we were using Lucas’ credit card validation gem at first.
But it had some namespace clashes with some of our code, so we copied it into our vendor/ dir, renamed the clashing class (we could also have put it in it’s own module, but a simple rename was easier). A svn up later and everyone on the development team was validating creditcards like there was no tomorrow.
RubyGems is a sweet system for packaging, but for deployment, local dependency installs run anywhere irrespective of whether or not the gem is installed.
·:· Posted 4 November 2005, 08:40 by Johan Sørensen to Rails |

I must have done something wrong before because after:
running
gem unpack RedCloth -v '3.0.3'in the vendor diradding
require 'RedCloth-3.0.3/lib/redcloth'to environment.rbsvn add, commit and updateeverything works like a charm.Thanks!
— Thomas Maas 4 November 2005, 12:22 #
— victor 4 November 2005, 12:29 #
— Thomas Maas 4 November 2005, 12:31 #
So you’ll have to stick the redcloth.rb directly in vendor/ (and not in a subdir) so that Rails loads that one over the gem..
Redcloth has a VERSION constant you can look at to see what version is loaded (launch the ./script/console and type RedCloth::VERSION)
— johan 4 November 2005, 18:51 #
Sure thing, if you can’ install it locally, put in a support ticket and we’ll probably install it.
— Michael Koziarski 4 November 2005, 19:48 #
— Markus 8 November 2005, 16:50 #
Yes you can install rails into the vendor directory, this is described under ‘EdgeRails’: http://wiki.rubyonrails.com/rails/pages/EdgeRails
They are referring to running rails from the SVN trunk, but you could put any version you want…
— Patrick Ritchie 8 November 2005, 21:49 #
vendor/rails/actionmailer
vendor/rails/actionpack
vendor/rails/actionwebservice
vendor/rails/activerecord
vendor/rails/activesupport
vendor/rails/railties
— johan 8 November 2005, 21:51 #
Reading http://wiki.rubyonrails.com/rails/pages/UnderstandingHowRequestsAreRouted also helped me to understand why this approach can work.
— Markus 9 November 2005, 16:37 #