rubygems-update 2.1.9 → 2.1.10

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of rubygems-update might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9c40d563e56e2ad5fca4399ca5741c2e6e06e55a
4
- data.tar.gz: d7599e269aa41b908c32cc4d84525a6f486e0c06
3
+ metadata.gz: a483355c383b43daad6f12a1414d56c0f0b0a218
4
+ data.tar.gz: 9c4cb27991e51eb7b74c205d4f985b156b15ab39
5
5
  SHA512:
6
- metadata.gz: fbbbf53b6339a8a2faab7a489cf0f8981e58b1c935e3b8a941d033d0da086b934d6cd1eb478f15fb3b583f2d1aef807ef1d7c7e0602200ffa836f46e1fca5ede
7
- data.tar.gz: 3597cbd0eed7bc0b4151f3781d9f56ad23cbac4559f232b01af68e24c99b86d4c12706199f5ea6187cb9ec87ef5fde04acf62fcc3c8728aecce9d97a51b99ee7
6
+ metadata.gz: fa556141e6b125c84ea8f2c678a56b3289c0d1006080f5e6a948b429466e651c395b5dceca429f759493d089bc61b7c2dec0fe304e913d95245c2f5b6545b21b
7
+ data.tar.gz: d6066573d049e868179711a1fae2ba9c5aebcfe676167ab2dae4ba1aa364d9d3d6b186003b11536b3a65f4401ffbb86305b1c2e0d4e96a8142723b8592b2eda7
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -1,5 +1,24 @@
1
1
  # coding: UTF-8
2
2
 
3
+ === 2.1.10 / 2013-10-24
4
+
5
+ * Use class check instead of :version method check when creating Gem::Version
6
+ objects. Fixes #674 by jkanywhere.
7
+ * Fail during `gem update` when an error occurs checking for newer versions.
8
+ This means RubyGems no longer reports "nothing to update" when it cannot
9
+ communicate with the server. Issue #688 by Jimmy Dee.
10
+ * Allow installation of gems when the home directory does not exist. Issue
11
+ #689 by Laurence Rowe
12
+ * Fix updating gems which have multiple platforms. Issue #693 by Ookami
13
+ Kenrou.
14
+ * The gem server now uses user-provided directories. Issue #696 by Marcelo
15
+ Alvim.
16
+ * Improved resolution of gems when specific versions have conflicting
17
+ dependencies.
18
+ * RubyGems installs local gems regardless of platform again. Issue #695
19
+ * The --ignore-dependencies option for gem installation works again. Issue
20
+ #695
21
+
3
22
  === 2.1.9 / 2013-10-14
4
23
 
5
24
  Bug fixes:
@@ -189,6 +208,13 @@ Bug fixes:
189
208
  * Fixed credential creation for `gem push` when `--host` is not given. Pull
190
209
  request #622 by Arthur Nogueira Neves
191
210
 
211
+ === 2.0.12 / 2013-10-14
212
+
213
+ Bug fixes:
214
+
215
+ * Proxy usernames and passwords are now escaped properly. Ruby Bug #8979 and
216
+ patch by Masahiro Tomita, Issue #668 by Kouhei Sutou.
217
+
192
218
  === 2.0.11 / 2013-10-08
193
219
 
194
220
  Bug fixes:
@@ -273,6 +273,7 @@ test/rubygems/test_gem_security_trust_dir.rb
273
273
  test/rubygems/test_gem_server.rb
274
274
  test/rubygems/test_gem_silent_ui.rb
275
275
  test/rubygems/test_gem_source.rb
276
+ test/rubygems/test_gem_source_fetch_problem.rb
276
277
  test/rubygems/test_gem_source_installed.rb
277
278
  test/rubygems/test_gem_source_list.rb
278
279
  test/rubygems/test_gem_source_local.rb
data/Rakefile CHANGED
@@ -150,7 +150,7 @@ namespace 'guides' do
150
150
 
151
151
  chdir '../guides.rubygems.org' do
152
152
  ruby '-I', lib_dir, '-S', 'rake', 'command_guide'
153
- ruby '-I', lib_dir, '-S', 'rake', 'rdoc_spec'
153
+ ruby '-I', lib_dir, '-S', 'rake', 'spec_guide'
154
154
  end
155
155
  end
156
156
 
@@ -8,7 +8,7 @@
8
8
  require 'rbconfig'
9
9
 
10
10
  module Gem
11
- VERSION = '2.1.9'
11
+ VERSION = '2.1.10'
12
12
  end
13
13
 
14
14
  # Must be first since it unloads the prelude from 1.9.2
@@ -110,7 +110,11 @@ command to remove old versions.
110
110
 
111
111
  fetcher = Gem::SpecFetcher.fetcher
112
112
 
113
- spec_tuples, _ = fetcher.search_for_dependency dependency
113
+ spec_tuples, errors = fetcher.search_for_dependency dependency
114
+
115
+ error = errors.find { |e| e.respond_to? :exception }
116
+
117
+ raise error if error
114
118
 
115
119
  spec_tuples
116
120
  end
@@ -118,7 +118,7 @@ class Gem::DependencyResolver
118
118
  # on the dep for the activation itself. Otherwise, issue
119
119
  # it on the requester's request itself.
120
120
  #
121
- if existing.others_possible?
121
+ if existing.others_possible? or existing.request.requester.nil? then
122
122
  conflict =
123
123
  Gem::DependencyResolver::DependencyConflict.new dep, existing
124
124
  else
@@ -132,8 +132,8 @@ class Gem::DependencyResolver
132
132
  end
133
133
 
134
134
  # Get a list of all specs that satisfy dep and platform
135
- possible = @set.find_all dep
136
- possible = select_local_platforms possible
135
+ all_possible = @set.find_all dep
136
+ possible = select_local_platforms all_possible
137
137
 
138
138
  case possible.size
139
139
  when 0
@@ -141,7 +141,7 @@ class Gem::DependencyResolver
141
141
 
142
142
  unless @soft_missing
143
143
  # If there are none, then our work here is done.
144
- raise Gem::UnsatisfiableDependencyError, dep
144
+ raise Gem::UnsatisfiableDependencyError.new dep, all_possible
145
145
  end
146
146
  when 1
147
147
  # If there is one, then we just add it to specs
@@ -234,7 +234,7 @@ class Gem::DependencyResolver
234
234
 
235
235
  def select_local_platforms specs # :nodoc:
236
236
  specs.select do |spec|
237
- Gem::Platform.match spec.platform
237
+ Gem::Platform.installable? spec
238
238
  end
239
239
  end
240
240
 
@@ -32,6 +32,22 @@ class Gem::DependencyResolver::DependencyRequest
32
32
  @dependency.name
33
33
  end
34
34
 
35
+ # Indicate that the request is for a gem explicitly requested by the user
36
+ def explicit?
37
+ @requester.nil?
38
+ end
39
+
40
+ # Indicate that the requset is for a gem requested as a dependency of another gem
41
+ def implicit?
42
+ !explicit?
43
+ end
44
+
45
+ # Return a String indicating who caused this request to be added (only
46
+ # valid for implicit requests)
47
+ def request_context
48
+ @requester ? @requester.request : "(unknown)"
49
+ end
50
+
35
51
  def pretty_print q # :nodoc:
36
52
  q.group 2, '[Dependency request ', ']' do
37
53
  q.breakable
@@ -30,6 +30,16 @@ class Gem::DependencyResolver::InstalledSpecification
30
30
  @spec.platform
31
31
  end
32
32
 
33
+ def installable_platform?
34
+ # BACKCOMPAT If the file is coming out of a specified file, then we
35
+ # ignore the platform. This code can be removed in RG 3.0.
36
+ if @source.kind_of? Gem::Source::SpecificFile
37
+ return true
38
+ else
39
+ Gem::Platform.match @spec.platform
40
+ end
41
+ end
42
+
33
43
  def source
34
44
  @source ||= Gem::Source::Installed.new
35
45
  end
@@ -85,5 +85,10 @@ module Gem
85
85
  def wordy
86
86
  "Unable to download data from #{@source.uri} - #{@error.message}"
87
87
  end
88
+
89
+ ##
90
+ # The "exception" alias allows you to call raise on a SourceFetchProblem.
91
+
92
+ alias exception error
88
93
  end
89
94
  end
@@ -179,10 +179,17 @@ class Gem::UnsatisfiableDependencyError < Gem::Exception
179
179
 
180
180
  attr_reader :dependency
181
181
 
182
- def initialize dep
183
- requester = dep.requester ? dep.requester.request : '(unknown)'
184
-
185
- super "Unable to resolve dependency: #{requester} requires #{dep}"
182
+ def initialize dep, platform_mismatch=nil
183
+ if platform_mismatch and !platform_mismatch.empty?
184
+ plats = platform_mismatch.map { |x| x.platform.to_s }.sort.uniq
185
+ super "Unable to resolve dependency: No match for '#{dep}' on this platform. Found: #{plats.join(', ')}"
186
+ else
187
+ if dep.explicit?
188
+ super "Unable to resolve dependency: user requested '#{dep}'"
189
+ else
190
+ super "Unable to resolve dependency: '#{dep.request_context}' requires '#{dep}'"
191
+ end
192
+ end
186
193
 
187
194
  @dependency = dep
188
195
  end
@@ -1,3 +1,5 @@
1
+ require 'rubygems/command'
2
+
1
3
  class Gem::Ext::CmakeBuilder < Gem::Ext::Builder
2
4
  def self.build(extension, directory, dest_path, results)
3
5
  unless File.exist?('Makefile') then
@@ -4,6 +4,7 @@
4
4
  # See LICENSE.txt for permissions.
5
5
  #++
6
6
 
7
+ require 'rubygems/command'
7
8
  require 'rubygems/exceptions'
8
9
  require 'rubygems/package'
9
10
  require 'rubygems/ext'
@@ -29,6 +29,14 @@ class Gem::Platform
29
29
  end
30
30
  end
31
31
 
32
+ def self.installable?(spec)
33
+ if spec.respond_to? :installable_platform?
34
+ spec.installable_platform?
35
+ else
36
+ match spec.platform
37
+ end
38
+ end
39
+
32
40
  def self.new(arch) # :nodoc:
33
41
  case arch
34
42
  when Gem::Platform::CURRENT then
@@ -5,6 +5,19 @@ require 'rubygems/dependency_list'
5
5
  require 'rubygems/installer'
6
6
  require 'tsort'
7
7
 
8
+ ##
9
+ # A RequestSet groups a request to activate a set of dependencies.
10
+ #
11
+ # nokogiri = Gem::Dependency.new 'nokogiri', '~> 1.6'
12
+ # pg = Gem::Dependency.new 'pg', '~> 0.14'
13
+ #
14
+ # set = Gem::RequestSet.new nokogiri, pg
15
+ #
16
+ # requests = set.resolve
17
+ #
18
+ # p requests.map { |r| r.full_name }
19
+ # #=> ["nokogiri-1.6.0", "mini_portile-0.5.1", "pg-0.17.0"]
20
+
8
21
  class Gem::RequestSet
9
22
 
10
23
  include TSort
@@ -23,6 +36,15 @@ class Gem::RequestSet
23
36
 
24
37
  attr_accessor :soft_missing
25
38
 
39
+ ##
40
+ # Creates a RequestSet for a list of Gem::Dependency objects, +deps+. You
41
+ # can then #resolve and #install the resolved list of dependencies.
42
+ #
43
+ # nokogiri = Gem::Dependency.new 'nokogiri', '~> 1.6'
44
+ # pg = Gem::Dependency.new 'pg', '~> 0.14'
45
+ #
46
+ # set = Gem::RequestSet.new nokogiri, pg
47
+
26
48
  def initialize *deps
27
49
  @dependencies = deps
28
50
 
@@ -445,7 +445,7 @@ div.method-source-code pre { color: #ffdead; overflow: hidden; }
445
445
  @spec_dirs = @gem_dirs.map { |gem_dir| File.join gem_dir, 'specifications' }
446
446
  @spec_dirs.reject! { |spec_dir| !File.directory? spec_dir }
447
447
 
448
- Gem::Specification.dirs = @gem_dirs
448
+ reset_gems
449
449
 
450
450
  @have_rdoc_4_plus = nil
451
451
  end
@@ -470,7 +470,7 @@ div.method-source-code pre { color: #ffdead; overflow: hidden; }
470
470
  end
471
471
 
472
472
  def latest_specs(req, res)
473
- Gem::Specification.reset
473
+ reset_gems
474
474
 
475
475
  res['content-type'] = 'application/x-gzip'
476
476
 
@@ -531,7 +531,7 @@ div.method-source-code pre { color: #ffdead; overflow: hidden; }
531
531
  end
532
532
 
533
533
  def quick(req, res)
534
- Gem::Specification.reset
534
+ reset_gems
535
535
 
536
536
  res['content-type'] = 'text/plain'
537
537
  add_date res
@@ -567,7 +567,8 @@ div.method-source-code pre { color: #ffdead; overflow: hidden; }
567
567
  end
568
568
 
569
569
  def root(req, res)
570
- Gem::Specification.reset
570
+ reset_gems
571
+
571
572
  add_date res
572
573
 
573
574
  raise WEBrick::HTTPStatus::NotFound, "`#{req.path}' not found." unless
@@ -697,6 +698,13 @@ div.method-source-code pre { color: #ffdead; overflow: hidden; }
697
698
  res.body = template.result binding
698
699
  end
699
700
 
701
+ ##
702
+ # Updates the server to use the latest installed gems.
703
+
704
+ def reset_gems # :nodoc:
705
+ Gem::Specification.dirs = @gem_dirs
706
+ end
707
+
700
708
  ##
701
709
  # Returns true and prepares http response, if rdoc for the requested gem
702
710
  # name pattern was found.
@@ -787,7 +795,7 @@ div.method-source-code pre { color: #ffdead; overflow: hidden; }
787
795
  end
788
796
 
789
797
  def specs(req, res)
790
- Gem::Specification.reset
798
+ reset_gems
791
799
 
792
800
  add_date res
793
801
 
@@ -71,7 +71,12 @@ class Gem::Source
71
71
  end
72
72
 
73
73
  def update_cache?
74
- @update_cache ||= File.stat(Gem.user_home).uid == Process.uid
74
+ @update_cache ||=
75
+ begin
76
+ File.stat(Gem.user_home).uid == Process.uid
77
+ rescue Errno::ENOENT
78
+ false
79
+ end
75
80
  end
76
81
 
77
82
  def fetch_spec(name)
@@ -38,7 +38,12 @@ class Gem::SpecFetcher
38
38
  end
39
39
 
40
40
  def initialize
41
- @update_cache = File.stat(Gem.user_home).uid == Process.uid
41
+ @update_cache =
42
+ begin
43
+ File.stat(Gem.user_home).uid == Process.uid
44
+ rescue Errno::EACCES, Errno::ENOENT
45
+ false
46
+ end
42
47
 
43
48
  @specs = {}
44
49
  @latest_specs = {}
@@ -1731,6 +1731,7 @@ class Gem::Specification < Gem::BasicSpecification
1731
1731
  end
1732
1732
 
1733
1733
  def init_with coder # :nodoc:
1734
+ @installed_by_version ||= nil
1734
1735
  yaml_initialize coder.tag, coder.map
1735
1736
  end
1736
1737
 
@@ -2590,6 +2591,8 @@ licenses is empty. Use a license abbreviation from:
2590
2591
 
2591
2592
  instance_variable_set "@#{attribute}", value
2592
2593
  end
2594
+
2595
+ @installed_by_version ||= nil
2593
2596
  end
2594
2597
 
2595
2598
  extend Gem::Deprecate
@@ -177,7 +177,7 @@ class Gem::Version
177
177
  # REFACTOR: There's no real reason this should be separate from #initialize.
178
178
 
179
179
  def self.create input
180
- if input.respond_to? :version then
180
+ if self === input then # check yourself before you wreck yourself
181
181
  input
182
182
  elsif input.nil? then
183
183
  nil
@@ -1,6 +1,7 @@
1
1
  # coding: US-ASCII
2
2
  require 'rubygems/test_case'
3
3
  require 'rubygems'
4
+ require 'rubygems/command'
4
5
  require 'rubygems/installer'
5
6
  require 'pathname'
6
7
  require 'tmpdir'
@@ -373,6 +373,50 @@ class TestGemCommandsUpdateCommand < Gem::TestCase
373
373
  assert user_install, 'user_install must be set on the installer'
374
374
  end
375
375
 
376
+ def test_fetch_remote_gems
377
+ expected = [
378
+ [Gem::NameTuple.new('a', v(2), Gem::Platform::RUBY),
379
+ Gem::Source.new(@gem_repo)],
380
+ ]
381
+
382
+ assert_equal expected, @cmd.fetch_remote_gems(@a1)
383
+ end
384
+
385
+ def test_fetch_remote_gems_error
386
+ Gem.sources.replace %w[http://nonexistent.example]
387
+
388
+ assert_raises Gem::RemoteFetcher::FetchError do
389
+ @cmd.fetch_remote_gems @a1
390
+ end
391
+ end
392
+
393
+ def test_fetch_remote_gems_mismatch
394
+ platform = Gem::Platform.new 'x86-freebsd9'
395
+ a2_p = quick_spec 'a', 2 do |s| s.platform = platform end
396
+
397
+ util_setup_spec_fetcher @a2, a2_p
398
+
399
+ expected = [
400
+ [Gem::NameTuple.new('a', v(2), Gem::Platform::RUBY),
401
+ Gem::Source.new(@gem_repo)],
402
+ ]
403
+
404
+ assert_equal expected, @cmd.fetch_remote_gems(@a1)
405
+ end
406
+
407
+ def test_fetch_remote_gems_prerelease
408
+ @cmd.options[:prerelease] = true
409
+
410
+ expected = [
411
+ [Gem::NameTuple.new('a', v(2), Gem::Platform::RUBY),
412
+ Gem::Source.new(@gem_repo)],
413
+ [Gem::NameTuple.new('a', v('3.a'), Gem::Platform::RUBY),
414
+ Gem::Source.new(@gem_repo)],
415
+ ]
416
+
417
+ assert_equal expected, @cmd.fetch_remote_gems(@a1)
418
+ end
419
+
376
420
  def test_handle_options_system
377
421
  @cmd.handle_options %w[--system]
378
422
 
@@ -647,7 +647,7 @@ class TestGemDependencyInstaller < Gem::TestCase
647
647
  inst.install 'b'
648
648
  end
649
649
 
650
- expected = "Unable to resolve dependency: b (= 1) requires a (>= 0)"
650
+ expected = "Unable to resolve dependency: 'b (= 1)' requires 'a (>= 0)'"
651
651
  assert_equal expected, e.message
652
652
  end
653
653
 
@@ -781,6 +781,17 @@ class TestGemDependencyInstaller < Gem::TestCase
781
781
  assert_equal %w[a-1], inst.installed_gems.map { |s| s.full_name }
782
782
  end
783
783
 
784
+ def test_install_platform_is_ignored_when_a_file_is_specified
785
+ _, a_gem = util_gem 'a', '1' do |s|
786
+ s.platform = Gem::Platform.new %w[cpu other_platform 1]
787
+ end
788
+
789
+ inst = Gem::DependencyInstaller.new :domain => :local
790
+ inst.install a_gem
791
+
792
+ assert_equal %w[a-1-cpu-other_platform-1], inst.installed_gems.map { |s| s.full_name }
793
+ end
794
+
784
795
  if defined? OpenSSL then
785
796
  def test_install_security_policy
786
797
  util_setup_gems
@@ -205,7 +205,7 @@ class TestGemDependencyResolver < Gem::TestCase
205
205
  r.resolve
206
206
  end
207
207
 
208
- assert_equal "Unable to resolve dependency: (unknown) requires a (>= 0)",
208
+ assert_equal "Unable to resolve dependency: user requested 'a (>= 0)'",
209
209
  e.message
210
210
 
211
211
  assert_equal "a (>= 0)", e.dependency.to_s
@@ -225,6 +225,37 @@ class TestGemDependencyResolver < Gem::TestCase
225
225
  assert_equal "a (= 3)", e.dependency.to_s
226
226
  end
227
227
 
228
+ def test_raises_and_reports_a_toplevel_request_properly
229
+ a1 = util_spec "a", "1"
230
+ ad = make_dep "a", "= 3"
231
+
232
+ r = Gem::DependencyResolver.new([ad], set(a1))
233
+
234
+ e = assert_raises Gem::UnsatisfiableDepedencyError do
235
+ r.resolve
236
+ end
237
+
238
+ assert_equal "Unable to resolve dependency: user requested 'a (= 3)'",
239
+ e.message
240
+ end
241
+
242
+ def test_raises_and_reports_an_implicit_request_properly
243
+ a1 = util_spec "a", "1" do |s|
244
+ s.add_runtime_dependency 'b', '= 2'
245
+ end
246
+
247
+ ad = make_dep "a", "= 1"
248
+
249
+ r = Gem::DependencyResolver.new([ad], set(a1))
250
+
251
+ e = assert_raises Gem::UnsatisfiableDepedencyError do
252
+ r.resolve
253
+ end
254
+
255
+ assert_equal "Unable to resolve dependency: 'a (= 1)' requires 'b (= 2)'",
256
+ e.message
257
+ end
258
+
228
259
  def test_raises_when_possibles_are_exhausted
229
260
  a1 = util_spec "a", "1", "c" => ">= 2"
230
261
  b1 = util_spec "b", "1", "c" => "= 1"
@@ -313,6 +344,24 @@ class TestGemDependencyResolver < Gem::TestCase
313
344
  end
314
345
  end
315
346
 
347
+ def test_resolve_conflict
348
+ a1 = util_spec 'a', 1
349
+ a2 = util_spec 'a', 2
350
+
351
+ b2 = util_spec 'b', 2, 'a' => '~> 2.0'
352
+
353
+ s = set a1, a2, b2
354
+
355
+ a_dep = dep 'a', '~> 1.0'
356
+ b_dep = dep 'b'
357
+
358
+ r = Gem::DependencyResolver.new [a_dep, b_dep], s
359
+
360
+ assert_raises Gem::DependencyResolutionError do
361
+ r.resolve
362
+ end
363
+ end
364
+
316
365
  # actionmailer 2.3.4
317
366
  # activemerchant 1.5.0
318
367
  # activesupport 2.3.5, 2.3.4
@@ -366,5 +415,22 @@ class TestGemDependencyResolver < Gem::TestCase
366
415
  assert_equal [a1, a1_p1], selected
367
416
  end
368
417
 
418
+ def test_raises_and_explains_when_platform_prevents_install
419
+ a1 = util_spec "a", "1" do |s|
420
+ s.platform = Gem::Platform.new %w[c p 1]
421
+ end
422
+
423
+ ad = make_dep "a", "= 1"
424
+
425
+ r = Gem::DependencyResolver.new([ad], set(a1))
426
+
427
+ e = assert_raises Gem::UnsatisfiableDepedencyError do
428
+ r.resolve
429
+ end
430
+
431
+ assert_match "No match for 'a (= 1)' on this platform. Found: c-p-1",
432
+ e.message
433
+ end
434
+
369
435
  end
370
436
 
@@ -85,6 +85,30 @@ class TestGemServer < Gem::TestCase
85
85
  Marshal.load(@res.body)
86
86
  end
87
87
 
88
+ def test_latest_specs_gemdirs
89
+ data = StringIO.new "GET /latest_specs.#{Gem.marshal_version} HTTP/1.0\r\n\r\n"
90
+ dir = "#{@gemhome}2"
91
+
92
+ spec = quick_spec 'z', 9
93
+
94
+ specs_dir = File.join dir, 'specifications'
95
+ FileUtils.mkdir_p specs_dir
96
+
97
+ open File.join(specs_dir, spec.spec_name), 'w' do |io|
98
+ io.write spec.to_ruby
99
+ end
100
+
101
+ server = Gem::Server.new dir, process_based_port, false
102
+
103
+ @req.parse data
104
+
105
+ server.latest_specs @req, @res
106
+
107
+ assert_equal 200, @res.status
108
+
109
+ assert_equal [['z', v(9), Gem::Platform::RUBY]], Marshal.load(@res.body)
110
+ end
111
+
88
112
  def test_latest_specs_gz
89
113
  data = StringIO.new "GET /latest_specs.#{Gem.marshal_version}.gz HTTP/1.0\r\n\r\n"
90
114
  @req.parse data
@@ -120,8 +144,41 @@ class TestGemServer < Gem::TestCase
120
144
  assert_equal 2, @server.server.listeners.length
121
145
  end
122
146
 
147
+ def test_quick_gemdirs
148
+ data = StringIO.new "GET /quick/Marshal.4.8/z-9.gemspec.rz HTTP/1.0\r\n\r\n"
149
+ dir = "#{@gemhome}2"
150
+
151
+ server = Gem::Server.new dir, process_based_port, false
152
+
153
+ @req.parse data
154
+
155
+ server.quick @req, @res
156
+
157
+ assert_equal 404, @res.status
158
+
159
+ spec = quick_spec 'z', 9
160
+
161
+ specs_dir = File.join dir, 'specifications'
162
+
163
+ FileUtils.mkdir_p specs_dir
164
+
165
+ open File.join(specs_dir, spec.spec_name), 'w' do |io|
166
+ io.write spec.to_ruby
167
+ end
168
+
169
+ data.rewind
170
+
171
+ req = WEBrick::HTTPRequest.new :Logger => nil
172
+ res = WEBrick::HTTPResponse.new :HTTPVersion => '1.0'
173
+ req.parse data
174
+
175
+ server.quick req, res
176
+
177
+ assert_equal 200, res.status
178
+ end
179
+
123
180
  def test_quick_missing
124
- data = StringIO.new "GET /quick/z-9.gemspec.rz HTTP/1.0\r\n\r\n"
181
+ data = StringIO.new "GET /quick/Marshal.4.8/z-9.gemspec.rz HTTP/1.0\r\n\r\n"
125
182
  @req.parse data
126
183
 
127
184
  @server.quick @req, @res
@@ -188,6 +245,29 @@ class TestGemServer < Gem::TestCase
188
245
  assert_equal 'text/html', @res['content-type']
189
246
  end
190
247
 
248
+ def test_root_gemdirs
249
+ data = StringIO.new "GET / HTTP/1.0\r\n\r\n"
250
+ dir = "#{@gemhome}2"
251
+
252
+ spec = quick_spec 'z', 9
253
+
254
+ specs_dir = File.join dir, 'specifications'
255
+ FileUtils.mkdir_p specs_dir
256
+
257
+ open File.join(specs_dir, spec.spec_name), 'w' do |io|
258
+ io.write spec.to_ruby
259
+ end
260
+
261
+ server = Gem::Server.new dir, process_based_port, false
262
+
263
+ @req.parse data
264
+
265
+ server.root @req, @res
266
+
267
+ assert_equal 200, @res.status
268
+ assert_match 'z 9', @res.body
269
+ end
270
+
191
271
  def test_specs
192
272
  data = StringIO.new "GET /specs.#{Gem.marshal_version} HTTP/1.0\r\n\r\n"
193
273
  @req.parse data
@@ -203,6 +283,30 @@ class TestGemServer < Gem::TestCase
203
283
  Marshal.load(@res.body)
204
284
  end
205
285
 
286
+ def test_specs_gemdirs
287
+ data = StringIO.new "GET /specs.#{Gem.marshal_version} HTTP/1.0\r\n\r\n"
288
+ dir = "#{@gemhome}2"
289
+
290
+ spec = quick_spec 'z', 9
291
+
292
+ specs_dir = File.join dir, 'specifications'
293
+ FileUtils.mkdir_p specs_dir
294
+
295
+ open File.join(specs_dir, spec.spec_name), 'w' do |io|
296
+ io.write spec.to_ruby
297
+ end
298
+
299
+ server = Gem::Server.new dir, process_based_port, false
300
+
301
+ @req.parse data
302
+
303
+ server.specs @req, @res
304
+
305
+ assert_equal 200, @res.status
306
+
307
+ assert_equal [['z', v(9), Gem::Platform::RUBY]], Marshal.load(@res.body)
308
+ end
309
+
206
310
  def test_specs_gz
207
311
  data = StringIO.new "GET /specs.#{Gem.marshal_version}.gz HTTP/1.0\r\n\r\n"
208
312
  @req.parse data
@@ -207,5 +207,15 @@ class TestGemSource < Gem::TestCase
207
207
  assert_equal(-1, remote. <=>(no_uri), 'remote <=> no_uri')
208
208
  end
209
209
 
210
+ def test_update_cache_eh
211
+ assert @source.update_cache?
212
+ end
213
+
214
+ def test_update_cache_eh_home_nonexistent
215
+ FileUtils.rmdir Gem.user_home
216
+
217
+ refute @source.update_cache?
218
+ end
219
+
210
220
  end
211
221
 
@@ -0,0 +1,19 @@
1
+ require 'rubygems/test_case'
2
+
3
+ class TestGemSourceFetchProblem < Gem::TestCase
4
+
5
+ def test_exception
6
+ source = Gem::Source.new @gem_repo
7
+ error = RuntimeError.new 'test'
8
+
9
+ sf = Gem::SourceFetchProblem.new source, error
10
+
11
+ e = assert_raises RuntimeError do
12
+ raise sf
13
+ end
14
+
15
+ assert_equal 'test', e.message
16
+ end
17
+
18
+ end
19
+
@@ -1,5 +1,5 @@
1
1
  require 'rubygems/test_case'
2
- require 'rubygems/source/specific_file'
2
+ require 'rubygems/source'
3
3
 
4
4
  class TestGemSourceSpecificFile < Gem::TestCase
5
5
  def setup
@@ -52,6 +52,18 @@ class TestGemSpecFetcher < Gem::TestCase
52
52
  ['x', Gem::Version.new(1), 'ruby']]
53
53
  end
54
54
 
55
+ def test_initialize_unwritable_home_dir
56
+ skip 'chmod not supported' if Gem.win_platform?
57
+
58
+ FileUtils.chmod 0000, Gem.user_home
59
+
60
+ begin
61
+ assert Gem::SpecFetcher.new
62
+ ensure
63
+ FileUtils.chmod 0755, Gem.user_home
64
+ end
65
+ end
66
+
55
67
  def test_spec_for_dependency_all
56
68
  d = "#{@gem_repo}#{Gem::MARSHAL_SPEC_DIR}"
57
69
  @fetcher.data["#{d}#{@a1.spec_name}.rz"] = util_zip(Marshal.dump(@a1))
@@ -23,14 +23,13 @@ class TestGemVersion < Gem::TestCase
23
23
  assert_bumped_version_equal "6", "5"
24
24
  end
25
25
 
26
- # FIX: For "legacy reasons," any object that responds to +version+
27
- # is returned unchanged. I'm not certain why.
26
+ # A Gem::Version is already a Gem::Version and therefore not transformed by
27
+ # Gem::Version.create
28
28
 
29
29
  def test_class_create
30
- fake = Object.new
31
- def fake.version; "1.0" end
30
+ real = Gem::Version.new(1.0)
32
31
 
33
- assert_same fake, Gem::Version.create(fake)
32
+ assert_same real, Gem::Version.create(real)
34
33
  assert_nil Gem::Version.create(nil)
35
34
  assert_equal v("5.1"), Gem::Version.create("5.1")
36
35
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubygems-update
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.9
4
+ version: 2.1.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jim Weirich
@@ -32,7 +32,7 @@ cert_chain:
32
32
  KDyY1VIazVgoC8XvR4h/95/iScPiuglzA+DBG1hip1xScAtw05BrXyUNrc9CEMYU
33
33
  wgF94UVoHRp6ywo8I7NP3HcwFQDFNEZPNGXsng==
34
34
  -----END CERTIFICATE-----
35
- date: 2013-10-14 00:00:00.000000000 Z
35
+ date: 2013-10-25 00:00:00.000000000 Z
36
36
  dependencies:
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: minitest
@@ -448,6 +448,7 @@ files:
448
448
  - test/rubygems/test_gem_server.rb
449
449
  - test/rubygems/test_gem_silent_ui.rb
450
450
  - test/rubygems/test_gem_source.rb
451
+ - test/rubygems/test_gem_source_fetch_problem.rb
451
452
  - test/rubygems/test_gem_source_installed.rb
452
453
  - test/rubygems/test_gem_source_list.rb
453
454
  - test/rubygems/test_gem_source_local.rb
@@ -495,7 +496,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
495
496
  version: '0'
496
497
  requirements: []
497
498
  rubyforge_project: rubygems-update
498
- rubygems_version: 2.1.7
499
+ rubygems_version: 2.1.9
499
500
  signing_key:
500
501
  specification_version: 4
501
502
  summary: RubyGems is a package management framework for Ruby
@@ -583,6 +584,7 @@ test_files:
583
584
  - test/rubygems/test_gem_server.rb
584
585
  - test/rubygems/test_gem_silent_ui.rb
585
586
  - test/rubygems/test_gem_source.rb
587
+ - test/rubygems/test_gem_source_fetch_problem.rb
586
588
  - test/rubygems/test_gem_source_installed.rb
587
589
  - test/rubygems/test_gem_source_list.rb
588
590
  - test/rubygems/test_gem_source_local.rb
metadata.gz.sig CHANGED
Binary file