isolate 3.0.2 → 3.1.0.pre.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.autotest +0 -4
- data/CHANGELOG.rdoc +0 -24
- data/Rakefile +6 -86
- data/lib/hoe/isolate.rb +0 -2
- data/lib/isolate.rb +4 -12
- data/lib/isolate/entry.rb +5 -19
- data/lib/isolate/rake.rb +14 -8
- data/lib/isolate/sandbox.rb +36 -59
- data/test/fixtures/with-hoe/specifications/hoe-2.3.3.gemspec +1 -0
- data/test/fixtures/with-hoe/specifications/rake-0.8.7.gemspec +1 -0
- data/test/fixtures/with-hoe/specifications/rubyforge-1.0.4.gemspec +1 -0
- data/test/isolate/test.rb +2 -6
- data/test/test_isolate.rb +1 -4
- data/test/test_isolate_entry.rb +1 -1
- data/test/test_isolate_sandbox.rb +17 -92
- metadata +33 -56
- data.tar.gz.sig +0 -0
- data/.gemtest +0 -0
- metadata.gz.sig +0 -0
data/.autotest
CHANGED
data/CHANGELOG.rdoc
CHANGED
@@ -1,27 +1,3 @@
|
|
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
|
-
|
9
|
-
=== 3.0.1 / 2011-05-11
|
10
|
-
|
11
|
-
* 6 minor enhancements:
|
12
|
-
|
13
|
-
* Added Entry#to_s and #inspect to make it much more readable.
|
14
|
-
* Added Isolate.sandbox= and used it from Hoe::Isolate plugin.
|
15
|
-
* Deprecated Sandbox#index.
|
16
|
-
* Entry#specification now returns nil if it doesn't resolve to anything.
|
17
|
-
* Refactored Sandbox's default path so that tests won't collide with our Rakefile.
|
18
|
-
* We now require rubygems >= 1.8.2.
|
19
|
-
|
20
|
-
* 2 bug fixes:
|
21
|
-
|
22
|
-
* Cleaned up all warnings caused by rubygems 1.8 deprecations.
|
23
|
-
* Fixed Sandbox#legitimize! to properly deal with Gem::Dependency.
|
24
|
-
|
25
1
|
=== 3.0.0 / 2010-10-19
|
26
2
|
|
27
3
|
* Remove deprecated Isolate.{gems,instance} methods.
|
data/Rakefile
CHANGED
@@ -1,100 +1,20 @@
|
|
1
|
-
|
2
|
-
require "
|
1
|
+
$:.unshift "./lib"
|
2
|
+
require "isolate/now"
|
3
3
|
|
4
|
-
|
5
|
-
require "isolate/rake"
|
4
|
+
require "hoe"
|
6
5
|
|
7
6
|
Hoe.plugins.delete :rubyforge
|
8
|
-
Hoe.plugin :
|
7
|
+
Hoe.plugin :doofus, :git, :isolate
|
9
8
|
|
10
9
|
Hoe.spec "isolate" do
|
11
10
|
developer "John Barnette", "code@jbarnette.com"
|
12
11
|
developer "Ryan Davis", "ryand-ruby@zenspider.com"
|
13
12
|
|
14
|
-
|
13
|
+
require_ruby_version ">= 1.8.6"
|
14
|
+
require_rubygems_version ">= 1.3.6"
|
15
15
|
|
16
16
|
self.extra_rdoc_files = Dir["*.rdoc"]
|
17
17
|
self.history_file = "CHANGELOG.rdoc"
|
18
18
|
self.readme_file = "README.rdoc"
|
19
19
|
self.testlib = :minitest
|
20
|
-
|
21
|
-
dependency "minitest", "~> 2.1.0", :development
|
22
|
-
dependency "hoe-doofus", "~> 1.0.0", :development
|
23
|
-
dependency "hoe-git", "~> 1.3.0", :development
|
24
|
-
end
|
25
|
-
|
26
|
-
def changelog_section code
|
27
|
-
name = {
|
28
|
-
:major => "major enhancement",
|
29
|
-
:minor => "minor enhancement",
|
30
|
-
:bug => "bug fix",
|
31
|
-
:unknown => "unknown",
|
32
|
-
}[code]
|
33
|
-
|
34
|
-
changes = $changes[code]
|
35
|
-
count = changes.size
|
36
|
-
name += "s" if count > 1
|
37
|
-
name.sub!(/fixs/, 'fixes')
|
38
|
-
|
39
|
-
return if count < 1
|
40
|
-
|
41
|
-
puts "* #{count} #{name}:"
|
42
|
-
puts
|
43
|
-
changes.sort.each do |line|
|
44
|
-
puts " * #{line}"
|
45
|
-
end
|
46
|
-
puts
|
47
|
-
end
|
48
|
-
|
49
|
-
desc "Print the current changelog."
|
50
|
-
task "git:newchangelog" do
|
51
|
-
# This must be in here until rubygems depends on the version of hoe that has
|
52
|
-
# git_tags
|
53
|
-
# TODO: get this code back into hoe-git
|
54
|
-
module Hoe::Git
|
55
|
-
module_function :git_tags, :git_svn?, :git_release_tag_prefix
|
56
|
-
end
|
57
|
-
|
58
|
-
tag = ENV["FROM"] || Hoe::Git.git_tags.last
|
59
|
-
range = [tag, "HEAD"].compact.join ".."
|
60
|
-
cmd = "git log #{range} '--format=tformat:%B|||%aN|||%aE|||'"
|
61
|
-
now = Time.new.strftime "%Y-%m-%d"
|
62
|
-
|
63
|
-
changes = `#{cmd}`.split(/\|\|\|/).each_slice(3).map do |msg, author, email|
|
64
|
-
msg.split(/\n/).reject { |s| s.empty? }
|
65
|
-
end
|
66
|
-
|
67
|
-
changes = changes.flatten
|
68
|
-
|
69
|
-
next if changes.empty?
|
70
|
-
|
71
|
-
$changes = Hash.new { |h,k| h[k] = [] }
|
72
|
-
|
73
|
-
codes = {
|
74
|
-
"!" => :major,
|
75
|
-
"+" => :minor,
|
76
|
-
"*" => :minor,
|
77
|
-
"-" => :bug,
|
78
|
-
"?" => :unknown,
|
79
|
-
}
|
80
|
-
|
81
|
-
codes_re = Regexp.escape codes.keys.join
|
82
|
-
|
83
|
-
changes.each do |change|
|
84
|
-
if change =~ /^\s*([#{codes_re}])\s*(.*)/ then
|
85
|
-
code, line = codes[$1], $2
|
86
|
-
else
|
87
|
-
code, line = codes["?"], change.chomp
|
88
|
-
end
|
89
|
-
|
90
|
-
$changes[code] << line
|
91
|
-
end
|
92
|
-
|
93
|
-
puts "=== #{ENV['VERSION'] || 'NEXT'} / #{now}"
|
94
|
-
puts
|
95
|
-
changelog_section :major
|
96
|
-
changelog_section :minor
|
97
|
-
changelog_section :bug
|
98
|
-
changelog_section :unknown
|
99
|
-
puts
|
100
20
|
end
|
data/lib/hoe/isolate.rb
CHANGED
data/lib/isolate.rb
CHANGED
@@ -8,7 +8,7 @@ module Isolate
|
|
8
8
|
|
9
9
|
# Duh.
|
10
10
|
|
11
|
-
VERSION = "3.0.
|
11
|
+
VERSION = "3.1.0.pre.1"
|
12
12
|
|
13
13
|
# Disable Isolate. If a block is provided, isolation will be
|
14
14
|
# disabled for the scope of the block.
|
@@ -34,13 +34,6 @@ module Isolate
|
|
34
34
|
@@sandbox
|
35
35
|
end
|
36
36
|
|
37
|
-
# Set the singleton. Intended for Hoe::Isolate and other tools that
|
38
|
-
# make their own.
|
39
|
-
|
40
|
-
def self.sandbox= o
|
41
|
-
@@sandbox = o
|
42
|
-
end
|
43
|
-
|
44
37
|
# Declare an isolated RubyGems environment, installed in +path+. Any
|
45
38
|
# block given will be <tt>instance_eval</tt>ed, see
|
46
39
|
# Isolate::Sandbox#gem and Isolate::Sandbox#environment for the sort
|
@@ -77,11 +70,10 @@ module Isolate
|
|
77
70
|
end
|
78
71
|
|
79
72
|
# Poke RubyGems, since we've probably monkeyed with a bunch of paths
|
80
|
-
# and suchlike.
|
73
|
+
# and suchlike. Deprecated and scheduled for removal in v4.0.0.
|
81
74
|
|
82
75
|
def self.refresh # :nodoc:
|
83
|
-
Gem.
|
84
|
-
Gem.
|
85
|
-
Gem::Specification.reset
|
76
|
+
$stderr.puts "Deprecated, removal in v4.0.0. Use Gem.refresh."
|
77
|
+
Gem.refresh
|
86
78
|
end
|
87
79
|
end
|
data/lib/isolate/entry.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require "isolate/events"
|
2
|
+
require "isolate/installer"
|
2
3
|
require "rubygems"
|
3
4
|
require "rubygems/command"
|
4
5
|
require "rubygems/dependency_installer"
|
@@ -67,9 +68,7 @@ module Isolate
|
|
67
68
|
|
68
69
|
def activate
|
69
70
|
fire :activating, :activated do
|
70
|
-
|
71
|
-
raise Gem::LoadError, "Couldn't resolve: #{self}" unless spec
|
72
|
-
spec.activate
|
71
|
+
Gem.activate name, *requirement.as_list
|
73
72
|
end
|
74
73
|
end
|
75
74
|
|
@@ -81,12 +80,7 @@ module Isolate
|
|
81
80
|
|
82
81
|
begin
|
83
82
|
fire :installing, :installed do
|
84
|
-
|
85
|
-
installer =
|
86
|
-
Gem::DependencyInstaller.new(:development => false,
|
87
|
-
:generate_rdoc => false,
|
88
|
-
:generate_ri => false,
|
89
|
-
:install_dir => @sandbox.path)
|
83
|
+
installer = Isolate::Installer.new @sandbox
|
90
84
|
|
91
85
|
Gem.sources += Array(options[:source]) if options[:source]
|
92
86
|
Gem::Command.build_args = Array(options[:args]) if options[:args]
|
@@ -112,12 +106,10 @@ module Isolate
|
|
112
106
|
name == spec.name and requirement.satisfied_by? spec.version
|
113
107
|
end
|
114
108
|
|
115
|
-
# The Gem::Specification for this entry
|
109
|
+
# The Gem::Specification for this entry.
|
116
110
|
|
117
111
|
def specification
|
118
|
-
Gem
|
119
|
-
rescue Gem::LoadError
|
120
|
-
nil
|
112
|
+
Gem.source_index.find_name(name, requirement).first
|
121
113
|
end
|
122
114
|
|
123
115
|
# Updates this entry's environments, options, and
|
@@ -133,11 +125,5 @@ module Isolate
|
|
133
125
|
|
134
126
|
self
|
135
127
|
end
|
136
|
-
|
137
|
-
def to_s
|
138
|
-
"Entry[#{name.inspect}, #{requirement.to_s.inspect}]"
|
139
|
-
end
|
140
|
-
|
141
|
-
alias :inspect :to_s
|
142
128
|
end
|
143
129
|
end
|
data/lib/isolate/rake.rb
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
require "isolate"
|
2
|
-
|
3
1
|
namespace :isolate do
|
4
2
|
desc "Show current isolated environment."
|
5
3
|
task :env do
|
@@ -50,14 +48,22 @@ namespace :isolate do
|
|
50
48
|
|
51
49
|
desc "Which isolated gems have updates available?"
|
52
50
|
task :stale do
|
51
|
+
require "rubygems/source_index"
|
52
|
+
require "rubygems/spec_fetcher"
|
53
|
+
|
54
|
+
index = Gem::SourceIndex.new
|
53
55
|
outdated = []
|
54
|
-
sandbox = Isolate.sandbox
|
55
|
-
outdated = sandbox.entries.reject { |entry| entry.specification }
|
56
56
|
|
57
|
-
|
58
|
-
entry
|
59
|
-
|
60
|
-
|
57
|
+
Isolate.sandbox.entries.each do |entry|
|
58
|
+
if entry.specification
|
59
|
+
index.add_spec entry.specification
|
60
|
+
else
|
61
|
+
outdated << entry
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
index.outdated.each do |name|
|
66
|
+
outdated << Isolate.sandbox.entries.find { |e| e.name == name }
|
61
67
|
end
|
62
68
|
|
63
69
|
outdated.sort_by { |e| e.name }.each do |entry|
|
data/lib/isolate/sandbox.rb
CHANGED
@@ -4,7 +4,6 @@ require "isolate/events"
|
|
4
4
|
require "rbconfig"
|
5
5
|
require "rubygems/defaults"
|
6
6
|
require "rubygems/uninstaller"
|
7
|
-
require "rubygems/deprecate"
|
8
7
|
|
9
8
|
module Isolate
|
10
9
|
|
@@ -14,8 +13,6 @@ module Isolate
|
|
14
13
|
class Sandbox
|
15
14
|
include Events
|
16
15
|
|
17
|
-
DEFAULT_PATH = "tmp/isolate" # :nodoc:
|
18
|
-
|
19
16
|
attr_reader :entries # :nodoc:
|
20
17
|
attr_reader :environments # :nodoc:
|
21
18
|
attr_reader :files # :nodoc:
|
@@ -86,13 +83,10 @@ module Isolate
|
|
86
83
|
def cleanup # :nodoc:
|
87
84
|
fire :cleaning
|
88
85
|
|
89
|
-
installed =
|
86
|
+
installed = index.gems.values.sort
|
90
87
|
legit = legitimize!
|
91
88
|
extra = installed - legit
|
92
89
|
|
93
|
-
gem_dir = Gem.dir
|
94
|
-
extra.reject! { |s| s.base_dir != gem_dir }
|
95
|
-
|
96
90
|
unless extra.empty?
|
97
91
|
padding = Math.log10(extra.size).to_i + 1
|
98
92
|
format = "[%0#{padding}d/%s] Nuking %s."
|
@@ -101,13 +95,11 @@ module Isolate
|
|
101
95
|
log format % [i + 1, extra.size, e.full_name]
|
102
96
|
|
103
97
|
Gem::DefaultUserInteraction.use_ui Gem::SilentUI.new do
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
:install_dir => e.base_dir)
|
110
|
-
uninstaller.uninstall
|
98
|
+
Gem::Uninstaller.new(e.name,
|
99
|
+
:version => e.version,
|
100
|
+
:ignore => true,
|
101
|
+
:executables => true,
|
102
|
+
:install_dir => path).uninstall
|
111
103
|
end
|
112
104
|
end
|
113
105
|
end
|
@@ -124,11 +116,12 @@ module Isolate
|
|
124
116
|
fire :disabling
|
125
117
|
|
126
118
|
ENV.replace @old_env
|
127
|
-
$LOAD_PATH.replace @old_load_path
|
128
119
|
|
129
120
|
@enabled = false
|
130
121
|
|
131
|
-
|
122
|
+
Gem.clear_paths
|
123
|
+
Gem.refresh
|
124
|
+
|
132
125
|
fire :disabled
|
133
126
|
|
134
127
|
begin; return yield ensure enable end if block_given?
|
@@ -140,31 +133,20 @@ module Isolate
|
|
140
133
|
return self if enabled?
|
141
134
|
fire :enabling
|
142
135
|
|
143
|
-
@old_env
|
144
|
-
@old_load_path = $LOAD_PATH.dup
|
145
|
-
|
146
|
-
path = self.path
|
147
|
-
|
148
|
-
FileUtils.mkdir_p path
|
149
|
-
ENV["GEM_HOME"] = path
|
136
|
+
@old_env = ENV.to_hash
|
150
137
|
|
151
138
|
unless system?
|
152
|
-
isolate_lib = File.expand_path "../..", __FILE__
|
153
|
-
|
154
|
-
# manually deactivate pre-isolate gems... is this just for 1.9.1?
|
155
|
-
$LOAD_PATH.reject! do |p|
|
156
|
-
p != isolate_lib && Gem.path.any? { |gp| p.include?(gp) }
|
157
|
-
end
|
158
139
|
|
159
140
|
# HACK: Gotta keep isolate explicitly in the LOAD_PATH in
|
160
141
|
# subshells, and the only way I can think of to do that is by
|
161
142
|
# abusing RUBYOPT.
|
162
143
|
|
163
|
-
|
164
|
-
|
165
|
-
end
|
144
|
+
lib = File.expand_path "../..", __FILE__
|
145
|
+
dirname = Regexp.escape lib
|
166
146
|
|
167
|
-
ENV["
|
147
|
+
unless ENV["RUBYOPT"] =~ /\s+-I\s*#{lib}\b/
|
148
|
+
ENV["RUBYOPT"] = "#{ENV['RUBYOPT']} -I#{lib}"
|
149
|
+
end
|
168
150
|
end
|
169
151
|
|
170
152
|
bin = File.join path, "bin"
|
@@ -173,13 +155,17 @@ module Isolate
|
|
173
155
|
ENV["PATH"] = [bin, ENV["PATH"]].join File::PATH_SEPARATOR
|
174
156
|
end
|
175
157
|
|
158
|
+
paths = (ENV["GEM_PATH"] || "").split File::PATH_SEPARATOR
|
159
|
+
paths.clear unless system?
|
160
|
+
paths.push path
|
161
|
+
|
162
|
+
Gem.clear_paths
|
163
|
+
|
164
|
+
ENV["GEM_HOME"] = path
|
165
|
+
ENV["GEM_PATH"] = paths.join File::PATH_SEPARATOR
|
176
166
|
ENV["ISOLATED"] = path
|
177
167
|
|
178
|
-
|
179
|
-
Gem.path.unshift path # HACK: this is just wrong!
|
180
|
-
Gem.path.uniq! # HACK: needed for the previous line :(
|
181
|
-
end
|
182
|
-
Isolate.refresh
|
168
|
+
Gem.refresh
|
183
169
|
|
184
170
|
@enabled = true
|
185
171
|
fire :enabled
|
@@ -226,19 +212,23 @@ module Isolate
|
|
226
212
|
fire :installing
|
227
213
|
|
228
214
|
installable = entries.select do |e|
|
229
|
-
|
215
|
+
!Gem.available?(e.name, *e.requirement.as_list) &&
|
216
|
+
e.matches?(environment)
|
230
217
|
end
|
231
218
|
|
232
219
|
unless installable.empty?
|
233
220
|
padding = Math.log10(installable.size).to_i + 1
|
234
221
|
format = "[%0#{padding}d/%s] Isolating %s (%s)."
|
235
222
|
|
223
|
+
FileUtils.mkdir_p path
|
224
|
+
|
236
225
|
installable.each_with_index do |entry, i|
|
237
226
|
log format % [i + 1, installable.size, entry.name, entry.requirement]
|
238
227
|
entry.install
|
239
|
-
end
|
240
228
|
|
241
|
-
|
229
|
+
index.refresh!
|
230
|
+
Gem.source_index.refresh!
|
231
|
+
end
|
242
232
|
end
|
243
233
|
|
244
234
|
fire :installed
|
@@ -259,6 +249,7 @@ module Isolate
|
|
259
249
|
$stderr.puts s if verbose?
|
260
250
|
end
|
261
251
|
|
252
|
+
|
262
253
|
def multiruby?
|
263
254
|
@options.fetch :multiruby, true
|
264
255
|
end
|
@@ -269,7 +260,7 @@ module Isolate
|
|
269
260
|
end
|
270
261
|
|
271
262
|
def path
|
272
|
-
base = @options.fetch :path,
|
263
|
+
base = @options.fetch :path, "tmp/isolate"
|
273
264
|
|
274
265
|
unless @options.key?(:multiruby) && @options[:multiruby] == false
|
275
266
|
suffix = "#{Gem.ruby_engine}-#{RbConfig::CONFIG['ruby_version']}"
|
@@ -298,20 +289,9 @@ module Isolate
|
|
298
289
|
specs = []
|
299
290
|
|
300
291
|
deps.flatten.each do |dep|
|
301
|
-
spec =
|
302
|
-
|
303
|
-
|
304
|
-
dep.to_spec
|
305
|
-
rescue Gem::LoadError
|
306
|
-
nil
|
307
|
-
end
|
308
|
-
when Isolate::Entry then
|
309
|
-
dep.specification
|
310
|
-
else
|
311
|
-
raise "unknown dep: #{dep.inspect}"
|
312
|
-
end
|
313
|
-
|
314
|
-
if spec then
|
292
|
+
spec = index.find_name(dep.name, dep.requirement).last
|
293
|
+
|
294
|
+
if spec
|
315
295
|
specs.concat legitimize!(spec.runtime_dependencies)
|
316
296
|
specs << spec
|
317
297
|
end
|
@@ -319,8 +299,5 @@ module Isolate
|
|
319
299
|
|
320
300
|
specs.uniq
|
321
301
|
end
|
322
|
-
|
323
|
-
extend Deprecate
|
324
|
-
deprecate :index, :none, 2011, 11
|
325
302
|
end
|
326
303
|
end
|
@@ -7,6 +7,7 @@ Gem::Specification.new do |s|
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.3.1") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Ryan Davis"]
|
9
9
|
s.date = %q{2009-08-07}
|
10
|
+
s.default_executable = %q{sow}
|
10
11
|
s.description = %q{Hoe is a rake/rubygems helper for project Rakefiles. It helps generate
|
11
12
|
rubygems and includes a dynamic plug-in system allowing for easy
|
12
13
|
extensibility. Hoe ships with plug-ins for all your usual project
|
@@ -7,6 +7,7 @@ Gem::Specification.new do |s|
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Jim Weirich"]
|
9
9
|
s.date = %q{2009-05-14}
|
10
|
+
s.default_executable = %q{rake}
|
10
11
|
s.description = %q{Rake is a Make-like program implemented in Ruby. Tasks and dependencies are specified in standard Ruby syntax.}
|
11
12
|
s.email = %q{jim@weirichhouse.org}
|
12
13
|
s.executables = ["rake"]
|
@@ -7,6 +7,7 @@ Gem::Specification.new do |s|
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Ryan Davis", "Eric Hodel", "Ara T Howard"]
|
9
9
|
s.date = %q{2009-07-21}
|
10
|
+
s.default_executable = %q{rubyforge}
|
10
11
|
s.description = %q{A script which automates a limited set of rubyforge operations.
|
11
12
|
|
12
13
|
* Run 'rubyforge help' for complete usage.
|
data/test/isolate/test.rb
CHANGED
@@ -1,14 +1,10 @@
|
|
1
1
|
require "isolate"
|
2
2
|
require "minitest/autorun"
|
3
3
|
|
4
|
-
ENV.delete "RUBYOPT" # Rakefile uses isolate, so we don't want this
|
5
|
-
|
6
4
|
module Isolate
|
7
|
-
Sandbox::DEFAULT_PATH.replace "tmp/test" # change isolate dir for testing
|
8
|
-
|
9
5
|
class Test < MiniTest::Unit::TestCase
|
10
6
|
def setup
|
11
|
-
|
7
|
+
Gem.refresh
|
12
8
|
|
13
9
|
@env = ENV.to_hash
|
14
10
|
@lp = $LOAD_PATH.dup
|
@@ -23,7 +19,7 @@ module Isolate
|
|
23
19
|
$LOAD_PATH.replace @lp
|
24
20
|
$LOADED_FEATURES.replace @lf
|
25
21
|
|
26
|
-
FileUtils.rm_rf "tmp/
|
22
|
+
FileUtils.rm_rf "tmp/isolate"
|
27
23
|
end
|
28
24
|
end
|
29
25
|
end
|
data/test/test_isolate.rb
CHANGED
@@ -31,10 +31,7 @@ class TestIsolate < Isolate::Test
|
|
31
31
|
def test_self_now!
|
32
32
|
assert_nil Isolate.sandbox
|
33
33
|
|
34
|
-
Isolate.now!
|
35
|
-
:multiruby => false,
|
36
|
-
:system => false,
|
37
|
-
:verbose => false) do
|
34
|
+
Isolate.now! :path => WITH_HOE, :multiruby => false, :system => false do
|
38
35
|
gem "hoe"
|
39
36
|
end
|
40
37
|
|
data/test/test_isolate_entry.rb
CHANGED
@@ -2,7 +2,6 @@ require "isolate/test"
|
|
2
2
|
|
3
3
|
class TestIsolateSandbox < Isolate::Test
|
4
4
|
WITH_HOE = "test/fixtures/with-hoe"
|
5
|
-
SYSTEM = "test/fixtures/system"
|
6
5
|
|
7
6
|
def setup
|
8
7
|
@sandbox = sandbox
|
@@ -56,72 +55,15 @@ class TestIsolateSandbox < Isolate::Test
|
|
56
55
|
# TODO: cleanup with 2 versions of same gem, 1 activated
|
57
56
|
# TODO: install with 1 older version, 1 new gem to be installed
|
58
57
|
|
59
|
-
def
|
60
|
-
|
61
|
-
|
58
|
+
def test_cleanup
|
59
|
+
s = sandbox :path => WITH_HOE, :install => true, :cleanup => true
|
60
|
+
s.activate # no gems on purpose
|
62
61
|
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
expected = [["hoe", "2.3.3", WITH_HOE],
|
68
|
-
["rake", "0.8.7", WITH_HOE],
|
69
|
-
["rubyforge", "1.0.4", WITH_HOE]]
|
62
|
+
expected = [["hoe", "2.3.3", WITH_HOE],
|
63
|
+
["rake", "0.8.7", WITH_HOE],
|
64
|
+
["rubyforge", "1.0.4", WITH_HOE]]
|
70
65
|
|
71
|
-
|
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
|
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)
|
113
|
-
|
114
|
-
s.gem "rake", "0.8.7"
|
115
|
-
|
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
|
66
|
+
assert_equal expected, Gem::Uninstaller.value
|
125
67
|
end
|
126
68
|
|
127
69
|
def test_disable
|
@@ -171,8 +113,6 @@ class TestIsolateSandbox < Isolate::Test
|
|
171
113
|
end
|
172
114
|
|
173
115
|
def test_idempotent_rubyopt_env
|
174
|
-
assert_nil ENV["RUBYOPT"], "sanity check to make sure ENV isn't infecting"
|
175
|
-
|
176
116
|
@sandbox.enable
|
177
117
|
rubyopt = ENV["RUBYOPT"]
|
178
118
|
@sandbox.disable
|
@@ -249,7 +189,7 @@ class TestIsolateSandbox < Isolate::Test
|
|
249
189
|
|
250
190
|
assert_equal [], s.entries
|
251
191
|
assert_equal [], s.environments
|
252
|
-
assert_match(/tmp\/
|
192
|
+
assert_match(/tmp\/isolate/, s.path)
|
253
193
|
|
254
194
|
assert s.cleanup?
|
255
195
|
assert s.install?
|
@@ -259,12 +199,9 @@ class TestIsolateSandbox < Isolate::Test
|
|
259
199
|
end
|
260
200
|
|
261
201
|
def test_initialize_override_defaults
|
262
|
-
s = Isolate::Sandbox.new
|
263
|
-
|
264
|
-
|
265
|
-
:system => false,
|
266
|
-
:verbose => false,
|
267
|
-
:multiruby => false)
|
202
|
+
s = Isolate::Sandbox.new :path => "x", :cleanup => false,
|
203
|
+
:install => false, :system => false,
|
204
|
+
:verbose => false, :multiruby => false
|
268
205
|
|
269
206
|
assert_equal File.expand_path("x"), s.path
|
270
207
|
|
@@ -306,11 +243,11 @@ class TestIsolateSandbox < Isolate::Test
|
|
306
243
|
|
307
244
|
v = [Gem.ruby_engine, RbConfig::CONFIG["ruby_version"]].join "-"
|
308
245
|
s = sandbox :multiruby => true
|
309
|
-
p = File.expand_path("tmp/
|
246
|
+
p = File.expand_path("tmp/isolate/#{v}")
|
310
247
|
|
311
248
|
assert_equal p, s.path
|
312
249
|
|
313
|
-
s = sandbox :path => "tmp/
|
250
|
+
s = sandbox :path => "tmp/isolate/#{v}", :multiruby => false
|
314
251
|
assert_equal p, s.path
|
315
252
|
end
|
316
253
|
|
@@ -324,27 +261,15 @@ class TestIsolateSandbox < Isolate::Test
|
|
324
261
|
"#{name} is NOT a loaded gemspec, and it should be!"
|
325
262
|
end
|
326
263
|
|
327
|
-
def sandbox
|
328
|
-
|
264
|
+
def sandbox *args, &block
|
265
|
+
opts = {
|
329
266
|
:install => false,
|
330
267
|
:system => false,
|
331
268
|
:verbose => false,
|
332
269
|
:multiruby => false
|
333
270
|
}
|
334
271
|
|
335
|
-
|
336
|
-
|
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
|
272
|
+
opts.merge! args.pop if Hash === args.last
|
273
|
+
Isolate::Sandbox.new opts, &block
|
349
274
|
end
|
350
275
|
end
|
metadata
CHANGED
@@ -1,90 +1,68 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: isolate
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
4
|
+
prerelease: true
|
6
5
|
segments:
|
7
6
|
- 3
|
7
|
+
- 1
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
|
9
|
+
- pre
|
10
|
+
- 1
|
11
|
+
version: 3.1.0.pre.1
|
11
12
|
platform: ruby
|
12
13
|
authors:
|
13
14
|
- John Barnette
|
14
15
|
- Ryan Davis
|
15
16
|
autorequire:
|
16
17
|
bindir: bin
|
17
|
-
cert_chain:
|
18
|
-
- |
|
19
|
-
-----BEGIN CERTIFICATE-----
|
20
|
-
MIIDPjCCAiagAwIBAgIBADANBgkqhkiG9w0BAQUFADBFMRMwEQYDVQQDDApyeWFu
|
21
|
-
ZC1ydWJ5MRkwFwYKCZImiZPyLGQBGRYJemVuc3BpZGVyMRMwEQYKCZImiZPyLGQB
|
22
|
-
GRYDY29tMB4XDTA5MDMwNjE4NTMxNVoXDTEwMDMwNjE4NTMxNVowRTETMBEGA1UE
|
23
|
-
AwwKcnlhbmQtcnVieTEZMBcGCgmSJomT8ixkARkWCXplbnNwaWRlcjETMBEGCgmS
|
24
|
-
JomT8ixkARkWA2NvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALda
|
25
|
-
b9DCgK+627gPJkB6XfjZ1itoOQvpqH1EXScSaba9/S2VF22VYQbXU1xQXL/WzCkx
|
26
|
-
taCPaLmfYIaFcHHCSY4hYDJijRQkLxPeB3xbOfzfLoBDbjvx5JxgJxUjmGa7xhcT
|
27
|
-
oOvjtt5P8+GSK9zLzxQP0gVLS/D0FmoE44XuDr3iQkVS2ujU5zZL84mMNqNB1znh
|
28
|
-
GiadM9GHRaDiaxuX0cIUBj19T01mVE2iymf9I6bEsiayK/n6QujtyCbTWsAS9Rqt
|
29
|
-
qhtV7HJxNKuPj/JFH0D2cswvzznE/a5FOYO68g+YCuFi5L8wZuuM8zzdwjrWHqSV
|
30
|
-
gBEfoTEGr7Zii72cx+sCAwEAAaM5MDcwCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAw
|
31
|
-
HQYDVR0OBBYEFEfFe9md/r/tj/Wmwpy+MI8d9k/hMA0GCSqGSIb3DQEBBQUAA4IB
|
32
|
-
AQAY59gYvDxqSqgC92nAP9P8dnGgfZgLxP237xS6XxFGJSghdz/nI6pusfCWKM8m
|
33
|
-
vzjjH2wUMSSf3tNudQ3rCGLf2epkcU13/rguI88wO6MrE0wi4ZqLQX+eZQFskJb/
|
34
|
-
w6x9W1ur8eR01s397LSMexySDBrJOh34cm2AlfKr/jokKCTwcM0OvVZnAutaovC0
|
35
|
-
l1SVZ0ecg88bsWHA0Yhh7NFxK1utWoIhtB6AFC/+trM0FQEB/jZkIS8SaNzn96Rl
|
36
|
-
n0sZEf77FLf5peR8TP/PtmIg7Cyqz23sLM4mCOoTGIy5OcZ8TdyiyINUHtb5ej/T
|
37
|
-
FBHgymkyj/AOSqKRIpXPhjC6
|
38
|
-
-----END CERTIFICATE-----
|
18
|
+
cert_chain: []
|
39
19
|
|
40
|
-
date:
|
20
|
+
date: 2010-10-22 00:00:00 -07:00
|
21
|
+
default_executable:
|
41
22
|
dependencies:
|
42
23
|
- !ruby/object:Gem::Dependency
|
43
|
-
name:
|
24
|
+
name: hoe-doofus
|
44
25
|
prerelease: false
|
45
26
|
requirement: &id001 !ruby/object:Gem::Requirement
|
46
27
|
none: false
|
47
28
|
requirements:
|
48
|
-
- -
|
29
|
+
- - "="
|
49
30
|
- !ruby/object:Gem::Version
|
50
|
-
hash: 11
|
51
31
|
segments:
|
52
|
-
- 2
|
53
32
|
- 1
|
54
33
|
- 0
|
55
|
-
|
34
|
+
- 0
|
35
|
+
version: 1.0.0
|
56
36
|
type: :development
|
57
37
|
version_requirements: *id001
|
58
38
|
- !ruby/object:Gem::Dependency
|
59
|
-
name: hoe-
|
39
|
+
name: hoe-git
|
60
40
|
prerelease: false
|
61
41
|
requirement: &id002 !ruby/object:Gem::Requirement
|
62
42
|
none: false
|
63
43
|
requirements:
|
64
|
-
- -
|
44
|
+
- - "="
|
65
45
|
- !ruby/object:Gem::Version
|
66
|
-
hash: 23
|
67
46
|
segments:
|
68
47
|
- 1
|
48
|
+
- 3
|
69
49
|
- 0
|
70
|
-
|
71
|
-
version: 1.0.0
|
50
|
+
version: 1.3.0
|
72
51
|
type: :development
|
73
52
|
version_requirements: *id002
|
74
53
|
- !ruby/object:Gem::Dependency
|
75
|
-
name:
|
54
|
+
name: minitest
|
76
55
|
prerelease: false
|
77
56
|
requirement: &id003 !ruby/object:Gem::Requirement
|
78
57
|
none: false
|
79
58
|
requirements:
|
80
|
-
- -
|
59
|
+
- - "="
|
81
60
|
- !ruby/object:Gem::Version
|
82
|
-
hash: 27
|
83
61
|
segments:
|
84
62
|
- 1
|
85
|
-
-
|
86
|
-
-
|
87
|
-
version: 1.
|
63
|
+
- 7
|
64
|
+
- 2
|
65
|
+
version: 1.7.2
|
88
66
|
type: :development
|
89
67
|
version_requirements: *id003
|
90
68
|
- !ruby/object:Gem::Dependency
|
@@ -95,12 +73,11 @@ dependencies:
|
|
95
73
|
requirements:
|
96
74
|
- - ">="
|
97
75
|
- !ruby/object:Gem::Version
|
98
|
-
hash: 35
|
99
76
|
segments:
|
100
77
|
- 2
|
101
|
-
-
|
102
|
-
-
|
103
|
-
version: 2.
|
78
|
+
- 6
|
79
|
+
- 2
|
80
|
+
version: 2.6.2
|
104
81
|
type: :development
|
105
82
|
version_requirements: *id004
|
106
83
|
description: |-
|
@@ -142,7 +119,7 @@ files:
|
|
142
119
|
- test/test_isolate_entry.rb
|
143
120
|
- test/test_isolate_events.rb
|
144
121
|
- test/test_isolate_sandbox.rb
|
145
|
-
|
122
|
+
has_rdoc: true
|
146
123
|
homepage: http://github.com/jbarnette/isolate
|
147
124
|
licenses: []
|
148
125
|
|
@@ -157,25 +134,25 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
157
134
|
requirements:
|
158
135
|
- - ">="
|
159
136
|
- !ruby/object:Gem::Version
|
160
|
-
hash: 3
|
161
137
|
segments:
|
162
|
-
-
|
163
|
-
|
138
|
+
- 1
|
139
|
+
- 8
|
140
|
+
- 6
|
141
|
+
version: 1.8.6
|
164
142
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
165
143
|
none: false
|
166
144
|
requirements:
|
167
145
|
- - ">="
|
168
146
|
- !ruby/object:Gem::Version
|
169
|
-
hash: 51
|
170
147
|
segments:
|
171
148
|
- 1
|
172
|
-
-
|
173
|
-
-
|
174
|
-
version: 1.
|
149
|
+
- 3
|
150
|
+
- 6
|
151
|
+
version: 1.3.6
|
175
152
|
requirements: []
|
176
153
|
|
177
154
|
rubyforge_project: isolate
|
178
|
-
rubygems_version: 1.
|
155
|
+
rubygems_version: 1.3.7
|
179
156
|
signing_key:
|
180
157
|
specification_version: 3
|
181
158
|
summary: Isolate is a very simple RubyGems sandbox
|
data.tar.gz.sig
DELETED
Binary file
|
data/.gemtest
DELETED
File without changes
|
metadata.gz.sig
DELETED
Binary file
|