isolate 3.0.1 → 3.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +0 -0
- data/CHANGELOG.rdoc +8 -0
- data/lib/isolate.rb +1 -1
- data/lib/isolate/sandbox.rb +8 -2
- data/test/test_isolate_sandbox.rb +85 -15
- metadata +4 -4
- metadata.gz.sig +0 -0
data.tar.gz.sig
CHANGED
Binary file
|
data/CHANGELOG.rdoc
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
=== 3.0.2 / 2011-05-14
|
2
|
+
|
3
|
+
* 3 bug fixes:
|
4
|
+
|
5
|
+
* Cleanup shouldn't try to uninstall specs outside of our sandbox.
|
6
|
+
* Pass spec.base_dir to the uninstaller during cleanup.
|
7
|
+
* We shouldn't manipulate Gem.path, but if we do, we should be smart/clean about it.
|
8
|
+
|
1
9
|
=== 3.0.1 / 2011-05-11
|
2
10
|
|
3
11
|
* 6 minor enhancements:
|
data/lib/isolate.rb
CHANGED
data/lib/isolate/sandbox.rb
CHANGED
@@ -90,6 +90,9 @@ module Isolate
|
|
90
90
|
legit = legitimize!
|
91
91
|
extra = installed - legit
|
92
92
|
|
93
|
+
gem_dir = Gem.dir
|
94
|
+
extra.reject! { |s| s.base_dir != gem_dir }
|
95
|
+
|
93
96
|
unless extra.empty?
|
94
97
|
padding = Math.log10(extra.size).to_i + 1
|
95
98
|
format = "[%0#{padding}d/%s] Nuking %s."
|
@@ -103,7 +106,7 @@ module Isolate
|
|
103
106
|
:version => e.version,
|
104
107
|
:ignore => true,
|
105
108
|
:executables => true,
|
106
|
-
:install_dir =>
|
109
|
+
:install_dir => e.base_dir)
|
107
110
|
uninstaller.uninstall
|
108
111
|
end
|
109
112
|
end
|
@@ -172,8 +175,11 @@ module Isolate
|
|
172
175
|
|
173
176
|
ENV["ISOLATED"] = path
|
174
177
|
|
178
|
+
if system? then
|
179
|
+
Gem.path.unshift path # HACK: this is just wrong!
|
180
|
+
Gem.path.uniq! # HACK: needed for the previous line :(
|
181
|
+
end
|
175
182
|
Isolate.refresh
|
176
|
-
Gem.path.unshift path if system?
|
177
183
|
|
178
184
|
@enabled = true
|
179
185
|
fire :enabled
|
@@ -2,6 +2,7 @@ require "isolate/test"
|
|
2
2
|
|
3
3
|
class TestIsolateSandbox < Isolate::Test
|
4
4
|
WITH_HOE = "test/fixtures/with-hoe"
|
5
|
+
SYSTEM = "test/fixtures/system"
|
5
6
|
|
6
7
|
def setup
|
7
8
|
@sandbox = sandbox
|
@@ -55,18 +56,72 @@ class TestIsolateSandbox < Isolate::Test
|
|
55
56
|
# TODO: cleanup with 2 versions of same gem, 1 activated
|
56
57
|
# TODO: install with 1 older version, 1 new gem to be installed
|
57
58
|
|
58
|
-
def
|
59
|
-
|
59
|
+
def test_cleanup_all
|
60
|
+
with_env_setup do
|
61
|
+
s = sandbox :path => WITH_HOE, :install => true, :cleanup => true
|
60
62
|
|
61
|
-
|
62
|
-
|
63
|
+
assert_silent do
|
64
|
+
s.activate # no gems on purpose
|
65
|
+
end
|
66
|
+
|
67
|
+
expected = [["hoe", "2.3.3", WITH_HOE],
|
68
|
+
["rake", "0.8.7", WITH_HOE],
|
69
|
+
["rubyforge", "1.0.4", WITH_HOE]]
|
70
|
+
|
71
|
+
assert_equal expected, Gem::Uninstaller.value
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
def test_cleanup_all_system
|
76
|
+
with_env_setup do
|
77
|
+
s = sandbox(:path => WITH_HOE, :install => true, :cleanup => true,
|
78
|
+
:system => true)
|
79
|
+
|
80
|
+
assert_silent do
|
81
|
+
s.activate # no gems on purpose
|
82
|
+
end
|
83
|
+
|
84
|
+
expected = [["hoe", "2.3.3", WITH_HOE],
|
85
|
+
["rake", "0.8.7", WITH_HOE],
|
86
|
+
["rubyforge", "1.0.4", WITH_HOE]]
|
87
|
+
|
88
|
+
assert_equal expected, Gem::Uninstaller.value.sort
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
def test_cleanup_partial
|
93
|
+
with_env_setup do
|
94
|
+
s = sandbox :path => WITH_HOE, :install => true, :cleanup => true
|
95
|
+
|
96
|
+
s.gem "rake", "0.8.7"
|
97
|
+
|
98
|
+
assert_silent do
|
99
|
+
s.activate
|
100
|
+
end
|
101
|
+
|
102
|
+
expected = [["hoe", "2.3.3", WITH_HOE],
|
103
|
+
["rubyforge", "1.0.4", WITH_HOE]]
|
104
|
+
|
105
|
+
assert_equal expected, Gem::Uninstaller.value
|
63
106
|
end
|
107
|
+
end
|
108
|
+
|
109
|
+
def test_cleanup_partial_system
|
110
|
+
with_env_setup do
|
111
|
+
s = sandbox(:path => WITH_HOE, :install => true, :cleanup => true,
|
112
|
+
:system => true)
|
64
113
|
|
65
|
-
|
66
|
-
["rake", "0.8.7", WITH_HOE],
|
67
|
-
["rubyforge", "1.0.4", WITH_HOE]]
|
114
|
+
s.gem "rake", "0.8.7"
|
68
115
|
|
69
|
-
|
116
|
+
assert_silent do
|
117
|
+
s.activate
|
118
|
+
end
|
119
|
+
|
120
|
+
expected = [["hoe", "2.3.3", WITH_HOE],
|
121
|
+
["rubyforge", "1.0.4", WITH_HOE]]
|
122
|
+
|
123
|
+
assert_equal expected, Gem::Uninstaller.value.sort
|
124
|
+
end
|
70
125
|
end
|
71
126
|
|
72
127
|
def test_disable
|
@@ -204,9 +259,12 @@ class TestIsolateSandbox < Isolate::Test
|
|
204
259
|
end
|
205
260
|
|
206
261
|
def test_initialize_override_defaults
|
207
|
-
s = Isolate::Sandbox.new
|
208
|
-
|
209
|
-
|
262
|
+
s = Isolate::Sandbox.new(:path => "x",
|
263
|
+
:cleanup => false,
|
264
|
+
:install => false,
|
265
|
+
:system => false,
|
266
|
+
:verbose => false,
|
267
|
+
:multiruby => false)
|
210
268
|
|
211
269
|
assert_equal File.expand_path("x"), s.path
|
212
270
|
|
@@ -266,15 +324,27 @@ class TestIsolateSandbox < Isolate::Test
|
|
266
324
|
"#{name} is NOT a loaded gemspec, and it should be!"
|
267
325
|
end
|
268
326
|
|
269
|
-
def sandbox
|
270
|
-
|
327
|
+
def sandbox opts = {}, &block
|
328
|
+
defaults = {
|
271
329
|
:install => false,
|
272
330
|
:system => false,
|
273
331
|
:verbose => false,
|
274
332
|
:multiruby => false
|
275
333
|
}
|
276
334
|
|
277
|
-
|
278
|
-
|
335
|
+
Isolate::Sandbox.new defaults.merge(opts), &block
|
336
|
+
end
|
337
|
+
|
338
|
+
def with_env_setup
|
339
|
+
old_gem_path = ENV["GEM_PATH"]
|
340
|
+
old_gem_home = ENV["GEM_HOME"]
|
341
|
+
ENV["GEM_HOME"] = "test/fixtures/with-hoe"
|
342
|
+
ENV["GEM_PATH"] = "test/fixtures/system"
|
343
|
+
Gem.refresh
|
344
|
+
|
345
|
+
yield
|
346
|
+
ensure
|
347
|
+
ENV["GEM_PATH"] = old_gem_path
|
348
|
+
ENV["GEM_HOME"] = old_gem_home
|
279
349
|
end
|
280
350
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: isolate
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 3
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 3
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 3.0.
|
9
|
+
- 2
|
10
|
+
version: 3.0.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- John Barnette
|
@@ -37,7 +37,7 @@ cert_chain:
|
|
37
37
|
FBHgymkyj/AOSqKRIpXPhjC6
|
38
38
|
-----END CERTIFICATE-----
|
39
39
|
|
40
|
-
date: 2011-05-
|
40
|
+
date: 2011-05-15 00:00:00 Z
|
41
41
|
dependencies:
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: minitest
|
metadata.gz.sig
CHANGED
Binary file
|