• Stars
    star
    249
  • Rank 162,987 (Top 4 %)
  • Language
    Ruby
  • Created about 15 years ago
  • Updated 5 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Gem segregation.

Isolate¶ ↑

home

github.com/jbarnette/isolate

Description¶ ↑

Isolate is a very simple RubyGems sandbox. It provides a way to express and automatically install your project’s Gem dependencies.

Wha?¶ ↑

When Isolate runs, it uses GEM_HOME, GEM_PATH, and a few other tricks to separate your code from the system’s RubyGems configuration, leaving it free to run in blissful solitude.

Isolate is very, very, very stupid simple. For a much more full-featured Gem bundler, check out Yehuda Katz and Carl Lerche’s Bundler: It does a lot of fancy AOT dependency resolution, supports non-gem (including git) resources, and is probably a better fit for you.

Requirements¶ ↑

RubyGems 1.8.2 or better, Ruby 1.8.7 or better.

Getting Started¶ ↑

Rails 2¶ ↑

In config/preinitializer.rb:

require "rubygems"
require "isolate/now"

In Isolate:

gem "rails", "2.3.5"
gem "aasm",  "2.0.0"

env :development, :test do
  gem "sqlite3-ruby", "1.2.5"
end

env :production do
  gem "memcached", "0.19.2"
end

Try running rake environment. Before anything else happens, Isolate will make sure you have copies of every gem you need (extend the example above to cover all your dependencies). If they’re already installed on your system Isolate will use them, otherwise a private copy will be installed under tmp/isolate.

Rails 3¶ ↑

In config/boot.rb:

require "rubygems"
require "isolate/now"

Construct your Isolate file as above. Be sure to remove any references to Bundler.setup and Bundler.require from config/boot.rb and config/application.rb.

Don’t forget to require files from your isolated gems in the appropriate places. Unlike bundler isolate does not automatically require any files.

Sinatra, Rack, and Anything Else¶ ↑

There’s nothing special about Rails, it’s just an easy first example. You can use Isolate with any library or framework by simply putting an Isolate file in the root of your project and requiring isolate/now as early as possible in the startup process.

When you’re starting up, Isolate tries to determine its environment by looking at the ISOLATE_ENV, RACK_ENV, and RAILS_ENV env vars. If none are set, it defaults to development.

Library Development¶ ↑

If you’re using Hoe to manage your library, you can use Isolate’s Hoe plugin to automatically install your lib’s development, runtime, and test dependencies without polluting your system RubyGems, and run your tests/specs in total isolation.

Assuming you have a recent Hoe and Isolate is installed, it’s as simple as putting:

Hoe.plugin :isolate

before the Hoe.spec call in your Rakefile.

If you’re not using Hoe, you can use an Isolate.now! block at the top of your Rakefile. See the RDoc for details.

Rake¶ ↑

Isolate provides a few useful Rake tasks. If you’re requiring isolate/now, you’ll get them automatically when you run Rake. If not, you can include them by requiring isolate/rake.

isolate:env¶ ↑

This task shows you the current Isolate settings and gems.

$ rake isolate:env

     path: tmp/isolate/ruby-1.8
      env: development
    files: Isolate

  cleanup? true
  enabled? true
  install? true
multiruby? true
   system? true
  verbose? true

[all environments]
gem rails, = 2.3.5
gem aasm, = 2.0.0

[development, test]
gem sqlite3-ruby, = 1.2.5

[production]
gem memcached, = 0.19.2

isolate:sh¶ ↑

This task allows you to run a subshell or a command in the isolated environment, making any command-line tools available on your PATH.

# run a single command in an isolated subshell
$ rake isolate:sh['gem list']

# run a new isolated subshell
$ rake isolate:sh

isolate:stale¶ ↑

This task lists gems that have a more recent released version than the one you’re using.

$ rake isolate:stale
aasm (2.0.0 < 2.1.5)

Further Reading¶ ↑

require "isolate/now" is sugar for Isolate.now!, which creates, configures, and activates a singleton version of Isolate’s sandbox. Isolate.now! takes a few useful options, and lets you define an entire environment inline without using an external file.

For detailed information on Isolate.now! and the rest of the public API, please see the RDoc.

Not Gonna Happen¶ ↑

  • Autorequire. Unlike config.gems or other solutions, Isolate expects you to be a good little Rubyist and manually require the libraries you use.

  • Support for Git or other SCMs. You’re welcome to write an extension that supports ‘em, but Isolate itself is focused on packaged, released gems.

Installation¶ ↑

$ gem install isolate

Meta¶ ↑

RDoc

rubydoc.info/gems/isolate/frames

Bugs

github.com/jbarnette/isolate/issues

IRC

#isolate on Freenode

Mailing List

[email protected]

License¶ ↑

Copyright 2009-2010 John Barnette, et al. ([email protected])

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ‘Software’), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED ‘AS IS’, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

More Repositories

1

johnson

Johnson wraps JavaScript in a loving Ruby embrace.
Ruby
466
star
2

pinglish

A simple Rack middleware for checking application health.
Ruby
158
star
3

pastejour

Broadcast standard out.
Ruby
66
star
4

vlad-git

Git support for Vlad.
Ruby
65
star
5

intercession

Your session loves you.
Ruby
50
star
6

watchable

A simple event/notification mixin for Ruby.
Ruby
40
star
7

herogit

DON'T YOU KNOW WHO I AM?!
Ruby
34
star
8

hoe-git

A Hoe plugin for tighter Git integration.
Ruby
25
star
9

stateful

Give an object or class stateful behavior.
Ruby
22
star
10

gchart

Exposes the Google Chart API via a friendly Ruby interface.
Ruby
22
star
11

dr-nic-magic-awesome

Magically fix your projects overnight!
18
star
12

dotfiles

Bash, Emacs, and various other configs.
Shell
15
star
13

hooky

Write Git hooks in your Rakefile.
Ruby
14
star
14

house-styles

A collection of coding style guides. Fork and add your own!
Ruby
14
star
15

hoe-debugging

A Hoe plugin to help you fix your broken codes.
Ruby
13
star
16

configlet

Configuration mismanagement.
Ruby
12
star
17

lunr

A read-only model layer for Sunspot and Solr.
Ruby
12
star
18

lather

Lather rinses and repeats.
Ruby
9
star
19

castigate

Abuse every revision of a Ruby/Rails project.
Ruby
8
star
20

insinuate

Broken. Two bits of delicious information.
Ruby
7
star
21

basis

YAPGT.
Ruby
7
star
22

sploit

This is so dumb.
Ruby
7
star
23

modelizer

Sometimes fixtures just ain't enough.
Ruby
6
star
24

backpack-journal

CLI for 37signals' Backpack Journal. Up for adoption!
Ruby
6
star
25

deeby

Tasks to switch your database configuration for a single Rake run.
Ruby
6
star
26

hoe-plugin-examples

Simple examples of how to write Hoe plugins.
Ruby
5
star
27

rubygems-future

Experiments. Don't hold your breath.
Ruby
5
star
28

jbarnette.github.com

My website.
Ruby
4
star
29

spidermonkey

Mozilla SpiderMonkey mirror and patches for Johnson.
JavaScript
4
star
30

between

Move data between rich models and simple structures.
Ruby
3
star
31

hoe-rubygems

A Hoe plugin with some additional RubyGems support.
Ruby
3
star
32

simplifier

Translate Ruby object graphs to simpler types.
Ruby
3
star
33

osx-multitouch

Broken. Trackpad multitouch in Ruby.
Ruby
3
star
34

hoe-doofus

A Hoe plugin to keep me from making broken releases.
Ruby
3
star
35

rack-goggles

Rack middleware for JSON API visibility.
JavaScript
3
star
36

onesie

One-page app helper for Rack stacks.
Ruby
2
star
37

contexts

Combine multiple Go contexts
Go
2
star
38

rake-secrets

Helpful tasks for storing sensitive stuff.
Ruby
2
star
39

logfmt

JSONL pretty-printer
Go
2
star
40

botany

A git branch switcher for Atom.
CoffeeScript
1
star
41

fortress

Multiple CI Joes working together.
Ruby
1
star
42

docker-oauth2-proxy

1
star
43

basis-gem-hoe

Nothing to see here.
Ruby
1
star
44

basis-rails-minimal

Ruby
1
star