isolate 1.5.1 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG.rdoc +5 -0
- data/Manifest.txt +1 -0
- data/README.rdoc +27 -0
- data/lib/isolate.rb +7 -2
- data/lib/isolate/rake.rb +25 -0
- data/test/test_isolate.rb +7 -3
- metadata +3 -2
data/CHANGELOG.rdoc
CHANGED
data/Manifest.txt
CHANGED
data/README.rdoc
CHANGED
@@ -118,6 +118,33 @@ and <tt>:verbose</tt> options to control things:
|
|
118
118
|
...
|
119
119
|
end
|
120
120
|
|
121
|
+
=== Interaction and Rake
|
122
|
+
|
123
|
+
You don't strictly need them, but Isolate provides a set of Rake tasks
|
124
|
+
that make a few common thing easier. To use them, just drop a
|
125
|
+
<tt>require</tt> in your <tt>Rakefile</tt>:
|
126
|
+
|
127
|
+
require "isolate/rake"
|
128
|
+
|
129
|
+
==== Running Shell Commands
|
130
|
+
|
131
|
+
When you're in an isolated subshell, the command-line tools provided
|
132
|
+
by any of your gems are available on your PATH.
|
133
|
+
|
134
|
+
# run a single command in an isolated subshell
|
135
|
+
$ rake isolate:sh['gem list']
|
136
|
+
|
137
|
+
# run a new isolated subshell
|
138
|
+
$ rake isolate:sh
|
139
|
+
|
140
|
+
==== Exporting
|
141
|
+
|
142
|
+
Isolate can generate a <tt>.gems</tt> manifest file in the root
|
143
|
+
directory of your project. <tt>.gems</tt> is used (among other things)
|
144
|
+
to specify project dependencies on Heroku.
|
145
|
+
|
146
|
+
$ rake isolate:dotgems
|
147
|
+
|
121
148
|
=== A Rails Example
|
122
149
|
|
123
150
|
Here's a quick example (extracted from a real project) of how to use
|
data/lib/isolate.rb
CHANGED
@@ -21,7 +21,7 @@ class Isolate
|
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
|
-
VERSION = "1.
|
24
|
+
VERSION = "1.6.0" # :nodoc:
|
25
25
|
|
26
26
|
attr_reader :entries # :nodoc:
|
27
27
|
|
@@ -72,7 +72,7 @@ class Isolate
|
|
72
72
|
@entries = []
|
73
73
|
@environments = []
|
74
74
|
@passthrough = false
|
75
|
-
@path = path
|
75
|
+
@path = File.expand_path path
|
76
76
|
|
77
77
|
@install = options.fetch :install, true
|
78
78
|
@verbose = options.fetch :verbose, true
|
@@ -131,6 +131,7 @@ class Isolate
|
|
131
131
|
|
132
132
|
ENV["GEM_PATH"] = @old_gem_path
|
133
133
|
ENV["GEM_HOME"] = @old_gem_home
|
134
|
+
ENV["PATH"] = @old_path
|
134
135
|
ENV["RUBYOPT"] = @old_ruby_opt
|
135
136
|
|
136
137
|
$LOAD_PATH.replace @old_load_path
|
@@ -146,6 +147,7 @@ class Isolate
|
|
146
147
|
|
147
148
|
@old_gem_path = ENV["GEM_PATH"]
|
148
149
|
@old_gem_home = ENV["GEM_HOME"]
|
150
|
+
@old_path = ENV["PATH"]
|
149
151
|
@old_ruby_opt = ENV["RUBYOPT"]
|
150
152
|
@old_load_path = $LOAD_PATH.dup
|
151
153
|
|
@@ -158,6 +160,9 @@ class Isolate
|
|
158
160
|
ENV["RUBYOPT"] = "#{ENV['RUBYOPT']} -I#{File.dirname(__FILE__)}"
|
159
161
|
ENV["GEM_PATH"] = ENV["GEM_HOME"] = path
|
160
162
|
|
163
|
+
bin = File.join path, "bin"
|
164
|
+
ENV["PATH"]= [bin, ENV["PATH"]].join File::PATH_SEPARATOR
|
165
|
+
|
161
166
|
self.class.refresh
|
162
167
|
|
163
168
|
@enabled = true
|
data/lib/isolate/rake.rb
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
namespace :isolate do
|
2
|
+
desc "Generate a .gems manifest for your isolated gems."
|
3
|
+
task :dotgems do
|
4
|
+
File.open ".gems", "wb" do |f|
|
5
|
+
Isolate.instance.entries.each do |entry|
|
6
|
+
next unless entry.environments.empty?
|
7
|
+
|
8
|
+
gems = [entry.name]
|
9
|
+
gems << "--version '#{entry.requirement}'"
|
10
|
+
gems << "--source #{entry.options[:source]}" if entry.options[:source]
|
11
|
+
|
12
|
+
f.puts gems.join " "
|
13
|
+
end
|
14
|
+
|
15
|
+
# this above all: to thine own self be true
|
16
|
+
f.puts "isolate --version '#{Isolate::VERSION}'"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
desc "Start an isolated subshell. Run 'command' and exit if specified."
|
21
|
+
task :sh, [:command] do |t, args|
|
22
|
+
exec ENV["SHELL"] unless args.command
|
23
|
+
sh args.command
|
24
|
+
end
|
25
|
+
end
|
data/test/test_isolate.rb
CHANGED
@@ -26,7 +26,7 @@ class TestIsolate < MiniTest::Unit::TestCase
|
|
26
26
|
end
|
27
27
|
|
28
28
|
refute_nil Isolate.instance
|
29
|
-
assert_equal WITH_HOE, Isolate.instance.path
|
29
|
+
assert_equal File.expand_path(WITH_HOE), Isolate.instance.path
|
30
30
|
assert_equal "hoe", Isolate.instance.entries.first.name
|
31
31
|
end
|
32
32
|
|
@@ -109,19 +109,22 @@ class TestIsolate < MiniTest::Unit::TestCase
|
|
109
109
|
end
|
110
110
|
|
111
111
|
def test_disable
|
112
|
-
home, path = ENV.values_at "GEM_HOME", "GEM_PATH"
|
112
|
+
home, path, bin = ENV.values_at "GEM_HOME", "GEM_PATH", "PATH"
|
113
113
|
load_path = $LOAD_PATH.dup
|
114
114
|
|
115
115
|
@isolate.enable
|
116
116
|
|
117
117
|
refute_equal home, ENV["GEM_HOME"]
|
118
118
|
refute_equal path, ENV["GEM_PATH"]
|
119
|
+
refute_equal bin, ENV["PATH"]
|
120
|
+
|
119
121
|
refute_equal load_path, $LOAD_PATH
|
120
122
|
|
121
123
|
@isolate.disable
|
122
124
|
|
123
125
|
assert_equal home, ENV["GEM_HOME"]
|
124
126
|
assert_equal path, ENV["GEM_PATH"]
|
127
|
+
assert_equal bin, ENV["PATH"]
|
125
128
|
assert_equal load_path, $LOAD_PATH
|
126
129
|
end
|
127
130
|
|
@@ -137,6 +140,7 @@ class TestIsolate < MiniTest::Unit::TestCase
|
|
137
140
|
|
138
141
|
assert_equal @isolate.path, ENV["GEM_PATH"]
|
139
142
|
assert_equal @isolate.path, ENV["GEM_HOME"]
|
143
|
+
assert ENV["PATH"].include?(File.join(@isolate.path, "bin")), "in path"
|
140
144
|
|
141
145
|
assert_equal [], Gem.find_files("minitest/unit.rb"),
|
142
146
|
"Can't find minitest/unit now, 'cause we're activated!"
|
@@ -187,7 +191,7 @@ class TestIsolate < MiniTest::Unit::TestCase
|
|
187
191
|
|
188
192
|
def test_initialize
|
189
193
|
i = Isolate.new "foo/gems"
|
190
|
-
assert_equal "foo/gems", i.path
|
194
|
+
assert_equal File.expand_path("foo/gems"), i.path
|
191
195
|
end
|
192
196
|
|
193
197
|
def test_initialize_options
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: isolate
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Barnette
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2009-10-
|
13
|
+
date: 2009-10-03 00:00:00 -07:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -74,6 +74,7 @@ files:
|
|
74
74
|
- Rakefile
|
75
75
|
- lib/hoe/isolate.rb
|
76
76
|
- lib/isolate.rb
|
77
|
+
- lib/isolate/rake.rb
|
77
78
|
- test/fixtures/with-hoe/specifications/hoe-2.3.3.gemspec
|
78
79
|
- test/fixtures/with-hoe/specifications/rake-0.8.7.gemspec
|
79
80
|
- test/fixtures/with-hoe/specifications/rubyforge-1.0.4.gemspec
|