isolate 1.6.1 → 1.7.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.rdoc +6 -0
- data/lib/hoe/isolate.rb +2 -3
- data/lib/isolate.rb +14 -12
- data/test/test_isolate.rb +1 -2
- metadata +2 -2
data/CHANGELOG.rdoc
CHANGED
data/lib/hoe/isolate.rb
CHANGED
@@ -28,10 +28,9 @@ class Hoe # :nodoc:
|
|
28
28
|
self.isolate_dir ||= "tmp/gems"
|
29
29
|
end
|
30
30
|
|
31
|
-
def define_isolate_tasks #
|
32
|
-
i = ::Isolate.new self.isolate_dir
|
31
|
+
def define_isolate_tasks # HACK
|
32
|
+
i = ::Isolate.new self.isolate_dir, :cleanup => true
|
33
33
|
|
34
|
-
# TODO: consider sneakily adding test lib deps if they don't exist
|
35
34
|
(self.extra_deps + self.extra_dev_deps).each do |name, version|
|
36
35
|
i.gem name, *Array(version)
|
37
36
|
end
|
data/lib/isolate.rb
CHANGED
@@ -21,10 +21,9 @@ class Isolate
|
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
|
-
VERSION = "1.
|
24
|
+
VERSION = "1.7.0" # :nodoc:
|
25
25
|
|
26
26
|
attr_reader :entries # :nodoc:
|
27
|
-
|
28
27
|
attr_reader :path # :nodoc:
|
29
28
|
|
30
29
|
# Activate (and possibly install) gems for a specific
|
@@ -33,7 +32,6 @@ class Isolate
|
|
33
32
|
|
34
33
|
def self.activate environment
|
35
34
|
instance.activate environment
|
36
|
-
instance.cleanup if instance.cleanup?
|
37
35
|
end
|
38
36
|
|
39
37
|
# Declare an isolated RubyGems environment, installed in +path+. The
|
@@ -82,7 +80,6 @@ class Isolate
|
|
82
80
|
end
|
83
81
|
|
84
82
|
def activate environment = nil # :nodoc:
|
85
|
-
return self if passthrough?
|
86
83
|
enable unless enabled?
|
87
84
|
|
88
85
|
env = environment.to_s if environment
|
@@ -92,6 +89,8 @@ class Isolate
|
|
92
89
|
Gem.activate e.name, *e.requirement.as_list if e.matches? env
|
93
90
|
end
|
94
91
|
|
92
|
+
cleanup if cleanup?
|
93
|
+
|
95
94
|
self
|
96
95
|
end
|
97
96
|
|
@@ -126,8 +125,7 @@ class Isolate
|
|
126
125
|
end
|
127
126
|
|
128
127
|
def disable # :nodoc:
|
129
|
-
return self if passthrough?
|
130
|
-
return self unless enabled?
|
128
|
+
return self if passthrough? or not enabled?
|
131
129
|
|
132
130
|
ENV["GEM_PATH"] = @old_gem_path
|
133
131
|
ENV["GEM_HOME"] = @old_gem_home
|
@@ -139,11 +137,12 @@ class Isolate
|
|
139
137
|
@enabled = false
|
140
138
|
|
141
139
|
self.class.refresh
|
140
|
+
|
142
141
|
self
|
143
142
|
end
|
144
143
|
|
145
144
|
def enable # :nodoc:
|
146
|
-
return self if passthrough?
|
145
|
+
return self if passthrough? or enabled?
|
147
146
|
|
148
147
|
@old_gem_path = ENV["GEM_PATH"]
|
149
148
|
@old_gem_home = ENV["GEM_HOME"]
|
@@ -169,6 +168,7 @@ class Isolate
|
|
169
168
|
self.class.refresh
|
170
169
|
|
171
170
|
@enabled = true
|
171
|
+
|
172
172
|
self
|
173
173
|
end
|
174
174
|
|
@@ -197,17 +197,14 @@ class Isolate
|
|
197
197
|
requirement = if requirements.empty? then
|
198
198
|
Gem::Requirement.default
|
199
199
|
else
|
200
|
-
Gem::Requirement.new
|
200
|
+
Gem::Requirement.new requirements
|
201
201
|
end
|
202
202
|
|
203
203
|
entry = Entry.new name, requirement, @environments, options
|
204
204
|
|
205
205
|
entries << entry
|
206
|
-
entry
|
207
|
-
end
|
208
206
|
|
209
|
-
|
210
|
-
$stderr.puts s if verbose?
|
207
|
+
entry
|
211
208
|
end
|
212
209
|
|
213
210
|
def install environment = nil # :nodoc:
|
@@ -243,6 +240,7 @@ class Isolate
|
|
243
240
|
end
|
244
241
|
|
245
242
|
Gem.source_index.refresh!
|
243
|
+
|
246
244
|
self
|
247
245
|
end
|
248
246
|
|
@@ -250,6 +248,10 @@ class Isolate
|
|
250
248
|
@install
|
251
249
|
end
|
252
250
|
|
251
|
+
def log s # :nodoc:
|
252
|
+
$stderr.puts s if verbose?
|
253
|
+
end
|
254
|
+
|
253
255
|
def passthrough &block # :nodoc:
|
254
256
|
@passthrough = yield
|
255
257
|
end
|
data/test/test_isolate.rb
CHANGED
@@ -42,7 +42,7 @@ class TestIsolate < MiniTest::Unit::TestCase
|
|
42
42
|
end
|
43
43
|
|
44
44
|
def test_activate_environment
|
45
|
-
@isolate = Isolate.new WITH_HOE
|
45
|
+
@isolate = Isolate.new WITH_HOE, :verbose => false
|
46
46
|
@isolate.gem "rubyforge"
|
47
47
|
|
48
48
|
@isolate.environment "borg" do
|
@@ -99,7 +99,6 @@ class TestIsolate < MiniTest::Unit::TestCase
|
|
99
99
|
@isolate = Isolate.new WITH_HOE, :verbose => false
|
100
100
|
# no gems specified on purpose
|
101
101
|
@isolate.activate
|
102
|
-
@isolate.cleanup
|
103
102
|
|
104
103
|
expected = [["hoe", "2.3.3", WITH_HOE],
|
105
104
|
["rake", "0.8.7", WITH_HOE],
|
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.7.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-
|
13
|
+
date: 2009-12-07 00:00:00 -08:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|