isolate 3.5.1 → 4.0.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b2b55d89acb0e5982a52f30273070453a540483ea7c67572dcf356da83a63406
4
- data.tar.gz: cb87cf7176af4cf28030ec9b8f341d8c8e360b1ac3e8e72c22b24d031043cde9
3
+ metadata.gz: 9f19145cae66a4d26ee98d417052a9afaf99199583c91da97d57488ede521552
4
+ data.tar.gz: 24cd809cf0e9531b2b6383379c7d155333b9331bd9ed84dd50035289ce01b260
5
5
  SHA512:
6
- metadata.gz: '00971ffc02710b27fd3b582c9f5e15e27d26a59cea9467190c22da1e54fd6bdd84c03aad4c31382a0fc57b277efecbfb859f65c17cb4fba866d6e137871137da'
7
- data.tar.gz: a19cb7d860e05bd8b19a3bc74941e7777067c55b7a144c210061e165452a705abb3ebbec29700b037aba70dae246e393686152cf19a8c78480ca06d76c46b9c8
6
+ metadata.gz: 9534c7b2d7c32238591b6d58e528adfa6b37b82e5576e2f7575c2f1dac6fa906aabf9394296286d5c43262f838d266a303e0996ccbf6dec49d3d3098b81caa3f
7
+ data.tar.gz: 882c8c1928d21d9caad63f52f1ca25f52e96c8ef20fb486f7db0329c9d072ca966ada93cbcd9f1cc736199c31752e0a16ba190b77ce0f30583df5d49b23e8b35
checksums.yaml.gz.sig CHANGED
Binary file
data/CHANGELOG.rdoc CHANGED
@@ -1,3 +1,20 @@
1
+ === v4.0.0 / 2024-06-18
2
+
3
+ * 3 major enhancements:
4
+
5
+ * Bump required ruby to 2.7
6
+ * Remove Event and all `fire` calls
7
+ * Removed long deprecated Sandbox#index
8
+
9
+ * 1 minor enhancement:
10
+
11
+ * Added hoe spec accessor to set multiruby.
12
+
13
+ * 2 bug fixes:
14
+
15
+ * Fix Rakefile access to isolated gems (no longer versioned by default).
16
+ * Fix errors created when string literals are frozen.
17
+
1
18
  === 3.5.1 / 2022-06-14
2
19
 
3
20
  * 1 bug fix:
data/Manifest.txt CHANGED
@@ -7,7 +7,6 @@ lib/hoe/isolate.rb
7
7
  lib/isolate.rb
8
8
  lib/isolate/completely.rb
9
9
  lib/isolate/entry.rb
10
- lib/isolate/events.rb
11
10
  lib/isolate/now.rb
12
11
  lib/isolate/rake.rb
13
12
  lib/isolate/sandbox.rb
@@ -24,5 +23,4 @@ test/fixtures/with-hoe/specifications/rubyforge-1.0.4.gemspec
24
23
  test/isolate/test.rb
25
24
  test/test_isolate.rb
26
25
  test/test_isolate_entry.rb
27
- test/test_isolate_events.rb
28
26
  test/test_isolate_sandbox.rb
data/Rakefile CHANGED
@@ -4,7 +4,7 @@ require "hoe"
4
4
  $:.unshift "lib"
5
5
 
6
6
  ENV["GEM_PATH"] ||= ""
7
- ENV["GEM_PATH"] += ":#{Dir["tmp/isolate/ruby-*"].sort.last}"
7
+ ENV["GEM_PATH"] += ":tmp/isolate"
8
8
  Gem.paths = ENV
9
9
 
10
10
  require "isolate/rake"
@@ -17,6 +17,7 @@ Hoe.spec "isolate" do
17
17
  developer "Eric Hodel", "drbrain@segment7.net"
18
18
  developer "John Barnette", "code@jbarnette.com"
19
19
 
20
+ require_ruby_version ">= 2.7"
20
21
  require_rubygems_version ">= 1.8.2"
21
22
 
22
23
  self.extra_rdoc_files = Dir["*.rdoc"]
data/lib/hoe/isolate.rb CHANGED
@@ -22,12 +22,14 @@ class Hoe # :nodoc:
22
22
  # FIX: consider removing this and allowing +isolate_options+ instead.
23
23
 
24
24
  attr_accessor :isolate_dir
25
+ attr_accessor :isolate_multiruby
25
26
 
26
27
  def initialize_isolate
27
28
  # Tee hee! Move ourselves to the front to beat out :test.
28
29
  Hoe.plugins.unshift Hoe.plugins.delete(:isolate)
29
30
 
30
31
  self.isolate_dir ||= "tmp/isolate"
32
+ self.isolate_multiruby ||= false
31
33
 
32
34
  ::Isolate.sandbox ||= ::Isolate::Sandbox.new
33
35
 
@@ -46,7 +48,9 @@ class Hoe # :nodoc:
46
48
  sandbox = ::Isolate.sandbox
47
49
 
48
50
  # reset, now that they've had a chance to change it
49
- sandbox.options :path => isolate_dir, :system => true
51
+ sandbox.options(:path => isolate_dir,
52
+ :multiruby => isolate_multiruby,
53
+ :system => true)
50
54
 
51
55
  task :isolate do
52
56
  self.extra_deps.each do |name, version|
data/lib/isolate/entry.rb CHANGED
@@ -1,4 +1,3 @@
1
- require "isolate/events"
2
1
  require "rubygems"
3
2
  require "rubygems/command"
4
3
  require "rubygems/dependency_installer"
@@ -8,13 +7,9 @@ require "rubygems/version"
8
7
  module Isolate
9
8
 
10
9
  # An isolated Gem, with requirement, environment restrictions, and
11
- # installation options. Generally intended for internal use. This
12
- # class exposes lifecycle events for extension, see Isolate::Events
13
- # for more information.
10
+ # installation options. Generally intended for internal use.
14
11
 
15
12
  class Entry
16
- include Events
17
-
18
13
  # Which environments does this entry care about? Generally an
19
14
  # Array of Strings. An empty array means "all", not "none".
20
15
 
@@ -62,38 +57,31 @@ module Isolate
62
57
  update(*requirements)
63
58
  end
64
59
 
65
- # Activate this entry. Fires <tt>:activating</tt> and
66
- # <tt>:activated</tt>.
60
+ # Activate this entry.
67
61
 
68
62
  def activate
69
- fire :activating, :activated do
70
- spec = self.specification
71
- raise Gem::LoadError, "Couldn't resolve: #{self}" unless spec
72
- spec.activate
73
- end
63
+ spec = self.specification
64
+ raise Gem::LoadError, "Couldn't resolve: #{self}" unless spec
65
+ spec.activate
74
66
  end
75
67
 
76
- # Install this entry in the sandbox. Fires <tt>:installing</tt>
77
- # and <tt>:installed</tt>.
68
+ # Install this entry in the sandbox.
78
69
 
79
70
  def install
80
71
  old = Gem.sources.dup
81
72
 
82
73
  begin
83
- fire :installing, :installed do
74
+ installer =
75
+ Gem::DependencyInstaller.new(:development => false,
76
+ :document => [],
77
+ :generate_rdoc => false,
78
+ :generate_ri => false,
79
+ :install_dir => @sandbox.path)
84
80
 
85
- installer =
86
- Gem::DependencyInstaller.new(:development => false,
87
- :document => [],
88
- :generate_rdoc => false,
89
- :generate_ri => false,
90
- :install_dir => @sandbox.path)
81
+ Gem::Command.build_args = Array(options[:args]) if options[:args]
82
+ Gem.sources += Array(options[:source]) if options[:source]
91
83
 
92
- Gem::Command.build_args = Array(options[:args]) if options[:args]
93
- Gem.sources += Array(options[:source]) if options[:source]
94
-
95
- installer.install @file || name, requirement
96
- end
84
+ installer.install @file || name, requirement
97
85
  ensure
98
86
  Gem.sources = old
99
87
  Gem::Command.build_args = nil
@@ -123,14 +111,12 @@ module Isolate
123
111
 
124
112
  # Updates this entry's environments, options, and
125
113
  # requirement. Environments and options are merged, requirement is
126
- # replaced. Fires <tt>:updating</tt> and <tt>:updated</tt>.
114
+ # replaced.
127
115
 
128
116
  def update *reqs
129
- fire :updating, :updated do
130
- @environments |= @sandbox.environments
131
- @options.merge! reqs.pop if Hash === reqs.last
132
- @requirement = Gem::Requirement.new reqs unless reqs.empty?
133
- end
117
+ @environments |= @sandbox.environments
118
+ @options.merge! reqs.pop if Hash === reqs.last
119
+ @requirement = Gem::Requirement.new reqs unless reqs.empty?
134
120
 
135
121
  self
136
122
  end
@@ -1,10 +1,8 @@
1
1
  require "fileutils"
2
2
  require "isolate/entry"
3
- require "isolate/events"
4
3
  require "rbconfig"
5
4
  require "rubygems/defaults"
6
5
  require "rubygems/uninstaller"
7
- require "rubygems/deprecate"
8
6
 
9
7
  # disable default gems getting in the way of everything.
10
8
 
@@ -19,13 +17,10 @@ end
19
17
 
20
18
  module Isolate
21
19
 
22
- # An isolated environment. This class exposes lifecycle events for
23
- # extension, see Isolate::Events for more information.
20
+ # An isolated environment.
24
21
 
25
22
  class Sandbox
26
- include Events
27
-
28
- DEFAULT_PATH = "tmp/isolate" # :nodoc:
23
+ DEFAULT_PATH = +"tmp/isolate" # :nodoc:
29
24
 
30
25
  attr_reader :entries # :nodoc:
31
26
  attr_reader :environments # :nodoc:
@@ -33,8 +28,7 @@ module Isolate
33
28
 
34
29
  # Create a new Isolate::Sandbox instance. See Isolate.now! for the
35
30
  # most common use of the API. You probably don't want to use this
36
- # constructor directly. Fires <tt>:initializing</tt> and
37
- # <tt>:initialized</tt>.
31
+ # constructor directly.
38
32
 
39
33
  def initialize options = {}, &block
40
34
  @enabled = false
@@ -48,8 +42,6 @@ module Isolate
48
42
  raise ArgumentError, "can't specify both name and path!" if name && path
49
43
  options[:path] = File.expand_path("~/.gem/repos/#{name}") if name
50
44
 
51
- fire :initializing
52
-
53
45
  user = File.expand_path "~/.isolate/user.rb"
54
46
  load user if File.exist? user
55
47
 
@@ -63,13 +55,11 @@ module Isolate
63
55
  load file if file
64
56
 
65
57
  if block_given?
66
- /\@(.+?):\d+/ =~ block.to_s
67
- files << ($1 || "inline block")
58
+ files << (block.to_s[/ (\/.+):\d+/, 1] || "inline block")
68
59
  instance_eval(&block)
69
60
  end
70
61
 
71
62
  load local if local && File.exist?(local)
72
- fire :initialized
73
63
  end
74
64
 
75
65
  # Activate this set of isolated entries, respecting an optional
@@ -78,12 +68,10 @@ module Isolate
78
68
  # everything, and removes any superfluous gem (again, if
79
69
  # necessary). If +environment+ isn't specified, +ISOLATE_ENV+,
80
70
  # +RAILS_ENV+, and +RACK_ENV+ are checked before falling back to
81
- # <tt>"development"</tt>. Fires <tt>:activating</tt> and
82
- # <tt>:activated</tt>.
71
+ # <tt>"development"</tt>.
83
72
 
84
73
  def activate environment = nil
85
74
  enable unless enabled?
86
- fire :activating
87
75
 
88
76
  env = (environment || Isolate.env).to_s
89
77
 
@@ -94,14 +82,11 @@ module Isolate
94
82
  end
95
83
 
96
84
  cleanup if cleanup?
97
- fire :activated
98
85
 
99
86
  self
100
87
  end
101
88
 
102
89
  def cleanup # :nodoc:
103
- fire :cleaning
104
-
105
90
  gem_dir = Gem.dir
106
91
 
107
92
  global, local = Gem::Specification.partition { |s| s.base_dir != gem_dir }
@@ -109,17 +94,14 @@ module Isolate
109
94
  extra = (local - legit) + (local & global)
110
95
 
111
96
  self.remove(*extra)
112
-
113
- fire :cleaned
114
97
  end
115
98
 
116
99
  def cleanup?
117
100
  install? and @options.fetch(:cleanup, true)
118
101
  end
119
102
 
120
- def disable &block
121
- return self if not enabled?
122
- fire :disabling
103
+ def disable
104
+ return self unless enabled?
123
105
 
124
106
  ENV.replace @old_env
125
107
  $LOAD_PATH.replace @old_load_path
@@ -127,16 +109,20 @@ module Isolate
127
109
  @enabled = false
128
110
 
129
111
  Isolate.refresh
130
- fire :disabled
131
112
 
132
- begin; return yield ensure enable end if block_given?
113
+ if block_given? then
114
+ begin
115
+ return yield
116
+ ensure
117
+ enable
118
+ end
119
+ end
133
120
 
134
121
  self
135
122
  end
136
123
 
137
124
  def enable # :nodoc:
138
125
  return self if enabled?
139
- fire :enabling
140
126
 
141
127
  @old_env = ENV.to_hash
142
128
  @old_load_path = $LOAD_PATH.dup
@@ -149,12 +135,13 @@ module Isolate
149
135
  unless system?
150
136
  isolate_lib = File.expand_path "../..", __FILE__
151
137
 
152
- # manually deactivate pre-isolate gems...
153
- $LOAD_PATH.reject! { |lpath|
138
+ $LOAD_PATH.reject! { |lpath| # manually deactivate pre-isolate gems...
154
139
  (lpath.start_with?("/") && # only full paths
155
140
  lpath.end_with?("/lib") && # and that end in lib
156
- lpath != isolate_lib &&
157
- Gem.path.reject(&:empty?).any? { |gem_path| lpath.include?(gem_path) })
141
+ lpath != isolate_lib && # that aren't us
142
+ Gem.path.reject(&:empty?).any? { |gem_path|
143
+ lpath.include?(gem_path) # and are included in a gem's path(?)
144
+ })
158
145
  }
159
146
 
160
147
  # HACK: Gotta keep isolate explicitly in the LOAD_PATH in
@@ -183,7 +170,6 @@ module Isolate
183
170
  Isolate.refresh
184
171
 
185
172
  @enabled = true
186
- fire :enabled
187
173
 
188
174
  self
189
175
  end
@@ -217,20 +203,10 @@ module Isolate
217
203
  entry
218
204
  end
219
205
 
220
- # A source index representing only isolated gems.
221
-
222
- def index
223
- @index ||= Gem::SourceIndex.from_gems_in File.join(path, "specifications")
224
- end
225
-
226
206
  def install environment # :nodoc:
227
- fire :installing
228
-
229
207
  install_missing environment
230
208
  rebuild_extensions
231
209
 
232
- fire :installed
233
-
234
210
  self
235
211
  end
236
212
 
@@ -367,9 +343,5 @@ module Isolate
367
343
 
368
344
  specs.uniq
369
345
  end
370
-
371
- dep_module = defined?(Gem::Deprecate) ? Gem::Deprecate : Deprecate
372
- extend dep_module
373
- deprecate :index, :none, 2011, 11
374
346
  end
375
347
  end
data/lib/isolate.rb CHANGED
@@ -8,7 +8,7 @@ module Isolate
8
8
 
9
9
  # Duh.
10
10
 
11
- VERSION = "3.5.1"
11
+ VERSION = "4.0.0"
12
12
 
13
13
  # Disable Isolate. If a block is provided, isolation will be
14
14
  # disabled for the scope of the block.
data.tar.gz.sig CHANGED
Binary file
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: 3.5.1
4
+ version: 4.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Davis
@@ -12,9 +12,9 @@ bindir: bin
12
12
  cert_chain:
13
13
  - |
14
14
  -----BEGIN CERTIFICATE-----
15
- MIIDPjCCAiagAwIBAgIBBjANBgkqhkiG9w0BAQsFADBFMRMwEQYDVQQDDApyeWFu
15
+ MIIDPjCCAiagAwIBAgIBCDANBgkqhkiG9w0BAQsFADBFMRMwEQYDVQQDDApyeWFu
16
16
  ZC1ydWJ5MRkwFwYKCZImiZPyLGQBGRYJemVuc3BpZGVyMRMwEQYKCZImiZPyLGQB
17
- GRYDY29tMB4XDTIxMTIyMzIzMTkwNFoXDTIyMTIyMzIzMTkwNFowRTETMBEGA1UE
17
+ GRYDY29tMB4XDTI0MDEwMjIxMjEyM1oXDTI1MDEwMTIxMjEyM1owRTETMBEGA1UE
18
18
  AwwKcnlhbmQtcnVieTEZMBcGCgmSJomT8ixkARkWCXplbnNwaWRlcjETMBEGCgmS
19
19
  JomT8ixkARkWA2NvbTCCASIwDQ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Hu1AczzlUly
33
33
  -----END CERTIFICATE-----
34
- date: 2022-06-15 00:00:00.000000000 Z
34
+ date: 2024-06-23 00:00:00.000000000 Z
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: hoe-seattlerb
@@ -129,14 +129,14 @@ dependencies:
129
129
  requirements:
130
130
  - - "~>"
131
131
  - !ruby/object:Gem::Version
132
- version: '3.23'
132
+ version: '4.2'
133
133
  type: :development
134
134
  prerelease: false
135
135
  version_requirements: !ruby/object:Gem::Requirement
136
136
  requirements:
137
137
  - - "~>"
138
138
  - !ruby/object:Gem::Version
139
- version: '3.23'
139
+ version: '4.2'
140
140
  description: |-
141
141
  Isolate is a very simple RubyGems sandbox. It provides a way to
142
142
  express and automatically install your project's Gem dependencies.
@@ -160,7 +160,6 @@ files:
160
160
  - lib/isolate.rb
161
161
  - lib/isolate/completely.rb
162
162
  - lib/isolate/entry.rb
163
- - lib/isolate/events.rb
164
163
  - lib/isolate/now.rb
165
164
  - lib/isolate/rake.rb
166
165
  - lib/isolate/sandbox.rb
@@ -177,7 +176,6 @@ files:
177
176
  - test/isolate/test.rb
178
177
  - test/test_isolate.rb
179
178
  - test/test_isolate_entry.rb
180
- - test/test_isolate_events.rb
181
179
  - test/test_isolate_sandbox.rb
182
180
  homepage: http://github.com/jbarnette/isolate
183
181
  licenses:
@@ -194,14 +192,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
194
192
  requirements:
195
193
  - - ">="
196
194
  - !ruby/object:Gem::Version
197
- version: '0'
195
+ version: '2.7'
198
196
  required_rubygems_version: !ruby/object:Gem::Requirement
199
197
  requirements:
200
198
  - - ">="
201
199
  - !ruby/object:Gem::Version
202
200
  version: 1.8.2
203
201
  requirements: []
204
- rubygems_version: 3.3.12
202
+ rubygems_version: 3.5.14
205
203
  signing_key:
206
204
  specification_version: 4
207
205
  summary: Isolate is a very simple RubyGems sandbox
metadata.gz.sig CHANGED
Binary file
@@ -1,42 +0,0 @@
1
- module Isolate
2
-
3
- # A simple way to watch and extend the Isolate lifecycle.
4
- #
5
- # Isolate::Events.watch Isolate::Sandbox, :initialized do |sandbox|
6
- # puts "A sandbox just got initialized: #{sandbox}"
7
- # end
8
- #
9
- # Read the source for Isolate::Sandbox and Isolate::Entry to see
10
- # what sort of events are fired.
11
-
12
- module Events
13
-
14
- # Watch for an event called +name+ from an instance of
15
- # +klass+. +block+ will be called when the event occurs. Block
16
- # args vary by event, but usually an instance of the relevant
17
- # class is passed.
18
-
19
- def self.watch klass, name, &block
20
- watchers[[klass, name]] << block
21
- end
22
-
23
- def self.fire klass, name, *args #:nodoc:
24
- watchers[[klass, name]].each do |block|
25
- block[*args]
26
- end
27
- end
28
-
29
- def self.watchers #:nodoc:
30
- @watchers ||= Hash.new { |h, k| h[k] = [] }
31
- end
32
-
33
- def fire name, after = nil, *args, &block #:nodoc:
34
- Isolate::Events.fire self.class, name, self, *args
35
-
36
- if after && block_given?
37
- yield self
38
- Isolate::Events.fire self.class, after, *args
39
- end
40
- end
41
- end
42
- end
@@ -1,44 +0,0 @@
1
- require "isolate/events"
2
- require "isolate/test"
3
-
4
- class TestIsolateEvents < Isolate::Test
5
- include Isolate::Events
6
-
7
- def setup
8
- Isolate::Events.watchers.clear
9
- super
10
- end
11
-
12
- def test_self_watch
13
- b = lambda {}
14
- Isolate::Events.watch String, :foo, &b
15
- assert_equal [b], Isolate::Events.watchers[[String, :foo]]
16
- end
17
-
18
- def test_fire
19
- count = 0
20
-
21
- Isolate::Events.watch self.class, :increment do
22
- count += 1
23
- end
24
-
25
- fire :increment
26
- assert_equal 1, count
27
- end
28
-
29
- def test_fire_block
30
- count = 0
31
-
32
- [:increment, :incremented].each do |name|
33
- Isolate::Events.watch self.class, name do
34
- count += 1
35
- end
36
- end
37
-
38
- fire :increment, :incremented do |x|
39
- assert_same self, x
40
- end
41
-
42
- assert_equal 2, count
43
- end
44
- end