Project

General

Profile

Backport #8908 ยป rubygems.2_0_9.ruby.2_0_0.patch

drbrain (Eric Hodel), 09/14/2013 09:35 AM

View differences:

NEWS (working copy)
461 461
    XML declaration is used for XML document encoding.
462 462

  
463 463
* RubyGems
464
  * Updated to 2.0.9.
465

  
466
    http://rubygems.rubyforge.org/rubygems-update/History_txt.html#label-2.0.9+%2F+2013-09-13
467
    for release notes.
468

  
464 469
  * Updated to 2.0.8.  This fixes CVE-2013-4287:
465 470

  
466 471
    http://rubygems.rubyforge.org/rubygems-update/CVE-2013-4287_txt.html
467 472

  
468
  * Updated to 2.0.3.  See
469
    http://rubygems.rubyforge.org/rubygems-update/History_txt.html#label-2.0.3+%2F+2012-03-1
470
    for release notes.
471

  
472 473
  * Updated to 2.0.0
473 474

  
474 475
    RubyGems 2.0.0 features the following improvements:
lib/rubygems/commands/fetch_command.rb (working copy)
43 43
      dep.prerelease = options[:prerelease]
44 44

  
45 45
      specs_and_sources, errors = Gem::SpecFetcher.fetcher.spec_for_dependency dep
46

  
46 47
      if platform then
47 48
        filtered = specs_and_sources.select { |s,| s.platform == platform }
48 49
        specs_and_sources = filtered unless filtered.empty?
49 50
      end
50 51

  
51
      spec, source = specs_and_sources.sort_by { |s,| s.version }.first
52
      spec, source = specs_and_sources.max_by { |s,| s.version }
52 53

  
53 54
      if spec.nil? then
54 55
        show_lookup_failure gem_name, version, errors, options[:domain]
lib/rubygems/gemcutter_utilities.rb (working copy)
27 27
    end
28 28
  end
29 29

  
30
  def sign_in sign_in_host = self.host
30
  def sign_in sign_in_host = nil
31
    sign_in_host ||= self.host
31 32
    return if Gem.configuration.rubygems_api_key
32 33

  
33 34
    pretty_host = if Gem::DEFAULT_HOST == sign_in_host then
lib/rubygems.rb (working copy)
8 8
require 'rbconfig'
9 9

  
10 10
module Gem
11
  VERSION = '2.0.8'
11
  VERSION = '2.0.9'
12 12
end
13 13

  
14 14
# Must be first since it unloads the prelude from 1.9.2
test/rubygems/test_gem_commands_fetch_command.rb (working copy)
34 34
                       'gem repository directories must not be created'
35 35
  end
36 36

  
37
  def test_execute_latest
38
    util_setup_fake_fetcher
39
    util_setup_spec_fetcher @a1, @a2
40

  
41
    @fetcher.data["#{@gem_repo}gems/#{@a1.file_name}"] =
42
      File.read(@a1.cache_file)
43
    @fetcher.data["#{@gem_repo}gems/#{@a2.file_name}"] =
44
      File.read(@a2.cache_file)
45

  
46
    refute_path_exists File.join(@tempdir, 'cache'), 'sanity check'
47

  
48
    @cmd.options[:args] = [@a2.name]
49
    @cmd.options[:version] = req('>= 0.1')
50

  
51
    use_ui @ui do
52
      Dir.chdir @tempdir do
53
        @cmd.execute
54
      end
55
    end
56

  
57
    assert_path_exists(File.join(@tempdir, @a2.file_name),
58
                       "#{@a2.full_name} not fetched")
59
    refute_path_exists File.join(@tempdir, 'cache'),
60
                       'gem repository directories must not be created'
61
  end
62

  
37 63
  def test_execute_prerelease
38 64
    util_setup_fake_fetcher true
39 65
    util_clear_gems
......
53 79
      end
54 80
    end
55 81

  
56
    assert_path_exists(File.join(@tempdir, @a2_pre.file_name),
57
                       "#{@a2_pre.full_name} not fetched")
82
    assert_path_exists(File.join(@tempdir, @a2.file_name),
83
                       "#{@a2.full_name} not fetched")
58 84
  end
59 85

  
60 86
  def test_execute_specific_prerelease
test/rubygems/test_gem_gemcutter_utilities.rb (working copy)
101 101
  def test_sign_in_with_host
102 102
    api_key     = 'a5fdbb6ba150cbb83aad2bb2fede64cf040453903'
103 103

  
104
    util_sign_in [api_key, 200, 'OK'], 'http://example.com', :param
104
    util_sign_in [api_key, 200, 'OK'], 'http://example.com', ['http://example.com']
105 105

  
106 106
    assert_match "Enter your http://example.com credentials.",
107 107
                 @sign_in_ui.output
......
112 112
    assert_equal api_key, credentials[:rubygems_api_key]
113 113
  end
114 114

  
115
  def test_sign_in_with_host_nil
116
    api_key     = 'a5fdbb6ba150cbb83aad2bb2fede64cf040453903'
117

  
118
    util_sign_in [api_key, 200, 'OK'], nil, [nil]
119

  
120
    assert_match "Enter your RubyGems.org credentials.",
121
                 @sign_in_ui.output
122
    assert @fetcher.last_request["authorization"]
123
    assert_match %r{Signed in.}, @sign_in_ui.output
124

  
125
    credentials = YAML.load_file Gem.configuration.credentials_path
126
    assert_equal api_key, credentials[:rubygems_api_key]
127
  end
128

  
115 129
  def test_sign_in_with_host_ENV
116 130
    api_key     = 'a5fdbb6ba150cbb83aad2bb2fede64cf040453903'
117 131
    util_sign_in [api_key, 200, 'OK'], 'http://example.com'
......
163 177
    assert_match %r{Access Denied.}, @sign_in_ui.output
164 178
  end
165 179

  
166
  def util_sign_in response, host = nil, style = :ENV
180
  def util_sign_in response, host = nil, args = []
167 181
    skip 'Always uses $stdin on windows' if Gem.win_platform?
168 182

  
169 183
    email    = 'you@example.com'
170 184
    password = 'secret'
171 185

  
172 186
    if host
173
      ENV['RUBYGEMS_HOST'] = host if style == :ENV
187
      ENV['RUBYGEMS_HOST'] = host
174 188
    else
175 189
      host = Gem.host
176 190
    end
......
182 196
    @sign_in_ui = Gem::MockGemUi.new "#{email}\n#{password}\n"
183 197

  
184 198
    use_ui @sign_in_ui do
185
      if style == :param then
186
        @cmd.sign_in host
199
      if args.length > 0 then
200
        @cmd.sign_in(*args)
187 201
      else
188 202
        @cmd.sign_in
189 203
      end
......
209 223
  end
210 224

  
211 225
end
212