isolate 3.1.0.pre.3 → 3.1.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.
@@ -0,0 +1,2 @@
1
+ �C
2
+ ��X�x8�0i�ꃨ�Mg6�;�(o[\����CE�4������o�g���$:��u8\�e(Ƌ�[> �?�Q'oZff�-�rX��2�gh(ɬZ`K�����W�ͫK<�g)�f��#˥7e���D ��A L�2������s<)U���U��R�g�fyTj�NH�@��D��/�]e�P�!8��y�������T�?����E#��� N�{�`H0�P��� ��Z��Q�ӓ��
data/.autotest CHANGED
@@ -1,5 +1,9 @@
1
+ # -*- ruby -*-
2
+
1
3
  require "autotest/restart"
2
4
 
3
5
  Autotest.add_hook :initialize do |at|
4
6
  at.testlib = "minitest/autorun"
7
+ at.add_exception "tmp"
8
+ at.add_exception ".git"
5
9
  end
File without changes
@@ -1,3 +1,45 @@
1
+ === 3.1.0 / 2011-05-19
2
+
3
+ * 4 minor enhancements:
4
+
5
+ * Added ZenTest as a development dependency so rake multi works in isolation.
6
+ * Added rake task git:freshen to forcefully remove stale gems.
7
+ * Extracted remove from cleanup method so rake tasks can use remove.
8
+ * Switched to minitest plugin in hoe spec
9
+
10
+ * 6 bug fixes:
11
+
12
+ * Fixed 1.9.x warnings
13
+ * Fixed a test broken only in isolation from hoe itself.
14
+ * Fixed an enumeration bug caused by my not running `rake multi` sooner. (Eric Wong)
15
+ * Fixed requirements in readme.
16
+ * Hoe plugin now properly adds development dependencies.
17
+ * Hoe plugin now properly uses (and possibly defines) the Isolate.sandbox.
18
+
19
+ === 3.0.2 / 2011-05-14
20
+
21
+ * 3 bug fixes:
22
+
23
+ * Cleanup shouldn't try to uninstall specs outside of our sandbox.
24
+ * Pass spec.base_dir to the uninstaller during cleanup.
25
+ * We shouldn't manipulate Gem.path, but if we do, we should be smart/clean about it.
26
+
27
+ === 3.0.1 / 2011-05-11
28
+
29
+ * 6 minor enhancements:
30
+
31
+ * Added Entry#to_s and #inspect to make it much more readable.
32
+ * Added Isolate.sandbox= and used it from Hoe::Isolate plugin.
33
+ * Deprecated Sandbox#index.
34
+ * Entry#specification now returns nil if it doesn't resolve to anything.
35
+ * Refactored Sandbox's default path so that tests won't collide with our Rakefile.
36
+ * We now require rubygems >= 1.8.2.
37
+
38
+ * 2 bug fixes:
39
+
40
+ * Cleaned up all warnings caused by rubygems 1.8 deprecations.
41
+ * Fixed Sandbox#legitimize! to properly deal with Gem::Dependency.
42
+
1
43
  === 3.0.0 / 2010-10-19
2
44
 
3
45
  * Remove deprecated Isolate.{gems,instance} methods.
@@ -1,16 +1,12 @@
1
1
  .autotest
2
- .rvmrc
3
2
  CHANGELOG.rdoc
4
- Isolate
5
3
  Manifest.txt
6
4
  README.rdoc
7
5
  Rakefile
8
6
  lib/hoe/isolate.rb
9
7
  lib/isolate.rb
10
- lib/isolate/completely.rb
11
8
  lib/isolate/entry.rb
12
9
  lib/isolate/events.rb
13
- lib/isolate/installer.rb
14
10
  lib/isolate/now.rb
15
11
  lib/isolate/rake.rb
16
12
  lib/isolate/sandbox.rb
@@ -18,6 +14,7 @@ test/fixtures/blort-0.0.gem
18
14
  test/fixtures/isolate.rb
19
15
  test/fixtures/override.rb
20
16
  test/fixtures/override.rb.local
17
+ test/fixtures/system/specifications/rcov-0.9.9.gemspec
21
18
  test/fixtures/with-hoe/specifications/hoe-2.3.3.gemspec
22
19
  test/fixtures/with-hoe/specifications/rake-0.8.7.gemspec
23
20
  test/fixtures/with-hoe/specifications/rubyforge-1.0.4.gemspec
@@ -21,7 +21,7 @@ and is probably a better fit for you.
21
21
 
22
22
  == Requirements
23
23
 
24
- RubyGems 1.3.6 or better, Ruby 1.8.6 or better.
24
+ RubyGems 1.8.2 or better, Ruby 1.8.7 or better.
25
25
 
26
26
  == Getting Started
27
27
 
@@ -83,7 +83,7 @@ your lib's development, runtime, and test dependencies without
83
83
  polluting your system RubyGems, and run your tests/specs in total
84
84
  isolation.
85
85
 
86
- Assuming you have a recent Hoe and isolate's installed, it's as simple
86
+ Assuming you have a recent Hoe and Isolate is installed, it's as simple
87
87
  as putting:
88
88
 
89
89
  Hoe.plugin :isolate
data/Rakefile CHANGED
@@ -1,20 +1,30 @@
1
- $:.unshift "./lib"
2
- require "isolate/now"
3
-
1
+ require "rubygems"
4
2
  require "hoe"
5
3
 
4
+ $:.unshift "lib"
5
+ require "isolate/rake"
6
+
7
+ # TODO: build sandboxing into rubygems and make it a first class citizen in Hoe
8
+ Isolate.now! :system => false do
9
+ env "development" do
10
+ gem "hoe-seattlerb", "> 0"
11
+ gem "minitest", "~> 2.1"
12
+ gem "hoe-doofus", "~> 1.0.0"
13
+ gem "hoe-git", "~> 1.3"
14
+ gem "ZenTest", "~> 4.5"
15
+ end
16
+ end
17
+
6
18
  Hoe.plugins.delete :rubyforge
7
- Hoe.plugin :doofus, :git, :isolate
19
+ Hoe.plugin :isolate, :doofus, :git, :minitest
8
20
 
9
21
  Hoe.spec "isolate" do
10
22
  developer "John Barnette", "code@jbarnette.com"
11
23
  developer "Ryan Davis", "ryand-ruby@zenspider.com"
12
24
 
13
- require_ruby_version ">= 1.8.6"
14
- require_rubygems_version ">= 1.3.6"
25
+ require_rubygems_version ">= 1.8.2"
15
26
 
16
27
  self.extra_rdoc_files = Dir["*.rdoc"]
17
28
  self.history_file = "CHANGELOG.rdoc"
18
29
  self.readme_file = "README.rdoc"
19
- self.testlib = :minitest
20
30
  end
@@ -28,9 +28,10 @@ class Hoe # :nodoc:
28
28
  Hoe.plugins.unshift Hoe.plugins.delete(:isolate)
29
29
 
30
30
  self.isolate_dir ||= "tmp/isolate"
31
- @sandbox = ::Isolate::Sandbox.new
32
31
 
33
- @sandbox.entries.each do |entry|
32
+ ::Isolate.sandbox ||= ::Isolate::Sandbox.new
33
+
34
+ ::Isolate.sandbox.entries.each do |entry|
34
35
  dep = [entry.name, *entry.requirement.as_list]
35
36
 
36
37
  if entry.environments.include? "development"
@@ -42,16 +43,22 @@ class Hoe # :nodoc:
42
43
  end
43
44
 
44
45
  def define_isolate_tasks # HACK
46
+ sandbox = ::Isolate.sandbox
45
47
 
46
48
  # reset, now that they've had a chance to change it
47
- @sandbox.options :path => isolate_dir, :system => false
49
+ sandbox.options :path => isolate_dir, :system => false
50
+
51
+ self.extra_deps.each do |name, version|
52
+ sandbox.gem name, *Array(version)
53
+ end
48
54
 
49
- # allows traditional extra{_dev}_deps calls to override
50
- (self.extra_deps + self.extra_dev_deps).each do |name, version|
51
- @sandbox.gem name, *Array(version)
55
+ self.extra_dev_deps.each do |name, version|
56
+ sandbox.env "development" do
57
+ sandbox.gem name, *Array(version)
58
+ end
52
59
  end
53
60
 
54
- @sandbox.activate
61
+ sandbox.activate
55
62
  end
56
63
  end
57
64
  end
@@ -8,7 +8,7 @@ module Isolate
8
8
 
9
9
  # Duh.
10
10
 
11
- VERSION = "3.1.0.pre.3"
11
+ VERSION = "3.1.0"
12
12
 
13
13
  # Disable Isolate. If a block is provided, isolation will be
14
14
  # disabled for the scope of the block.
@@ -34,6 +34,13 @@ 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
+
37
44
  # Declare an isolated RubyGems environment, installed in +path+. Any
38
45
  # block given will be <tt>instance_eval</tt>ed, see
39
46
  # Isolate::Sandbox#gem and Isolate::Sandbox#environment for the sort
@@ -70,10 +77,11 @@ module Isolate
70
77
  end
71
78
 
72
79
  # Poke RubyGems, since we've probably monkeyed with a bunch of paths
73
- # and suchlike. Deprecated and scheduled for removal in v4.0.0.
80
+ # and suchlike. Clears paths, loaded specs, and source indexes.
74
81
 
75
82
  def self.refresh # :nodoc:
76
- $stderr.puts "Deprecated, removal in v4.0.0. Use Gem.refresh."
77
- Gem.refresh
83
+ Gem.loaded_specs.clear
84
+ Gem.clear_paths
85
+ Gem::Specification.reset
78
86
  end
79
87
  end
@@ -1,5 +1,4 @@
1
1
  require "isolate/events"
2
- require "isolate/installer"
3
2
  require "rubygems"
4
3
  require "rubygems/command"
5
4
  require "rubygems/dependency_installer"
@@ -68,7 +67,9 @@ module Isolate
68
67
 
69
68
  def activate
70
69
  fire :activating, :activated do
71
- Gem.activate name, *requirement.as_list
70
+ spec = self.specification
71
+ raise Gem::LoadError, "Couldn't resolve: #{self}" unless spec
72
+ spec.activate
72
73
  end
73
74
  end
74
75
 
@@ -80,7 +81,12 @@ module Isolate
80
81
 
81
82
  begin
82
83
  fire :installing, :installed do
83
- installer = Isolate::Installer.new @sandbox
84
+
85
+ installer =
86
+ Gem::DependencyInstaller.new(:development => false,
87
+ :generate_rdoc => false,
88
+ :generate_ri => false,
89
+ :install_dir => @sandbox.path)
84
90
 
85
91
  Gem.sources += Array(options[:source]) if options[:source]
86
92
  Gem::Command.build_args = Array(options[:args]) if options[:args]
@@ -106,10 +112,12 @@ module Isolate
106
112
  name == spec.name and requirement.satisfied_by? spec.version
107
113
  end
108
114
 
109
- # The Gem::Specification for this entry.
115
+ # The Gem::Specification for this entry or nil if it isn't resolveable.
110
116
 
111
117
  def specification
112
- Gem.source_index.find_name(name, requirement).first
118
+ Gem::Specification.find_by_name(name, requirement)
119
+ rescue Gem::LoadError
120
+ nil
113
121
  end
114
122
 
115
123
  # Updates this entry's environments, options, and
@@ -125,5 +133,11 @@ module Isolate
125
133
 
126
134
  self
127
135
  end
136
+
137
+ def to_s
138
+ "Entry[#{name.inspect}, #{requirement.to_s.inspect}]"
139
+ end
140
+
141
+ alias :inspect :to_s
128
142
  end
129
143
  end
@@ -1,3 +1,5 @@
1
+ require "isolate"
2
+
1
3
  namespace :isolate do
2
4
  desc "Show current isolated environment."
3
5
  task :env do
@@ -48,22 +50,14 @@ namespace :isolate do
48
50
 
49
51
  desc "Which isolated gems have updates available?"
50
52
  task :stale do
51
- require "rubygems/source_index"
52
- require "rubygems/spec_fetcher"
53
-
54
- index = Gem::SourceIndex.new
55
53
  outdated = []
54
+ sandbox = Isolate.sandbox
55
+ outdated = sandbox.entries.reject { |entry| entry.specification }
56
56
 
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 }
57
+ Gem::Specification.outdated.each do |name|
58
+ entry = sandbox.entries.find { |e| e.name == name }
59
+ next unless entry
60
+ outdated << entry
67
61
  end
68
62
 
69
63
  outdated.sort_by { |e| e.name }.each do |entry|
@@ -75,4 +69,19 @@ namespace :isolate do
75
69
  puts "#{entry.name} (#{local} < #{remote})"
76
70
  end
77
71
  end
72
+
73
+ desc "Removes gems that have updates available"
74
+ task :freshen do
75
+ outdated = []
76
+ sandbox = Isolate.sandbox
77
+ extra = sandbox.entries.reject { |entry| entry.specification }
78
+
79
+ Gem::Specification.outdated.each do |name|
80
+ entry = sandbox.entries.find { |e| e.name == name }
81
+ next unless entry
82
+ extra << entry.specification
83
+ end
84
+
85
+ sandbox.remove(*extra)
86
+ end
78
87
  end
@@ -4,6 +4,7 @@ require "isolate/events"
4
4
  require "rbconfig"
5
5
  require "rubygems/defaults"
6
6
  require "rubygems/uninstaller"
7
+ require "rubygems/deprecate"
7
8
 
8
9
  module Isolate
9
10
 
@@ -13,6 +14,8 @@ module Isolate
13
14
  class Sandbox
14
15
  include Events
15
16
 
17
+ DEFAULT_PATH = "tmp/isolate" # :nodoc:
18
+
16
19
  attr_reader :entries # :nodoc:
17
20
  attr_reader :environments # :nodoc:
18
21
  attr_reader :files # :nodoc:
@@ -83,26 +86,14 @@ module Isolate
83
86
  def cleanup # :nodoc:
84
87
  fire :cleaning
85
88
 
86
- installed = index.gems.values.sort
89
+ installed = Gem::Specification.map.to_a
87
90
  legit = legitimize!
88
91
  extra = installed - legit
89
92
 
90
- unless extra.empty?
91
- padding = Math.log10(extra.size).to_i + 1
92
- format = "[%0#{padding}d/%s] Nuking %s."
93
+ gem_dir = Gem.dir
94
+ extra.reject! { |s| s.base_dir != gem_dir }
93
95
 
94
- extra.each_with_index do |e, i|
95
- log format % [i + 1, extra.size, e.full_name]
96
-
97
- Gem::DefaultUserInteraction.use_ui Gem::SilentUI.new do
98
- Gem::Uninstaller.new(e.name,
99
- :version => e.version,
100
- :ignore => true,
101
- :executables => true,
102
- :install_dir => path).uninstall
103
- end
104
- end
105
- end
96
+ self.remove(*extra)
106
97
 
107
98
  fire :cleaned
108
99
  end
@@ -116,12 +107,11 @@ module Isolate
116
107
  fire :disabling
117
108
 
118
109
  ENV.replace @old_env
110
+ $LOAD_PATH.replace @old_load_path
119
111
 
120
112
  @enabled = false
121
113
 
122
- Gem.clear_paths
123
- Gem.refresh
124
-
114
+ Isolate.refresh
125
115
  fire :disabled
126
116
 
127
117
  begin; return yield ensure enable end if block_given?
@@ -133,20 +123,31 @@ module Isolate
133
123
  return self if enabled?
134
124
  fire :enabling
135
125
 
136
- @old_env = ENV.to_hash
126
+ @old_env = ENV.to_hash
127
+ @old_load_path = $LOAD_PATH.dup
128
+
129
+ path = self.path
130
+
131
+ FileUtils.mkdir_p path
132
+ ENV["GEM_HOME"] = path
137
133
 
138
134
  unless system?
135
+ isolate_lib = File.expand_path "../..", __FILE__
136
+
137
+ # manually deactivate pre-isolate gems... is this just for 1.9.1?
138
+ $LOAD_PATH.reject! do |p|
139
+ p != isolate_lib && Gem.path.any? { |gp| p.include?(gp) }
140
+ end
139
141
 
140
142
  # HACK: Gotta keep isolate explicitly in the LOAD_PATH in
141
143
  # subshells, and the only way I can think of to do that is by
142
144
  # abusing RUBYOPT.
143
145
 
144
- lib = File.expand_path "../..", __FILE__
145
- dirname = Regexp.escape lib
146
-
147
- unless ENV["RUBYOPT"] =~ /\s+-I\s*#{lib}\b/
148
- ENV["RUBYOPT"] = "#{ENV['RUBYOPT']} -I#{lib}"
146
+ unless ENV["RUBYOPT"] =~ /\s+-I\s*#{Regexp.escape isolate_lib}\b/
147
+ ENV["RUBYOPT"] = "#{ENV['RUBYOPT']} -I#{isolate_lib}"
149
148
  end
149
+
150
+ ENV["GEM_PATH"] = path
150
151
  end
151
152
 
152
153
  bin = File.join path, "bin"
@@ -155,19 +156,13 @@ module Isolate
155
156
  ENV["PATH"] = [bin, ENV["PATH"]].join File::PATH_SEPARATOR
156
157
  end
157
158
 
158
- paths = (ENV["GEM_PATH"] || "").split File::PATH_SEPARATOR
159
- paths.push Gem.dir
160
-
161
- paths.clear unless system?
162
- paths.push path
163
-
164
- Gem.clear_paths
165
-
166
- ENV["GEM_HOME"] = path
167
- ENV["GEM_PATH"] = paths.uniq.join File::PATH_SEPARATOR
168
159
  ENV["ISOLATED"] = path
169
160
 
170
- Gem.refresh
161
+ if system? then
162
+ Gem.path.unshift path # HACK: this is just wrong!
163
+ Gem.path.uniq! # HACK: needed for the previous line :(
164
+ end
165
+ Isolate.refresh
171
166
 
172
167
  @enabled = true
173
168
  fire :enabled
@@ -214,23 +209,19 @@ module Isolate
214
209
  fire :installing
215
210
 
216
211
  installable = entries.select do |e|
217
- !Gem.available?(e.name, *e.requirement.as_list) &&
218
- e.matches?(environment)
212
+ not e.specification && e.matches?(environment)
219
213
  end
220
214
 
221
215
  unless installable.empty?
222
216
  padding = Math.log10(installable.size).to_i + 1
223
217
  format = "[%0#{padding}d/%s] Isolating %s (%s)."
224
218
 
225
- FileUtils.mkdir_p path
226
-
227
219
  installable.each_with_index do |entry, i|
228
220
  log format % [i + 1, installable.size, entry.name, entry.requirement]
229
221
  entry.install
230
-
231
- index.refresh!
232
- Gem.source_index.refresh!
233
222
  end
223
+
224
+ Gem::Specification.reset
234
225
  end
235
226
 
236
227
  fire :installed
@@ -251,7 +242,6 @@ module Isolate
251
242
  $stderr.puts s if verbose?
252
243
  end
253
244
 
254
-
255
245
  def multiruby?
256
246
  @options.fetch :multiruby, true
257
247
  end
@@ -262,7 +252,7 @@ module Isolate
262
252
  end
263
253
 
264
254
  def path
265
- base = @options.fetch :path, "tmp/isolate"
255
+ base = @options.fetch :path, DEFAULT_PATH
266
256
 
267
257
  unless @options.key?(:multiruby) && @options[:multiruby] == false
268
258
  suffix = "#{Gem.ruby_engine}-#{RbConfig::CONFIG['ruby_version']}"
@@ -272,6 +262,27 @@ module Isolate
272
262
  File.expand_path base
273
263
  end
274
264
 
265
+ def remove(*extra)
266
+ unless extra.empty?
267
+ padding = Math.log10(extra.size).to_i + 1
268
+ format = "[%0#{padding}d/%s] Nuking %s."
269
+
270
+ extra.each_with_index do |e, i|
271
+ log format % [i + 1, extra.size, e.full_name]
272
+
273
+ Gem::DefaultUserInteraction.use_ui Gem::SilentUI.new do
274
+ uninstaller =
275
+ Gem::Uninstaller.new(e.name,
276
+ :version => e.version,
277
+ :ignore => true,
278
+ :executables => true,
279
+ :install_dir => e.base_dir)
280
+ uninstaller.uninstall
281
+ end
282
+ end
283
+ end
284
+ end
285
+
275
286
  def system?
276
287
  @options.fetch :system, true
277
288
  end
@@ -291,9 +302,20 @@ module Isolate
291
302
  specs = []
292
303
 
293
304
  deps.flatten.each do |dep|
294
- spec = index.find_name(dep.name, dep.requirement).last
295
-
296
- if spec
305
+ spec = case dep
306
+ when Gem::Dependency then
307
+ begin
308
+ dep.to_spec
309
+ rescue Gem::LoadError
310
+ nil
311
+ end
312
+ when Isolate::Entry then
313
+ dep.specification
314
+ else
315
+ raise "unknown dep: #{dep.inspect}"
316
+ end
317
+
318
+ if spec then
297
319
  specs.concat legitimize!(spec.runtime_dependencies)
298
320
  specs << spec
299
321
  end
@@ -301,5 +323,8 @@ module Isolate
301
323
 
302
324
  specs.uniq
303
325
  end
326
+
327
+ extend Deprecate
328
+ deprecate :index, :none, 2011, 11
304
329
  end
305
330
  end
@@ -0,0 +1,31 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = %q{rcov}
5
+ s.version = "0.9.9"
6
+
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
+ s.authors = [%q{Relevance}, %q{Chad Humphries (spicycode)}, %q{Aaron Bedra (abedra)}, %q{Jay McGaffigan(hooligan495)}, %q{Mauricio Fernandez}]
9
+ s.cert_chain = nil
10
+ s.date = %q{2009-12-28}
11
+ s.description = %q{rcov is a code coverage tool for Ruby. It is commonly used for viewing overall test unit coverage of target code. It features fast execution (20-300 times faster than previous tools), multiple analysis modes, XHTML and several kinds of text reports, easy automation with Rake via a RcovTask, fairly accurate coverage information through code linkage inference using simple heuristics, colorblind-friendliness...}
12
+ s.email = %q{opensource@thinkrelevance.com}
13
+ s.executables = [%q{rcov}]
14
+ s.extensions = [%q{ext/rcovrt/extconf.rb}]
15
+ s.files = [%q{bin/rcov}, %q{ext/rcovrt/extconf.rb}]
16
+ s.homepage = %q{http://github.com/relevance/rcov}
17
+ s.rdoc_options = [%q{--title}, %q{rcov code coverage tool}]
18
+ s.require_paths = [%q{lib}]
19
+ s.required_ruby_version = Gem::Requirement.new("> 0.0.0")
20
+ s.rubygems_version = %q{1.8.2}
21
+ s.summary = %q{Code coverage analysis tool for Ruby}
22
+
23
+ if s.respond_to? :specification_version then
24
+ s.specification_version = 1
25
+
26
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
27
+ else
28
+ end
29
+ else
30
+ end
31
+ end
@@ -7,7 +7,6 @@ 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}
11
10
  s.description = %q{Hoe is a rake/rubygems helper for project Rakefiles. It helps generate
12
11
  rubygems and includes a dynamic plug-in system allowing for easy
13
12
  extensibility. Hoe ships with plug-ins for all your usual project
@@ -7,7 +7,6 @@ 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}
11
10
  s.description = %q{Rake is a Make-like program implemented in Ruby. Tasks and dependencies are specified in standard Ruby syntax.}
12
11
  s.email = %q{jim@weirichhouse.org}
13
12
  s.executables = ["rake"]
@@ -7,7 +7,6 @@ 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}
11
10
  s.description = %q{A script which automates a limited set of rubyforge operations.
12
11
 
13
12
  * Run 'rubyforge help' for complete usage.
@@ -1,10 +1,14 @@
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
+
4
6
  module Isolate
7
+ Sandbox::DEFAULT_PATH.replace "tmp/test" # change isolate dir for testing
8
+
5
9
  class Test < MiniTest::Unit::TestCase
6
10
  def setup
7
- Gem.refresh
11
+ Isolate.refresh
8
12
 
9
13
  @env = ENV.to_hash
10
14
  @lp = $LOAD_PATH.dup
@@ -19,7 +23,7 @@ module Isolate
19
23
  $LOAD_PATH.replace @lp
20
24
  $LOADED_FEATURES.replace @lf
21
25
 
22
- FileUtils.rm_rf "tmp/isolate"
26
+ FileUtils.rm_rf "tmp/test"
23
27
  end
24
28
  end
25
29
  end
@@ -42,7 +46,7 @@ end
42
46
  class Gem::Uninstaller
43
47
  extend BrutalStub
44
48
 
45
- attr_reader :gem, :version, :gem_home
49
+ attr_reader :gem, :version
46
50
  alias old_uninstall uninstall
47
51
 
48
52
  def uninstall
@@ -31,7 +31,10 @@ class TestIsolate < Isolate::Test
31
31
  def test_self_now!
32
32
  assert_nil Isolate.sandbox
33
33
 
34
- Isolate.now! :path => WITH_HOE, :multiruby => false, :system => false do
34
+ Isolate.now!(:path => WITH_HOE,
35
+ :multiruby => false,
36
+ :system => false,
37
+ :verbose => false) do
35
38
  gem "hoe"
36
39
  end
37
40
 
@@ -5,7 +5,7 @@ class TestIsolateEntry < Isolate::Test
5
5
  def setup
6
6
  @sandbox = Object.new
7
7
  def @sandbox.environments; @e ||= [] end
8
- def @sandbox.path; "tmp/gems" end
8
+ def @sandbox.path; "tmp/test" end
9
9
 
10
10
  super
11
11
  end
@@ -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,15 +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 test_cleanup
59
- s = sandbox :path => WITH_HOE, :install => true, :cleanup => true
60
- s.activate # no gems on purpose
59
+ def test_cleanup_all
60
+ with_env_setup do
61
+ s = sandbox :path => WITH_HOE, :install => true, :cleanup => true
61
62
 
62
- expected = [["hoe", "2.3.3", WITH_HOE],
63
- ["rake", "0.8.7", WITH_HOE],
64
- ["rubyforge", "1.0.4", WITH_HOE]]
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]]
65
70
 
66
- assert_equal expected, Gem::Uninstaller.value
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
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
67
125
  end
68
126
 
69
127
  def test_disable
@@ -88,8 +146,8 @@ class TestIsolateSandbox < Isolate::Test
88
146
  end
89
147
 
90
148
  def test_enable
91
- refute_empty Gem.find_files("hoe.rb"),
92
- "There's a hoe.rb somewhere in the current env."
149
+ refute_empty Gem.find_files("rake.rb"),
150
+ "There's a rake.rb somewhere in the current env."
93
151
 
94
152
  assert_same @sandbox, @sandbox.enable
95
153
 
@@ -113,6 +171,8 @@ class TestIsolateSandbox < Isolate::Test
113
171
  end
114
172
 
115
173
  def test_idempotent_rubyopt_env
174
+ assert_nil ENV["RUBYOPT"], "sanity check to make sure ENV isn't infecting"
175
+
116
176
  @sandbox.enable
117
177
  rubyopt = ENV["RUBYOPT"]
118
178
  @sandbox.disable
@@ -189,7 +249,7 @@ class TestIsolateSandbox < Isolate::Test
189
249
 
190
250
  assert_equal [], s.entries
191
251
  assert_equal [], s.environments
192
- assert_match(/tmp\/isolate/, s.path)
252
+ assert_match(/tmp\/test/, s.path)
193
253
 
194
254
  assert s.cleanup?
195
255
  assert s.install?
@@ -199,9 +259,12 @@ class TestIsolateSandbox < Isolate::Test
199
259
  end
200
260
 
201
261
  def test_initialize_override_defaults
202
- s = Isolate::Sandbox.new :path => "x", :cleanup => false,
203
- :install => false, :system => false,
204
- :verbose => false, :multiruby => false
262
+ s = Isolate::Sandbox.new(:path => "x",
263
+ :cleanup => false,
264
+ :install => false,
265
+ :system => false,
266
+ :verbose => false,
267
+ :multiruby => false)
205
268
 
206
269
  assert_equal File.expand_path("x"), s.path
207
270
 
@@ -243,11 +306,11 @@ class TestIsolateSandbox < Isolate::Test
243
306
 
244
307
  v = [Gem.ruby_engine, RbConfig::CONFIG["ruby_version"]].join "-"
245
308
  s = sandbox :multiruby => true
246
- p = File.expand_path("tmp/isolate/#{v}")
309
+ p = File.expand_path("tmp/test/#{v}")
247
310
 
248
311
  assert_equal p, s.path
249
312
 
250
- s = sandbox :path => "tmp/isolate/#{v}", :multiruby => false
313
+ s = sandbox :path => "tmp/test/#{v}", :multiruby => false
251
314
  assert_equal p, s.path
252
315
  end
253
316
 
@@ -261,15 +324,27 @@ class TestIsolateSandbox < Isolate::Test
261
324
  "#{name} is NOT a loaded gemspec, and it should be!"
262
325
  end
263
326
 
264
- def sandbox *args, &block
265
- opts = {
327
+ def sandbox opts = {}, &block
328
+ defaults = {
266
329
  :install => false,
267
330
  :system => false,
268
331
  :verbose => false,
269
332
  :multiruby => false
270
333
  }
271
334
 
272
- opts.merge! args.pop if Hash === args.last
273
- Isolate::Sandbox.new opts, &block
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
274
349
  end
275
350
  end
metadata CHANGED
@@ -1,85 +1,151 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: isolate
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: true
4
+ hash: 3
5
+ prerelease:
5
6
  segments:
6
7
  - 3
7
8
  - 1
8
9
  - 0
9
- - pre
10
- - 3
11
- version: 3.1.0.pre.3
10
+ version: 3.1.0
12
11
  platform: ruby
13
12
  authors:
14
13
  - John Barnette
15
14
  - Ryan Davis
16
15
  autorequire:
17
16
  bindir: bin
18
- cert_chain: []
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-----
19
39
 
20
- date: 2010-10-22 00:00:00 -07:00
21
- default_executable:
40
+ date: 2011-05-19 00:00:00 Z
22
41
  dependencies:
23
42
  - !ruby/object:Gem::Dependency
24
- name: hoe-doofus
43
+ name: hoe-seattlerb
25
44
  prerelease: false
26
45
  requirement: &id001 !ruby/object:Gem::Requirement
27
46
  none: false
28
47
  requirements:
29
- - - "="
48
+ - - ">"
30
49
  - !ruby/object:Gem::Version
50
+ hash: 3
31
51
  segments:
32
- - 1
33
- - 0
34
52
  - 0
35
- version: 1.0.0
53
+ version: "0"
36
54
  type: :development
37
55
  version_requirements: *id001
38
56
  - !ruby/object:Gem::Dependency
39
- name: hoe-git
57
+ name: minitest
40
58
  prerelease: false
41
59
  requirement: &id002 !ruby/object:Gem::Requirement
42
60
  none: false
43
61
  requirements:
44
- - - "="
62
+ - - ~>
45
63
  - !ruby/object:Gem::Version
64
+ hash: 1
46
65
  segments:
66
+ - 2
47
67
  - 1
48
- - 3
49
- - 0
50
- version: 1.3.0
68
+ version: "2.1"
51
69
  type: :development
52
70
  version_requirements: *id002
53
71
  - !ruby/object:Gem::Dependency
54
- name: minitest
72
+ name: hoe-doofus
55
73
  prerelease: false
56
74
  requirement: &id003 !ruby/object:Gem::Requirement
57
75
  none: false
58
76
  requirements:
59
- - - "="
77
+ - - ~>
60
78
  - !ruby/object:Gem::Version
79
+ hash: 23
61
80
  segments:
62
81
  - 1
63
- - 7
64
- - 2
65
- version: 1.7.2
82
+ - 0
83
+ - 0
84
+ version: 1.0.0
66
85
  type: :development
67
86
  version_requirements: *id003
68
87
  - !ruby/object:Gem::Dependency
69
- name: hoe
88
+ name: hoe-git
70
89
  prerelease: false
71
90
  requirement: &id004 !ruby/object:Gem::Requirement
91
+ none: false
92
+ requirements:
93
+ - - ~>
94
+ - !ruby/object:Gem::Version
95
+ hash: 9
96
+ segments:
97
+ - 1
98
+ - 3
99
+ version: "1.3"
100
+ type: :development
101
+ version_requirements: *id004
102
+ - !ruby/object:Gem::Dependency
103
+ name: ZenTest
104
+ prerelease: false
105
+ requirement: &id005 !ruby/object:Gem::Requirement
106
+ none: false
107
+ requirements:
108
+ - - ~>
109
+ - !ruby/object:Gem::Version
110
+ hash: 17
111
+ segments:
112
+ - 4
113
+ - 5
114
+ version: "4.5"
115
+ type: :development
116
+ version_requirements: *id005
117
+ - !ruby/object:Gem::Dependency
118
+ name: minitest
119
+ prerelease: false
120
+ requirement: &id006 !ruby/object:Gem::Requirement
72
121
  none: false
73
122
  requirements:
74
123
  - - ">="
75
124
  - !ruby/object:Gem::Version
125
+ hash: 11
76
126
  segments:
77
127
  - 2
78
- - 6
128
+ - 1
129
+ - 0
130
+ version: 2.1.0
131
+ type: :development
132
+ version_requirements: *id006
133
+ - !ruby/object:Gem::Dependency
134
+ name: hoe
135
+ prerelease: false
136
+ requirement: &id007 !ruby/object:Gem::Requirement
137
+ none: false
138
+ requirements:
139
+ - - ">="
140
+ - !ruby/object:Gem::Version
141
+ hash: 35
142
+ segments:
79
143
  - 2
80
- version: 2.6.2
144
+ - 9
145
+ - 4
146
+ version: 2.9.4
81
147
  type: :development
82
- version_requirements: *id004
148
+ version_requirements: *id007
83
149
  description: |-
84
150
  Isolate is a very simple RubyGems sandbox. It provides a way to
85
151
  express and automatically install your project's Gem dependencies.
@@ -96,18 +162,14 @@ extra_rdoc_files:
96
162
  - README.rdoc
97
163
  files:
98
164
  - .autotest
99
- - .rvmrc
100
165
  - CHANGELOG.rdoc
101
- - Isolate
102
166
  - Manifest.txt
103
167
  - README.rdoc
104
168
  - Rakefile
105
169
  - lib/hoe/isolate.rb
106
170
  - lib/isolate.rb
107
- - lib/isolate/completely.rb
108
171
  - lib/isolate/entry.rb
109
172
  - lib/isolate/events.rb
110
- - lib/isolate/installer.rb
111
173
  - lib/isolate/now.rb
112
174
  - lib/isolate/rake.rb
113
175
  - lib/isolate/sandbox.rb
@@ -115,6 +177,7 @@ files:
115
177
  - test/fixtures/isolate.rb
116
178
  - test/fixtures/override.rb
117
179
  - test/fixtures/override.rb.local
180
+ - test/fixtures/system/specifications/rcov-0.9.9.gemspec
118
181
  - test/fixtures/with-hoe/specifications/hoe-2.3.3.gemspec
119
182
  - test/fixtures/with-hoe/specifications/rake-0.8.7.gemspec
120
183
  - test/fixtures/with-hoe/specifications/rubyforge-1.0.4.gemspec
@@ -123,7 +186,7 @@ files:
123
186
  - test/test_isolate_entry.rb
124
187
  - test/test_isolate_events.rb
125
188
  - test/test_isolate_sandbox.rb
126
- has_rdoc: true
189
+ - .gemtest
127
190
  homepage: http://github.com/jbarnette/isolate
128
191
  licenses: []
129
192
 
@@ -138,25 +201,25 @@ required_ruby_version: !ruby/object:Gem::Requirement
138
201
  requirements:
139
202
  - - ">="
140
203
  - !ruby/object:Gem::Version
204
+ hash: 3
141
205
  segments:
142
- - 1
143
- - 8
144
- - 6
145
- version: 1.8.6
206
+ - 0
207
+ version: "0"
146
208
  required_rubygems_version: !ruby/object:Gem::Requirement
147
209
  none: false
148
210
  requirements:
149
211
  - - ">="
150
212
  - !ruby/object:Gem::Version
213
+ hash: 51
151
214
  segments:
152
215
  - 1
153
- - 3
154
- - 6
155
- version: 1.3.6
216
+ - 8
217
+ - 2
218
+ version: 1.8.2
156
219
  requirements: []
157
220
 
158
221
  rubyforge_project: isolate
159
- rubygems_version: 1.3.7
222
+ rubygems_version: 1.8.2
160
223
  signing_key:
161
224
  specification_version: 3
162
225
  summary: Isolate is a very simple RubyGems sandbox
Binary file
data/.rvmrc DELETED
@@ -1,2 +0,0 @@
1
- rvm_gemset_create_on_use_flag=1
2
- rvm ruby-1.9.2@isolate
data/Isolate DELETED
@@ -1,5 +0,0 @@
1
- env :development do
2
- gem "hoe-doofus", "1.0.0"
3
- gem "hoe-git", "1.3.0"
4
- gem "minitest", "1.7.2"
5
- end
@@ -1,4 +0,0 @@
1
- require "isolate"
2
- require "isolate/rake" if defined?(Rake)
3
-
4
- Isolate.now! :system => false
@@ -1,15 +0,0 @@
1
- require "rubygems/dependency_installer"
2
-
3
- module Isolate
4
- class Installer < Gem::DependencyInstaller
5
- def initialize sandbox
6
- super :development => false,
7
- :generate_rdoc => false,
8
- :generate_ri => false,
9
- :install_dir => sandbox.path
10
-
11
- # reset super's use of sandbox.path exclusively
12
- @source_index = Gem.source_index
13
- end
14
- end
15
- end