isolate 2.0.0.pre.2 → 2.0.0.pre.3

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.
@@ -1,3 +1,10 @@
1
+ === 2.0.0.pre.3 / 2010-05-09
2
+
3
+ * Refactor cleanup. Fixes issue #24.
4
+ * Fix Isolate::Events doco.
5
+ * Clarify Rake task doco.
6
+ * Update useful resources.
7
+
1
8
  === 2.0.0.pre.2 / 2010-05-07
2
9
 
3
10
  * Update docs.
@@ -95,7 +95,9 @@ the top of your Rakefile. See the RDoc for details.
95
95
 
96
96
  == Rake
97
97
 
98
- Isolate provides a few useful Rake tasks.
98
+ Isolate provides a few useful Rake tasks. If you're requiring
99
+ <tt>isolate/now</tt>, you'll get them automatically when you run
100
+ Rake. If not, you can include them by requiring <tt>isolate/rake</tt>.
99
101
 
100
102
  === isolate:env
101
103
 
@@ -161,8 +163,10 @@ public API, please see the RDoc.
161
163
 
162
164
  == Meta
163
165
 
164
- Bugs:: http://github.com/jbarnette/isolate/issues
165
- Email:: isolate@librelist.com
166
+ RDoc:: http://rdoc.info/projects/jbarnette/isolate
167
+ Bugs:: http://github.com/jbarnette/isolate/issues
168
+ IRC:: #isolate on Freenode
169
+ Mailing List:: isolate@librelist.com
166
170
 
167
171
  == License
168
172
 
@@ -8,7 +8,7 @@ module Isolate
8
8
 
9
9
  # Duh.
10
10
 
11
- VERSION = "2.0.0.pre.2"
11
+ VERSION = "2.0.0.pre.3"
12
12
 
13
13
  # Disable Isolate. If a block is provided, isolation will be
14
14
  # disabled for the scope of the block.
@@ -2,9 +2,9 @@ module Isolate
2
2
 
3
3
  # A simple way to watch and extend the Isolate lifecycle.
4
4
  #
5
- # Isolate::Events.watch Isolate::Sandbox, :initialized do |sandbox|
6
- # puts "A sandbox just got initialized: #{sandbox}"
7
- # end
5
+ # Isolate::Events.watch Isolate::Sandbox, :initialized do |sandbox|
6
+ # puts "A sandbox just got initialized: #{sandbox}"
7
+ # end
8
8
  #
9
9
  # Read the source for Isolate::Sandbox and Isolate::Entry to see
10
10
  # what sort of events are fired.
@@ -80,16 +80,9 @@ module Isolate
80
80
  def cleanup # :nodoc:
81
81
  fire :cleaning
82
82
 
83
- activated = Gem.loaded_specs.values.map { |s| s.full_name }
84
- available = Gem.source_index.gems.values.sort
85
-
86
- extra = available.reject do |spec|
87
- active = activated.include? spec.full_name
88
- entry = entries.find { |e| e.matches_spec? spec }
89
- system = !spec.loaded_from.include?(path)
90
-
91
- active or entry or system
92
- end
83
+ installed = index.gems.values.sort
84
+ legit = legitimize!
85
+ extra = installed - legit
93
86
 
94
87
  unless extra.empty?
95
88
  padding = Math.log10(extra.size).to_i + 1
@@ -216,6 +209,12 @@ module Isolate
216
209
  entry
217
210
  end
218
211
 
212
+ # A source index representing only isolated gems.
213
+
214
+ def index
215
+ @index ||= Gem::SourceIndex.from_gems_in File.join(path, "specifications")
216
+ end
217
+
219
218
  def install environment # :nodoc:
220
219
  fire :installing
221
220
 
@@ -233,6 +232,7 @@ module Isolate
233
232
  entry.install
234
233
  end
235
234
 
235
+ index.refresh!
236
236
  Gem.source_index.refresh!
237
237
  end
238
238
 
@@ -282,5 +282,27 @@ module Isolate
282
282
  def verbose?
283
283
  @options.fetch :verbose, true
284
284
  end
285
+
286
+ private
287
+
288
+ # Returns a list of Gem::Specification instances that 1. exist in
289
+ # the isolated gem path, and 2. are allowed to be there. Used in
290
+ # cleanup. It's only an external method 'cause recursion is
291
+ # easier.
292
+
293
+ def legitimize! deps = entries
294
+ [].tap do |specs|
295
+ deps.flatten.each do |dep|
296
+ spec = index.find_name(dep.name, dep.requirement).last
297
+
298
+ if spec
299
+ specs.concat legitimize!(spec.runtime_dependencies)
300
+ specs << spec
301
+ end
302
+ end
303
+
304
+ specs.uniq!
305
+ end
306
+ end
285
307
  end
286
308
  end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: isolate
3
3
  version: !ruby/object:Gem::Version
4
- hash: 1923832045
4
+ hash: 1923832047
5
5
  prerelease: true
6
6
  segments:
7
7
  - 2
8
8
  - 0
9
9
  - 0
10
10
  - pre
11
- - 2
12
- version: 2.0.0.pre.2
11
+ - 3
12
+ version: 2.0.0.pre.3
13
13
  platform: ruby
14
14
  authors:
15
15
  - John Barnette
@@ -18,7 +18,7 @@ autorequire:
18
18
  bindir: bin
19
19
  cert_chain: []
20
20
 
21
- date: 2010-05-07 00:00:00 -07:00
21
+ date: 2010-05-09 00:00:00 -07:00
22
22
  default_executable:
23
23
  dependencies:
24
24
  - !ruby/object:Gem::Dependency