slimgems 1.3.9.3 → 1.3.9.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -106,7 +106,7 @@ require 'thread'
106
106
  module Gem
107
107
  NAME = 'SlimGems'
108
108
  GEM_NAME = 'slimgems'
109
- VERSION = '1.3.9.3'
109
+ VERSION = '1.3.9.4'
110
110
  SlimGemsVersion = RubyGemsVersion = VERSION
111
111
 
112
112
  ##
@@ -149,12 +149,27 @@ class Gem::DependencyInstaller
149
149
  results = find_gems_with_sources(dep).reverse
150
150
 
151
151
  results.reject! do |dep_spec,|
152
- to_do.push dep_spec
153
-
154
- @source_index.any? do |_, installed_spec|
155
- dep.name == installed_spec.name and
156
- dep.requirement.satisfied_by? installed_spec.version
152
+ dep_met = false
153
+ installed_dep_spec = nil
154
+
155
+ @source_index.each do |_, installed_spec|
156
+ if (dep.name == installed_spec.name) && (dep.requirement.satisfied_by?(installed_spec.version))
157
+ installed_dep_spec = installed_spec
158
+ dep_met = true
159
+ break
160
+ end
161
+ end
162
+
163
+ if !dep_met
164
+ to_do.push dep_spec
165
+ else
166
+ # Since we resolve dependencies transitively, if this installed
167
+ # gem is missing some dependencies, go ahead and try to do it,
168
+ # but for this exact version.
169
+ to_do.push installed_dep_spec
157
170
  end
171
+
172
+ dep_met
158
173
  end
159
174
 
160
175
  results.each do |dep_spec, source_uri|
@@ -147,6 +147,34 @@ class TestGemDependencyInstaller < RubyGemTestCase
147
147
 
148
148
  assert_equal %w[b-1], inst.installed_gems.map { |s| s.full_name }
149
149
  end
150
+
151
+ def test_install_dependencies_earliest_satisfied
152
+ r1, r1_gem = util_gem 'r', '1'
153
+ q1, q1_gem = util_gem 'q', '1'
154
+ q2, q2_gem = util_gem 'q', '2' do |s|
155
+ s.add_dependency 'r'
156
+ end
157
+ e1, e1_gem = util_gem 'e', '1' do |s|
158
+ s.add_dependency 'q', '>= 1'
159
+ end
160
+
161
+ FileUtils.rm_rf File.join(@gemhome, 'gems')
162
+ Gem.source_index.refresh!
163
+
164
+ FileUtils.mv e1_gem, @tempdir # not in index
165
+ FileUtils.mv q1_gem, @tempdir # not in index
166
+ FileUtils.mv q2_gem, @tempdir # not in index
167
+ FileUtils.mv r1_gem, @tempdir # not in index
168
+
169
+ Dir.chdir @tempdir do
170
+ inst = Gem::DependencyInstaller.new
171
+ inst.install 'q-1'
172
+ inst.install 'e-1'
173
+ end
174
+
175
+ installed = Gem::SourceIndex.from_installed_gems.map { |n,s| s.full_name }
176
+ assert_equal %w[e-1 q-1], installed
177
+ end
150
178
 
151
179
  def test_install_dependency
152
180
  FileUtils.mv @a1_gem, @tempdir
@@ -132,46 +132,49 @@ end
132
132
  def test_self_load_escape_curly
133
133
  @a2.name = 'a};raise "improper escaping";%q{'
134
134
 
135
- full_path = @a2.spec_file
136
- write_file full_path do |io|
137
- io.write @a2.to_ruby_for_cache
135
+ full_path = nil
136
+ write_file @a2.spec_name do |io|
137
+ full_path = io.path
138
+ io.write @a2.to_ruby
138
139
  end
139
140
 
140
141
  spec = Gem::Specification.load full_path
141
142
 
142
- @a2.files.clear
143
-
144
143
  assert_equal @a2, spec
144
+
145
+ @a2.files.clear
145
146
  end
146
147
 
147
148
  def test_self_load_escape_interpolation
148
149
  @a2.name = 'a#{raise %<improper escaping>}'
149
150
 
150
- full_path = @a2.spec_file
151
- write_file full_path do |io|
152
- io.write @a2.to_ruby_for_cache
151
+ full_path = nil
152
+ write_file @a2.spec_name do |io|
153
+ full_path = io.path
154
+ io.write @a2.to_ruby
153
155
  end
154
156
 
155
157
  spec = Gem::Specification.load full_path
156
158
 
157
- @a2.files.clear
158
-
159
159
  assert_equal @a2, spec
160
+
161
+ @a2.files.clear
160
162
  end
161
163
 
162
164
  def test_self_load_escape_quote
163
165
  @a2.name = 'a";raise "improper escaping";"'
164
166
 
165
- full_path = @a2.spec_file
166
- write_file full_path do |io|
167
- io.write @a2.to_ruby_for_cache
167
+ full_path = nil
168
+ write_file @a2.spec_name do |io|
169
+ full_path = io.path
170
+ io.write @a2.to_ruby
168
171
  end
169
172
 
170
173
  spec = Gem::Specification.load full_path
171
174
 
172
- @a2.files.clear
173
-
174
175
  assert_equal @a2, spec
176
+
177
+ @a2.files.clear
175
178
  end
176
179
 
177
180
  def test_self_load_legacy_ruby
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slimgems
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.9.3
4
+ version: 1.3.9.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2011-09-07 00:00:00.000000000 -04:00
15
+ date: 2012-01-08 00:00:00.000000000 -05:00
16
16
  default_executable:
17
17
  dependencies: []
18
18
  description: ! "SlimGems is a drop-in replacement for RubyGems, a package management
@@ -216,7 +216,7 @@ files:
216
216
  has_rdoc: true
217
217
  homepage: http://slimgems.github.com
218
218
  licenses: []
219
- post_install_message: ! "Upgraded from RubyGems to SlimGems 1.3.9.3\n\uFEFF=== 1.3.9.3
219
+ post_install_message: ! "Upgraded from RubyGems to SlimGems 1.3.9.4\n\uFEFF=== 1.3.9.3
220
220
  / 2011-09-07\n\nSlimGems is a drop-in replacement for RubyGems. See README.md for
221
221
  more.\n\n* Add support for Ruby 1.9.3 preview release (#9)\n* Fix rubygems-pwn gem
222
222
  install remote execution vulnerability (#10)\n\n"
@@ -237,7 +237,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
237
237
  version: '0'
238
238
  requirements: []
239
239
  rubyforge_project:
240
- rubygems_version: 1.3.9.2
240
+ rubygems_version: 1.3.9.3
241
241
  signing_key:
242
242
  specification_version: 3
243
243
  summary: SlimGems is a package management framework for Ruby