The Power of Vendor/Gems

Right now, I’m heavily reliant on an unsupported (if not completely abandoned) ruby gem library. Historically, I’ve just gem install bizarro-gem and moved on.

A couple of issues have changed my perspective:

  • My host, textdrive, doesn’t allow installing bizarro gems on their shared servers and I’ve had difficulty freezing them, so I worked around the desired functionality.
  • I needed to make some modification to the library. Not easy to do if it’s installed system wide.

Thankfully, I found Chris Wanstrath’s Vendor Everything , his post makes it trivial to freeze gems in a reliable, testable, hackable way.

The core of Chris’s technique is added this line to your block:
config.load_paths += Dir["#{RAILS_ROOT}/vendor/gems/**"].map do |dir| = "#{dir}/lib") ? lib : dir

And unpack the required gems into vendor/gems

With that, I was able to make the necessary modifications and make a more portable app.

Thanks Chris.