rubygems-update 2.0.0 → 2.0.2

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.

Potentially problematic release.


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

Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data.tar.gz.sig +2 -1
  4. data/.autotest +1 -0
  5. data/History.txt +32 -0
  6. data/Manifest.txt +2 -0
  7. data/lib/rubygems.rb +14 -5
  8. data/lib/rubygems/available_set.rb +70 -72
  9. data/lib/rubygems/commands/cert_command.rb +1 -0
  10. data/lib/rubygems/commands/query_command.rb +7 -7
  11. data/lib/rubygems/commands/setup_command.rb +21 -4
  12. data/lib/rubygems/commands/sources_command.rb +13 -0
  13. data/lib/rubygems/config_file.rb +29 -16
  14. data/lib/rubygems/defaults.rb +1 -1
  15. data/lib/rubygems/dependency_installer.rb +18 -10
  16. data/lib/rubygems/dependency_list.rb +1 -1
  17. data/lib/rubygems/dependency_resolver.rb +17 -4
  18. data/lib/rubygems/ext/builder.rb +0 -7
  19. data/lib/rubygems/ext/ext_conf_builder.rb +43 -8
  20. data/lib/rubygems/installer.rb +4 -4
  21. data/lib/rubygems/package.rb +2 -1
  22. data/lib/rubygems/rdoc.rb +10 -1
  23. data/lib/rubygems/remote_fetcher.rb +8 -3
  24. data/lib/rubygems/security.rb +21 -1
  25. data/lib/rubygems/security/policy.rb +2 -0
  26. data/lib/rubygems/source.rb +10 -0
  27. data/lib/rubygems/spec_fetcher.rb +38 -0
  28. data/lib/rubygems/specification.rb +1 -1
  29. data/lib/rubygems/ssl_certs/GeoTrust_Global_CA.pem +20 -0
  30. data/lib/rubygems/test_utilities.rb +6 -3
  31. data/test/rubygems/test_gem.rb +13 -1
  32. data/test/rubygems/test_gem_commands_fetch_command.rb +4 -0
  33. data/test/rubygems/test_gem_commands_query_command.rb +16 -0
  34. data/test/rubygems/test_gem_commands_setup_command.rb +18 -1
  35. data/test/rubygems/test_gem_commands_sources_command.rb +39 -0
  36. data/test/rubygems/test_gem_config_file.rb +15 -0
  37. data/test/rubygems/test_gem_dependency_installer.rb +55 -0
  38. data/test/rubygems/test_gem_dependency_resolver_api_set.rb +80 -0
  39. data/test/rubygems/test_gem_ext_ext_conf_builder.rb +1 -7
  40. data/test/rubygems/test_gem_installer.rb +92 -1
  41. data/test/rubygems/test_gem_remote_fetcher.rb +3 -0
  42. data/test/rubygems/test_gem_source.rb +11 -0
  43. data/test/rubygems/test_gem_source_list.rb +1 -1
  44. data/test/rubygems/test_gem_spec_fetcher.rb +80 -8
  45. data/test/rubygems/test_require.rb +19 -8
  46. metadata +14 -11
  47. metadata.gz.sig +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3c9ce26cced47021965b48083bad67e6a3446f38
4
- data.tar.gz: 43eddecbadeaaed4281749dbf511a0a4ff624e11
3
+ metadata.gz: 55828383c26eb529d41e882bc3bf284931fd84d1
4
+ data.tar.gz: a64439fc94a099fb4342ebb47e4361835d0b326f
5
5
  SHA512:
6
- metadata.gz: afa7d31465c734e950668041ec7a5222aa5157ff20537f5cf6ecbfb26379738007702424fb7772b6f46ad9e8ae36f789f85762fb739bb6b3f1412d3c2010a4d6
7
- data.tar.gz: fedcc37e374bcc683b8a660cd335e72c06dced37f668555fb984448f54a975e589001635e1d3bf3a1fe865897b59312eddd07938094d79df70046841645903f2
6
+ metadata.gz: 703c84109f6bab51f52d97cfda5dbed84401bd1284c0b8c387d5c1bbded19911060989f56b0927a2cf8200bc678fd7464e1f39150b68767c0bfc8181a7753cb3
7
+ data.tar.gz: 58a92fc46f3852195fc1dd2c437b0043245ed6ba3a2af7baf8fe0bee39d9532d88ea711fb8bcd4fa5b9c6f305f16fd34627edec685f42178b232a2fa2a7ca45b
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
@@ -1 +1,2 @@
1
- g/�)l����9VF��kG<Iu Z�9 ��F� ��vƽ=�Ms?F�Vc�~|ns�[Uj�cZ_����=�q`(�<�+�Dx�5b /����t���zVĔSJ���>�`�ċ{'a� vJ/$��HnR����ڿ�C�UC����F�#0� ��Gl��y��t���8�F_��<c����$z��u =�����x'�6u2ؖ�@Xc���~@W �ܵ��'z�R��9ȔjY�-Ț$ʲ��ߵ:� WEe>26
1
+ �f3�{��E�F�U9��������=ᔝ�aF�
2
+ �N��!_j\�vp�C�����qOkd�7|s',n�i��ʓ#�̽]�B�V*O�=�5��UPb$���n2�����X��_0����~RӇ�9�|X�"`� MJ���"��D�O���%����3sS�X��`�C��B_mW~2,6ȃ���X®��� S��[܋�4�^*F��z� �rC ÏB��f�&�x~�����x�.b�
data/.autotest CHANGED
@@ -37,6 +37,7 @@ class Autotest
37
37
  def path_to_classname s
38
38
  classname = old_path_to_classname(s.sub(/test.rubygems.test_/, ""))
39
39
  classname = classname.gsub('Rdoc', 'RDoc')
40
+ classname = classname.gsub('Api', 'API')
40
41
 
41
42
  classname
42
43
  end
data/History.txt CHANGED
@@ -1,5 +1,37 @@
1
1
  # coding: UTF-8
2
2
 
3
+ === 2.0.2 / 2013-03-06
4
+
5
+ * Bug fixes:
6
+ * SSL Certificates are now installed properly. Fixes #491 by hemanth.hm
7
+ * Fixed HTTP to HTTPS upgrade for rubygems.org.
8
+
9
+ === 2.0.1 / 2013-03-05
10
+
11
+ * Bug fixes:
12
+ * HTTPS URLs are preferred over HTTP URLs. RubyGems will now attempt to
13
+ upgrade any HTTP source to HTTPS. Credit to Alex Gaynor.
14
+ * Lazily load RubyGems.org API credentials to avoid failure during
15
+ RubyGems installation. Bug #465 by Isaac Sanders.
16
+ * RubyGems now picks the latest prerelease to install. Fixes bug #468 by
17
+ Santiago Pastorino.
18
+ * Improved detection of missing Zlib::GzipReader encoding support. Works
19
+ around JRuby-only bug #472 by Matt Beedle.
20
+ * "Done installing documentation" is no longer displayed when documentation
21
+ generation is disabled. Fixes bug #469 by Jeff Sandberg
22
+ * The existing executable check now respects --format-executable. Pull
23
+ request #471 by Jeremy Evans.
24
+ * RubyGems no longer creates gem subdirectories when fetching gems. Fixes
25
+ #482 by Loren Segal.
26
+ * RubyGems does not require OpenSSL like RubyGems 1.8, but still prefers it.
27
+ Fixes #481 by André Arko.
28
+ * RubyGems only fetches specs for list, search and query commands when
29
+ needed like RubyGems 1.x. Fixes bug #487 by bitbuerster, Ruby bug #8019
30
+ by Ike Miller.
31
+ * Allow specification of mode for gem subdirectory creation.
32
+ Ruby bug #7713 by nobu
33
+ * Fix tests when an 'a.rb' exists. Ruby bug #7749 by nobu.
34
+
3
35
  === 2.0.0 / 2013-02-24
4
36
 
5
37
  RubyGems 2.0 includes several new features and many breaking changes. Some of
data/Manifest.txt CHANGED
@@ -107,6 +107,7 @@ lib/rubygems/specification.rb
107
107
  lib/rubygems/ssl_certs/.document
108
108
  lib/rubygems/ssl_certs/AddTrustExternalCARoot.pem
109
109
  lib/rubygems/ssl_certs/Entrust_net-Secure-Server-Certification-Authority.pem
110
+ lib/rubygems/ssl_certs/GeoTrust_Global_CA.pem
110
111
  lib/rubygems/ssl_certs/VerisignClass3PublicPrimaryCertificationAuthority-G2.pem
111
112
  lib/rubygems/syck_hack.rb
112
113
  lib/rubygems/test_case.rb
@@ -204,6 +205,7 @@ test/rubygems/test_gem_dependency.rb
204
205
  test/rubygems/test_gem_dependency_installer.rb
205
206
  test/rubygems/test_gem_dependency_list.rb
206
207
  test/rubygems/test_gem_dependency_resolver.rb
208
+ test/rubygems/test_gem_dependency_resolver_api_set.rb
207
209
  test/rubygems/test_gem_doctor.rb
208
210
  test/rubygems/test_gem_ext_cmake_builder.rb
209
211
  test/rubygems/test_gem_ext_configure_builder.rb
data/lib/rubygems.rb CHANGED
@@ -8,7 +8,7 @@
8
8
  require 'rbconfig'
9
9
 
10
10
  module Gem
11
- VERSION = '2.0.0'
11
+ VERSION = '2.0.2'
12
12
  end
13
13
 
14
14
  # Must be first since it unloads the prelude from 1.9.2
@@ -375,20 +375,28 @@ module Gem
375
375
  end
376
376
 
377
377
  ##
378
- # Quietly ensure the named Gem directory contains all the proper
378
+ # Quietly ensure the Gem directory +dir+ contains all the proper
379
379
  # subdirectories. If we can't create a directory due to a permission
380
380
  # problem, then we will silently continue.
381
+ #
382
+ # If +mode+ is given, missing directories are created with this mode.
383
+ #
384
+ # World-writable directories will never be created.
381
385
 
382
- def self.ensure_gem_subdirectories dir = Gem.dir
386
+ def self.ensure_gem_subdirectories dir = Gem.dir, mode = nil
383
387
  old_umask = File.umask
384
388
  File.umask old_umask | 002
385
389
 
386
390
  require 'fileutils'
387
391
 
392
+ options = {}
393
+
394
+ options[:mode] = mode if mode
395
+
388
396
  REPOSITORY_SUBDIRECTORIES.each do |name|
389
397
  subdir = File.join dir, name
390
398
  next if File.exist? subdir
391
- FileUtils.mkdir_p subdir rescue nil # in case of perms issues -- lame
399
+ FileUtils.mkdir_p subdir, options rescue nil
392
400
  end
393
401
  ensure
394
402
  File.umask old_umask
@@ -895,7 +903,8 @@ module Gem
895
903
 
896
904
  def self.win_platform?
897
905
  if @@win_platform.nil? then
898
- @@win_platform = !!WIN_PATTERNS.find { |r| RUBY_PLATFORM =~ r }
906
+ ruby_platform = RbConfig::CONFIG['host_os']
907
+ @@win_platform = !!WIN_PATTERNS.find { |r| ruby_platform =~ r }
899
908
  end
900
909
 
901
910
  @@win_platform
@@ -1,95 +1,93 @@
1
- module Gem
2
- class AvailableSet
3
- Tuple = Struct.new(:spec, :source)
1
+ class Gem::AvailableSet
2
+ Tuple = Struct.new(:spec, :source)
4
3
 
5
- def initialize
6
- @set = []
7
- @sorted = nil
8
- end
4
+ def initialize
5
+ @set = []
6
+ @sorted = nil
7
+ end
9
8
 
10
- attr_reader :set
9
+ attr_reader :set
11
10
 
12
- def add(spec, source)
13
- @set << Tuple.new(spec, source)
14
- @sorted = nil
15
- self
16
- end
11
+ def add(spec, source)
12
+ @set << Tuple.new(spec, source)
13
+ @sorted = nil
14
+ self
15
+ end
17
16
 
18
- def <<(o)
19
- case o
20
- when AvailableSet
21
- s = o.set
22
- when Array
23
- s = o.map do |sp,so|
24
- if !sp.kind_of?(Specification) or !so.kind_of?(Source)
25
- raise TypeError, "Array must be in [[spec, source], ...] form"
26
- end
27
-
28
- Tuple.new(sp,so)
17
+ def <<(o)
18
+ case o
19
+ when Gem::AvailableSet
20
+ s = o.set
21
+ when Array
22
+ s = o.map do |sp,so|
23
+ if !sp.kind_of?(Gem::Specification) or !so.kind_of?(Gem::Source)
24
+ raise TypeError, "Array must be in [[spec, source], ...] form"
29
25
  end
30
- else
31
- raise TypeError, "Must be an AvailableSet"
26
+
27
+ Tuple.new(sp,so)
32
28
  end
29
+ else
30
+ raise TypeError, "must be a Gem::AvailableSet"
31
+ end
33
32
 
34
- @set += s
35
- @sorted = nil
33
+ @set += s
34
+ @sorted = nil
36
35
 
37
- self
38
- end
36
+ self
37
+ end
39
38
 
40
- def empty?
41
- @set.empty?
42
- end
39
+ def empty?
40
+ @set.empty?
41
+ end
43
42
 
44
- def all_specs
45
- @set.map { |t| t.spec }
46
- end
43
+ def all_specs
44
+ @set.map { |t| t.spec }
45
+ end
47
46
 
48
- def match_platform!
49
- @set.reject! { |t| !Gem::Platform.match(t.spec.platform) }
50
- @sorted = nil
51
- self
52
- end
47
+ def match_platform!
48
+ @set.reject! { |t| !Gem::Platform.match(t.spec.platform) }
49
+ @sorted = nil
50
+ self
51
+ end
53
52
 
54
- def sorted
55
- @sorted ||= @set.sort do |a,b|
56
- i = b.spec <=> a.spec
57
- i != 0 ? i : (a.source <=> b.source)
58
- end
53
+ def sorted
54
+ @sorted ||= @set.sort do |a,b|
55
+ i = b.spec <=> a.spec
56
+ i != 0 ? i : (a.source <=> b.source)
59
57
  end
58
+ end
60
59
 
61
- def size
62
- @set.size
63
- end
60
+ def size
61
+ @set.size
62
+ end
64
63
 
65
- def source_for(spec)
66
- f = @set.find { |t| t.spec == spec }
67
- f.source
68
- end
64
+ def source_for(spec)
65
+ f = @set.find { |t| t.spec == spec }
66
+ f.source
67
+ end
69
68
 
70
- def pick_best!
71
- return self if empty?
69
+ def pick_best!
70
+ return self if empty?
72
71
 
73
- @set = [sorted.first]
74
- @sorted = nil
75
- self
76
- end
72
+ @set = [sorted.first]
73
+ @sorted = nil
74
+ self
75
+ end
77
76
 
78
- def remove_installed!(dep)
79
- @set.reject! do |t|
80
- # already locally installed
81
- Gem::Specification.any? do |installed_spec|
82
- dep.name == installed_spec.name and
83
- dep.requirement.satisfied_by? installed_spec.version
84
- end
77
+ def remove_installed!(dep)
78
+ @set.reject! do |t|
79
+ # already locally installed
80
+ Gem::Specification.any? do |installed_spec|
81
+ dep.name == installed_spec.name and
82
+ dep.requirement.satisfied_by? installed_spec.version
85
83
  end
86
-
87
- @sorted = nil
88
- self
89
84
  end
90
85
 
91
- def inject_into_list(dep_list)
92
- @set.each { |t| dep_list.add t.spec }
93
- end
86
+ @sorted = nil
87
+ self
88
+ end
89
+
90
+ def inject_into_list(dep_list)
91
+ @set.each { |t| dep_list.add t.spec }
94
92
  end
95
93
  end
@@ -1,5 +1,6 @@
1
1
  require 'rubygems/command'
2
2
  require 'rubygems/security'
3
+ require 'openssl'
3
4
 
4
5
  class Gem::Commands::CertCommand < Gem::Command
5
6
 
@@ -192,9 +192,13 @@ class Gem::Commands::QueryCommand < Gem::Command
192
192
  end
193
193
  end
194
194
 
195
- def entry_details entry, spec, specs, platforms
195
+ def entry_details entry, detail_tuple, specs, platforms
196
196
  return unless options[:details]
197
197
 
198
+ name_tuple, spec = detail_tuple
199
+
200
+ spec = spec.fetch_spec name_tuple unless Gem::Specification === spec
201
+
198
202
  entry << "\n"
199
203
 
200
204
  spec_platforms entry, platforms
@@ -228,19 +232,15 @@ class Gem::Commands::QueryCommand < Gem::Command
228
232
 
229
233
  def make_entry entry_tuples, platforms
230
234
  detail_tuple = entry_tuples.first
231
- name_tuple, latest_spec = detail_tuple
232
-
233
- latest_spec = latest_spec.fetch_spec name_tuple unless
234
- Gem::Specification === latest_spec
235
235
 
236
236
  name_tuples, specs = entry_tuples.flatten.partition do |item|
237
237
  Gem::NameTuple === item
238
238
  end
239
239
 
240
- entry = [latest_spec.name]
240
+ entry = [name_tuples.first.name]
241
241
 
242
242
  entry_versions entry, name_tuples, platforms
243
- entry_details entry, latest_spec, specs, platforms
243
+ entry_details entry, detail_tuple, specs, platforms
244
244
 
245
245
  entry.join
246
246
  end
@@ -77,6 +77,8 @@ class Gem::Commands::SetupCommand < Gem::Command
77
77
 
78
78
  options[:document].uniq!
79
79
  end
80
+
81
+ @verbose = nil
80
82
  end
81
83
 
82
84
  def check_ruby_version
@@ -279,18 +281,27 @@ TEXT
279
281
  end
280
282
  end
281
283
 
284
+ def install_file file, dest_dir
285
+ dest_file = File.join dest_dir, file
286
+ dest_dir = File.dirname dest_file
287
+ mkdir_p dest_dir unless File.directory? dest_dir
288
+
289
+ install file, dest_file, :mode => 0644
290
+ end
291
+
282
292
  def install_lib(lib_dir)
283
293
  say "Installing RubyGems" if @verbose
284
294
 
285
295
  lib_files = rb_files_in 'lib'
296
+ pem_files = pem_files_in 'lib'
286
297
 
287
298
  Dir.chdir 'lib' do
288
299
  lib_files.each do |lib_file|
289
- dest_file = File.join lib_dir, lib_file
290
- dest_dir = File.dirname dest_file
291
- mkdir_p dest_dir unless File.directory? dest_dir
300
+ install_file lib_file, lib_dir
301
+ end
292
302
 
293
- install lib_file, dest_file, :mode => 0644
303
+ pem_files.each do |pem_file|
304
+ install_file pem_file, lib_dir
294
305
  end
295
306
  end
296
307
  end
@@ -381,6 +392,12 @@ TEXT
381
392
  [lib_dir, bin_dir]
382
393
  end
383
394
 
395
+ def pem_files_in dir
396
+ Dir.chdir dir do
397
+ Dir[File.join('**', '*pem')]
398
+ end
399
+ end
400
+
384
401
  def rb_files_in dir
385
402
  Dir.chdir dir do
386
403
  Dir[File.join('**', '*rb')]
@@ -65,6 +65,19 @@ class Gem::Commands::SourcesCommand < Gem::Command
65
65
  end
66
66
 
67
67
  if source_uri = options[:add] then
68
+ uri = URI source_uri
69
+
70
+ if uri.scheme and uri.scheme.downcase == 'http' and
71
+ uri.host.downcase == 'rubygems.org' then
72
+ question = <<-QUESTION.chomp
73
+ https://rubygems.org is recommended for security over #{uri}
74
+
75
+ Do you want to add this insecure source?
76
+ QUESTION
77
+
78
+ terminate_interaction 1 unless ask_yes_no question
79
+ end
80
+
68
81
  source = Gem::Source.new source_uri
69
82
 
70
83
  begin
@@ -126,16 +126,6 @@ class Gem::ConfigFile
126
126
 
127
127
  attr_accessor :update_sources
128
128
 
129
- ##
130
- # API key for RubyGems.org
131
-
132
- attr_reader :rubygems_api_key
133
-
134
- ##
135
- # Hash of RubyGems.org and alternate API keys
136
-
137
- attr_reader :api_keys
138
-
139
129
  ##
140
130
  # True if we want to force specification of gem server when pushing a gem
141
131
 
@@ -221,12 +211,22 @@ class Gem::ConfigFile
221
211
  @ssl_verify_mode = @hash[:ssl_verify_mode] if @hash.key? :ssl_verify_mode
222
212
  @ssl_ca_cert = @hash[:ssl_ca_cert] if @hash.key? :ssl_ca_cert
223
213
 
224
- load_api_keys
214
+ @api_keys = nil
215
+ @rubygems_api_key = nil
225
216
 
226
217
  Gem.sources = @hash[:sources] if @hash.key? :sources
227
218
  handle_arguments arg_list
228
219
  end
229
220
 
221
+ ##
222
+ # Hash of RubyGems.org and alternate API keys
223
+
224
+ def api_keys
225
+ load_api_keys unless @api_keys
226
+
227
+ @api_keys
228
+ end
229
+
230
230
  ##
231
231
  # Checks the permissions of the credentials file. If they are not 0600 an
232
232
  # error message is displayed and RubyGems aborts.
@@ -273,11 +273,24 @@ if you believe they were disclosed to a third party.
273
273
  end
274
274
 
275
275
  if @api_keys.key? :rubygems_api_key then
276
- @rubygems_api_key = @api_keys[:rubygems_api_key]
277
- @api_keys[:rubygems] = @api_keys.delete :rubygems_api_key unless @api_keys.key? :rubygems
276
+ @rubygems_api_key = @api_keys[:rubygems_api_key]
277
+ @api_keys[:rubygems] = @api_keys.delete :rubygems_api_key unless
278
+ @api_keys.key? :rubygems
278
279
  end
279
280
  end
280
281
 
282
+ ##
283
+ # Returns the RubyGems.org API key
284
+
285
+ def rubygems_api_key
286
+ load_api_keys unless @rubygems_api_key
287
+
288
+ @rubygems_api_key
289
+ end
290
+
291
+ ##
292
+ # Sets the RubyGems.org API key to +api_key+
293
+
281
294
  def rubygems_api_key= api_key
282
295
  check_credentials_permissions
283
296
 
@@ -304,14 +317,14 @@ if you believe they were disclosed to a third party.
304
317
  begin
305
318
  content = YAML.load(File.read(filename))
306
319
  unless content.kind_of? Hash
307
- warn "Failed to load #{config_file_name} because it doesn't contain valid YAML hash"
320
+ warn "Failed to load #{filename} because it doesn't contain valid YAML hash"
308
321
  return {}
309
322
  end
310
323
  return content
311
324
  rescue ArgumentError
312
- warn "Failed to load #{config_file_name}"
325
+ warn "Failed to load #{filename}"
313
326
  rescue Errno::EACCES
314
- warn "Failed to load #{config_file_name} due to permissions problem."
327
+ warn "Failed to load #{filename} due to permissions problem."
315
328
  end
316
329
 
317
330
  {}