Isolate for Rails Apps

| | Comments (0)

I work on a lot of stuff. I'd rather have my laptop's gem installs be for my stuff, not my work stuff. I'd especially rather not deal with the version mess you get into when you've got several different rails apps. Isolate makes this incredibly easy. With just one gem system-installed, you can make every project completely standalone:

A New Rails App:

% rails blah

You can use isolate with just two files in your rails app. You just add the following:

config/preinitializer.rb

ENV['RAILS_ENV'] ||= 'development' # le sigh

require 'config/gems'

config/gems.rb

require "rubygems"
require "isolate"

Isolate.gems "vendor/isolated" do
  gem "rails", "= 2.0.2"

  environment :development do
    gem "vlad"
    gem "sqlite3-ruby"
  end

  environment :test do
    gem "minitest"
  end
end

and then...

% rake -t
(in /Users/ryan/blah2)
[1/3] Isolating rails (= 2.0.2).
[2/3] Isolating vlad (>= 0).
[3/3] Isolating sqlite3-ruby (>= 0).
Building native extensions.  This could take a while...
%

That's it! It has really made my work a lot easier! I don't have to deal with umpteen different dependencies that I'll never use on another project. I never need to have unknown artifacts breaking stuff. Everything is very cleanly documented within the Isolate.gems block. I love isolate. You should check it out if you haven't already.

Leave a comment

About this Entry

This page contains a single entry by zenspider published on February 4, 2010 2:17 PM.

rdoc_osx_dictionary version 1.2.0 has been released! was the previous entry in this blog.

rdoc_osx_dictionary version 1.3.0 has been released! is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.

Pages

Powered by Movable Type 4.32-en