rubygems-update 2.7.7 → 2.7.8

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.

Files changed (84) hide show
  1. checksums.yaml +4 -4
  2. data/History.txt +51 -0
  3. data/Rakefile +12 -2
  4. data/bundler/CHANGELOG.md +80 -0
  5. data/bundler/README.md +1 -1
  6. data/bundler/bundler.gemspec +2 -1
  7. data/bundler/lib/bundler.rb +10 -6
  8. data/bundler/lib/bundler/build_metadata.rb +19 -2
  9. data/bundler/lib/bundler/cli.rb +1 -1
  10. data/bundler/lib/bundler/cli/exec.rb +1 -0
  11. data/bundler/lib/bundler/cli/update.rb +3 -3
  12. data/bundler/lib/bundler/current_ruby.rb +8 -1
  13. data/bundler/lib/bundler/definition.rb +18 -13
  14. data/bundler/lib/bundler/dep_proxy.rb +2 -2
  15. data/bundler/lib/bundler/dependency.rb +1 -0
  16. data/bundler/lib/bundler/deprecate.rb +2 -1
  17. data/bundler/lib/bundler/endpoint_specification.rb +1 -1
  18. data/bundler/lib/bundler/env.rb +10 -8
  19. data/bundler/lib/bundler/fetcher.rb +1 -1
  20. data/bundler/lib/bundler/fetcher/downloader.rb +10 -5
  21. data/bundler/lib/bundler/gem_helper.rb +1 -1
  22. data/bundler/lib/bundler/gem_version_promoter.rb +12 -0
  23. data/bundler/lib/bundler/injector.rb +1 -1
  24. data/bundler/lib/bundler/installer/gem_installer.rb +6 -4
  25. data/bundler/lib/bundler/installer/parallel_installer.rb +1 -1
  26. data/bundler/lib/bundler/lazy_specification.rb +1 -1
  27. data/bundler/lib/bundler/mirror.rb +2 -2
  28. data/bundler/lib/bundler/plugin.rb +2 -2
  29. data/bundler/lib/bundler/plugin/index.rb +1 -1
  30. data/bundler/lib/bundler/process_lock.rb +1 -1
  31. data/bundler/lib/bundler/resolver.rb +10 -9
  32. data/bundler/lib/bundler/resolver/spec_group.rb +0 -4
  33. data/bundler/lib/bundler/ruby_version.rb +1 -1
  34. data/bundler/lib/bundler/runtime.rb +1 -1
  35. data/bundler/lib/bundler/shared_helpers.rb +15 -3
  36. data/bundler/lib/bundler/source/metadata.rb +1 -1
  37. data/bundler/lib/bundler/source/rubygems.rb +6 -2
  38. data/bundler/lib/bundler/source/rubygems/remote.rb +4 -1
  39. data/bundler/lib/bundler/templates/newgem/newgem.gemspec.tt +4 -0
  40. data/bundler/lib/bundler/templates/newgem/travis.yml.tt +2 -0
  41. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb +11 -1
  42. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb +7 -2
  43. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb +1 -1
  44. data/bundler/lib/bundler/version.rb +1 -1
  45. data/bundler/man/bundle-binstubs.ronn +1 -1
  46. data/bundler/man/bundle-config.ronn +4 -4
  47. data/bundler/man/bundle-exec.ronn +2 -2
  48. data/bundler/man/bundle-gem.ronn +1 -1
  49. data/bundler/man/bundle-install.ronn +12 -3
  50. data/bundler/man/bundle-lock.ronn +1 -1
  51. data/bundler/man/bundle-outdated.ronn +1 -1
  52. data/bundler/man/bundle-package.ronn +3 -3
  53. data/bundler/man/bundle-show.ronn +3 -2
  54. data/bundler/man/bundle-update.ronn +18 -14
  55. data/bundler/man/bundle-viz.ronn +1 -1
  56. data/bundler/man/bundle.ronn +18 -18
  57. data/bundler/man/gemfile.5.ronn +23 -8
  58. data/lib/rubygems.rb +3 -3
  59. data/lib/rubygems/commands/install_command.rb +7 -0
  60. data/lib/rubygems/commands/push_command.rb +36 -3
  61. data/lib/rubygems/commands/uninstall_command.rb +1 -1
  62. data/lib/rubygems/core_ext/kernel_require.rb +2 -7
  63. data/lib/rubygems/install_update_options.rb +1 -1
  64. data/lib/rubygems/package/tar_header.rb +3 -1
  65. data/lib/rubygems/package/tar_writer.rb +2 -3
  66. data/lib/rubygems/request_set.rb +25 -16
  67. data/lib/rubygems/requirement.rb +14 -3
  68. data/lib/rubygems/resolver/api_specification.rb +5 -0
  69. data/lib/rubygems/security.rb +6 -1
  70. data/lib/rubygems/util/licenses.rb +35 -4
  71. data/lib/rubygems/version.rb +7 -2
  72. data/test/rubygems/test_gem_commands_build_command.rb +2 -0
  73. data/test/rubygems/test_gem_commands_install_command.rb +37 -0
  74. data/test/rubygems/test_gem_commands_push_command.rb +20 -0
  75. data/test/rubygems/test_gem_install_update_options.rb +2 -0
  76. data/test/rubygems/test_gem_remote_fetcher.rb +5 -1
  77. data/test/rubygems/test_gem_request.rb +5 -2
  78. data/test/rubygems/test_gem_requirement.rb +6 -0
  79. data/test/rubygems/test_gem_resolver_api_specification.rb +24 -0
  80. data/test/rubygems/test_gem_specification.rb +17 -3
  81. data/test/rubygems/test_gem_version.rb +29 -3
  82. data/util/ci +1 -1
  83. data/util/generate_spdx_license_list.rb +15 -6
  84. metadata +2 -2
@@ -10,7 +10,7 @@ require 'rbconfig'
10
10
  require 'thread'
11
11
 
12
12
  module Gem
13
- VERSION = "2.7.7"
13
+ VERSION = "2.7.8"
14
14
  end
15
15
 
16
16
  # Must be first since it unloads the prelude from 1.9.2
@@ -247,7 +247,7 @@ module Gem
247
247
 
248
248
  ##
249
249
  # Find the full path to the executable for gem +name+. If the +exec_name+
250
- # is not given, the gem's default_executable is chosen, otherwise the
250
+ # is not given, an exception will be raised, otherwise the
251
251
  # specified executable's path is returned. +requirements+ allows
252
252
  # you to specify specific gem versions.
253
253
 
@@ -295,7 +295,7 @@ module Gem
295
295
 
296
296
  ##
297
297
  # Find the full path to the executable for gem +name+. If the +exec_name+
298
- # is not given, the gem's default_executable is chosen, otherwise the
298
+ # is not given, an exception will be raised, otherwise the
299
299
  # specified executable's path is returned. +requirements+ allows
300
300
  # you to specify specific gem versions.
301
301
  #
@@ -117,6 +117,13 @@ to write the specification by hand. For example:
117
117
  some_extension_gem (1.0)
118
118
  $
119
119
 
120
+ Command Alias
121
+ ==========================
122
+
123
+ You can use `i` command instead of `install`.
124
+
125
+ $ gem i GEMNAME
126
+
120
127
  EOF
121
128
  end
122
129
 
@@ -29,6 +29,8 @@ command. For further discussion see the help for the yank command.
29
29
  def initialize
30
30
  super 'push', 'Push a gem up to the gem server', :host => self.host
31
31
 
32
+ @user_defined_host = false
33
+
32
34
  add_proxy_option
33
35
  add_key_option
34
36
 
@@ -36,20 +38,41 @@ command. For further discussion see the help for the yank command.
36
38
  'Push to another gemcutter-compatible host',
37
39
  ' (e.g. https://rubygems.org)') do |value, options|
38
40
  options[:host] = value
41
+ @user_defined_host = true
39
42
  end
40
43
 
41
44
  @host = nil
42
45
  end
43
46
 
44
47
  def execute
45
- @host = options[:host]
48
+ gem_name = get_one_gem_name
49
+ default_gem_server, push_host = get_hosts_for(gem_name)
50
+
51
+ default_host = nil
52
+ user_defined_host = nil
53
+
54
+ if @user_defined_host
55
+ user_defined_host = options[:host]
56
+ else
57
+ default_host = options[:host]
58
+ end
59
+
60
+ @host = if user_defined_host
61
+ user_defined_host
62
+ elsif default_gem_server
63
+ default_gem_server
64
+ elsif push_host
65
+ push_host
66
+ else
67
+ default_host
68
+ end
46
69
 
47
70
  sign_in @host
48
71
 
49
- send_gem get_one_gem_name
72
+ send_gem(gem_name)
50
73
  end
51
74
 
52
- def send_gem name
75
+ def send_gem(name)
53
76
  args = [:post, "api/v1/gems"]
54
77
 
55
78
  latest_rubygems_version = Gem.latest_rubygems_version
@@ -100,5 +123,15 @@ You can upgrade or downgrade to the latest release version with:
100
123
  with_response response
101
124
  end
102
125
 
126
+ private
127
+
128
+ def get_hosts_for(name)
129
+ gem_metadata = Gem::Package.new(name).spec.metadata
130
+
131
+ [
132
+ gem_metadata["default_gem_server"],
133
+ gem_metadata["allowed_push_host"]
134
+ ]
135
+ end
103
136
  end
104
137
 
@@ -48,7 +48,7 @@ class Gem::Commands::UninstallCommand < Gem::Command
48
48
  end
49
49
 
50
50
  add_option('-n', '--bindir DIR',
51
- 'Directory to remove binaries from') do |value, options|
51
+ 'Directory to remove executables from') do |value, options|
52
52
  options[:bin_dir] = File.expand_path(value)
53
53
  end
54
54
 
@@ -11,13 +11,8 @@ module Kernel
11
11
 
12
12
  RUBYGEMS_ACTIVATION_MONITOR = Monitor.new # :nodoc:
13
13
 
14
- if defined?(gem_original_require) then
15
- # Ruby ships with a custom_require, override its require
16
- remove_method :require
17
- else
18
- ##
19
- # The Kernel#require from before RubyGems was loaded.
20
-
14
+ # Make sure we have a reference to Ruby's original Kernel#require
15
+ unless defined?(gem_original_require)
21
16
  alias gem_original_require require
22
17
  private :gem_original_require
23
18
  end
@@ -25,7 +25,7 @@ module Gem::InstallUpdateOptions
25
25
  end
26
26
 
27
27
  add_option(:"Install/Update", '-n', '--bindir DIR',
28
- 'Directory where binary files are',
28
+ 'Directory where executables are',
29
29
  'located') do |value, options|
30
30
  options[:bin_dir] = File.expand_path(value)
31
31
  end
@@ -94,12 +94,14 @@ class Gem::Package::TarHeader
94
94
 
95
95
  attr_reader(*FIELDS)
96
96
 
97
+ EMPTY_HEADER = ("\0" * 512).freeze # :nodoc:
98
+
97
99
  ##
98
100
  # Creates a tar header from IO +stream+
99
101
 
100
102
  def self.from(stream)
101
103
  header = stream.read 512
102
- empty = (header == "\0" * 512)
104
+ empty = (EMPTY_HEADER == header)
103
105
 
104
106
  fields = header.unpack UNPACK_FORMAT
105
107
 
@@ -111,7 +111,7 @@ class Gem::Package::TarWriter
111
111
  name, prefix = split_name name
112
112
 
113
113
  init_pos = @io.pos
114
- @io.write "\0" * 512 # placeholder for the header
114
+ @io.write Gem::Package::TarHeader::EMPTY_HEADER # placeholder for the header
115
115
 
116
116
  yield RestrictedStream.new(@io) if block_given?
117
117
 
@@ -189,8 +189,7 @@ class Gem::Package::TarWriter
189
189
  if digest.respond_to? :name then
190
190
  digest.name
191
191
  else
192
- /::([^:]+)$/ =~ digest.class.name
193
- $1
192
+ digest.class.name[/::([^:]+)\z/, 1]
194
193
  end
195
194
 
196
195
  digest_name == signer.digest_name
@@ -191,22 +191,7 @@ class Gem::RequestSet
191
191
 
192
192
  return requests if options[:gemdeps]
193
193
 
194
- specs = requests.map do |request|
195
- case request
196
- when Gem::Resolver::ActivationRequest then
197
- request.spec.spec
198
- else
199
- request
200
- end
201
- end
202
-
203
- require 'rubygems/dependency_installer'
204
- inst = Gem::DependencyInstaller.new options
205
- inst.installed_gems.replace specs
206
-
207
- Gem.done_installing_hooks.each do |hook|
208
- hook.call inst, specs
209
- end unless Gem.done_installing_hooks.empty?
194
+ install_hooks requests, options
210
195
 
211
196
  requests
212
197
  end
@@ -283,11 +268,35 @@ class Gem::RequestSet
283
268
  installed << request
284
269
  end
285
270
 
271
+ install_hooks installed, options
272
+
286
273
  installed
287
274
  ensure
288
275
  ENV['GEM_HOME'] = gem_home
289
276
  end
290
277
 
278
+ ##
279
+ # Call hooks on installed gems
280
+
281
+ def install_hooks requests, options
282
+ specs = requests.map do |request|
283
+ case request
284
+ when Gem::Resolver::ActivationRequest then
285
+ request.spec.spec
286
+ else
287
+ request
288
+ end
289
+ end
290
+
291
+ require "rubygems/dependency_installer"
292
+ inst = Gem::DependencyInstaller.new options
293
+ inst.installed_gems.replace specs
294
+
295
+ Gem.done_installing_hooks.each do |hook|
296
+ hook.call inst, specs
297
+ end unless Gem.done_installing_hooks.empty?
298
+ end
299
+
291
300
  ##
292
301
  # Load a dependency management file.
293
302
 
@@ -133,6 +133,7 @@ class Gem::Requirement
133
133
  @requirements = [DefaultRequirement]
134
134
  else
135
135
  @requirements = requirements.map! { |r| self.class.parse r }
136
+ sort_requirements!
136
137
  end
137
138
  end
138
139
 
@@ -146,6 +147,7 @@ class Gem::Requirement
146
147
  new = new.map { |r| self.class.parse r }
147
148
 
148
149
  @requirements.concat new
150
+ sort_requirements!
149
151
  end
150
152
 
151
153
  ##
@@ -183,11 +185,11 @@ class Gem::Requirement
183
185
  end
184
186
 
185
187
  def as_list # :nodoc:
186
- requirements.map { |op, version| "#{op} #{version}" }.sort
188
+ requirements.map { |op, version| "#{op} #{version}" }
187
189
  end
188
190
 
189
191
  def hash # :nodoc:
190
- requirements.sort.hash
192
+ requirements.hash
191
193
  end
192
194
 
193
195
  def marshal_dump # :nodoc:
@@ -264,7 +266,8 @@ class Gem::Requirement
264
266
  end
265
267
 
266
268
  def == other # :nodoc:
267
- Gem::Requirement === other and to_s == other.to_s
269
+ return unless Gem::Requirement === other
270
+ requirements == other.requirements
268
271
  end
269
272
 
270
273
  private
@@ -279,6 +282,14 @@ class Gem::Requirement
279
282
  end
280
283
  end
281
284
  end
285
+
286
+ def sort_requirements! # :nodoc:
287
+ @requirements.sort! do |l, r|
288
+ comp = l.last <=> r.last # first, sort by the requirement's version
289
+ next comp unless comp == 0
290
+ l.first <=> r.first # then, sort by the operator (for stability)
291
+ end
292
+ end
282
293
  end
283
294
 
284
295
  class Gem::Version
@@ -21,6 +21,7 @@ class Gem::Resolver::APISpecification < Gem::Resolver::Specification
21
21
  @name = api_data[:name]
22
22
  @version = Gem::Version.new api_data[:number]
23
23
  @platform = Gem::Platform.new api_data[:platform]
24
+ @original_platform = api_data[:platform]
24
25
  @dependencies = api_data[:dependencies].map do |name, ver|
25
26
  Gem::Dependency.new name, ver.split(/\s*,\s*/)
26
27
  end
@@ -73,7 +74,11 @@ class Gem::Resolver::APISpecification < Gem::Resolver::Specification
73
74
  @spec ||=
74
75
  begin
75
76
  tuple = Gem::NameTuple.new @name, @version, @platform
77
+ source.fetch_spec tuple
78
+ rescue Gem::RemoteFetcher::FetchError
79
+ raise if @original_platform == @platform
76
80
 
81
+ tuple = Gem::NameTuple.new @name, @version, @original_platform
77
82
  source.fetch_spec tuple
78
83
  end
79
84
  end
@@ -344,14 +344,19 @@ module Gem::Security
344
344
  OpenSSL::Digest::SHA256
345
345
  elsif defined?(OpenSSL::Digest::SHA1) then
346
346
  OpenSSL::Digest::SHA1
347
+ else
348
+ require 'digest'
349
+ Digest::SHA512
347
350
  end
348
351
 
349
352
  ##
350
353
  # Used internally to select the signing digest from all computed digests
351
354
 
352
355
  DIGEST_NAME = # :nodoc:
353
- if DIGEST_ALGORITHM then
356
+ if DIGEST_ALGORITHM.method_defined? :name then
354
357
  DIGEST_ALGORITHM.new.name
358
+ else
359
+ DIGEST_ALGORITHM.name[/::([^:]+)\z/, 1]
355
360
  end
356
361
 
357
362
  ##
@@ -8,7 +8,7 @@ class Gem::Licenses
8
8
 
9
9
  # Software Package Data Exchange (SPDX) standard open-source software
10
10
  # license identifiers
11
- IDENTIFIERS = %w(
11
+ LICENSE_IDENTIFIERS = %w(
12
12
  0BSD
13
13
  AAL
14
14
  ADSL
@@ -354,12 +354,43 @@ class Gem::Licenses
354
354
  zlib-acknowledgement
355
355
  ).freeze
356
356
 
357
+ # exception identifiers
358
+ EXCEPTION_IDENTIFIERS = %w(
359
+ 389-exception
360
+ Autoconf-exception-2.0
361
+ Autoconf-exception-3.0
362
+ Bison-exception-2.2
363
+ Bootloader-exception
364
+ CLISP-exception-2.0
365
+ Classpath-exception-2.0
366
+ DigiRule-FOSS-exception
367
+ FLTK-exception
368
+ Fawkes-Runtime-exception
369
+ Font-exception-2.0
370
+ GCC-exception-2.0
371
+ GCC-exception-3.1
372
+ LZMA-exception
373
+ Libtool-exception
374
+ Linux-syscall-note
375
+ Nokia-Qt-exception-1.1
376
+ OCCT-exception-1.0
377
+ Qwt-exception-1.0
378
+ WxWindows-exception-3.1
379
+ eCos-exception-2.0
380
+ freertos-exception-2.0
381
+ gnu-javamail-exception
382
+ i2p-gpl-java-exception
383
+ mif-exception
384
+ openvpn-openssl-exception
385
+ u-boot-exception-2.0
386
+ ).freeze
387
+
357
388
  REGEXP = %r{
358
389
  \A
359
390
  (
360
- #{Regexp.union(IDENTIFIERS)}
391
+ #{Regexp.union(LICENSE_IDENTIFIERS)}
361
392
  \+?
362
- (\s WITH \s .+)?
393
+ (\s WITH \s #{Regexp.union(EXCEPTION_IDENTIFIERS)})?
363
394
  | #{NONSTANDARD}
364
395
  )
365
396
  \Z
@@ -370,7 +401,7 @@ class Gem::Licenses
370
401
  end
371
402
 
372
403
  def self.suggestions(license)
373
- by_distance = IDENTIFIERS.group_by do |identifier|
404
+ by_distance = LICENSE_IDENTIFIERS.group_by do |identifier|
374
405
  levenshtein_distance(identifier, license)
375
406
  end
376
407
  lowest = by_distance.keys.min
@@ -170,7 +170,10 @@ class Gem::Version
170
170
  # True if the +version+ string matches RubyGems' requirements.
171
171
 
172
172
  def self.correct? version
173
- return false if version.nil?
173
+ unless Gem::Deprecate.skip
174
+ warn "nil versions are discouraged and will be deprecated in Rubygems 4" if version.nil?
175
+ end
176
+
174
177
  !!(version.to_s =~ ANCHORED_VERSION_PATTERN)
175
178
  end
176
179
 
@@ -325,7 +328,9 @@ class Gem::Version
325
328
  segments.pop while segments.size > 2
326
329
  segments.push 0 while segments.size < 2
327
330
 
328
- "~> #{segments.join(".")}"
331
+ recommendation = "~> #{segments.join(".")}"
332
+ recommendation += ".a" if prerelease?
333
+ recommendation
329
334
  end
330
335
 
331
336
  ##
@@ -122,6 +122,8 @@ class TestGemCommandsBuildCommand < Gem::TestCase
122
122
  SIGNING_KEY = key_path 'private3072'
123
123
 
124
124
  def test_build_signed_gem
125
+ skip 'openssl is missing' unless defined?(OpenSSL::SSL)
126
+
125
127
  trust_dir = Gem::Security.trust_dir
126
128
 
127
129
  spec = util_spec 'some_gem' do |s|
@@ -416,6 +416,43 @@ ERROR: Possible alternatives: non_existent_with_hint
416
416
  assert_path_exists File.join(a2.doc_dir, 'rdoc')
417
417
  end
418
418
 
419
+ def test_execute_rdoc_with_path
420
+ skip if RUBY_VERSION <= "1.8.7"
421
+ specs = spec_fetcher do |fetcher|
422
+ fetcher.gem 'a', 2
423
+ end
424
+
425
+ Gem.done_installing(&Gem::RDoc.method(:generation_hook))
426
+
427
+ @cmd.options[:document] = %w[rdoc ri]
428
+ @cmd.options[:domain] = :local
429
+ @cmd.options[:install_dir] = 'whatever'
430
+
431
+ a2 = specs['a-2']
432
+ FileUtils.mv a2.cache_file, @tempdir
433
+
434
+ @cmd.options[:args] = %w[a]
435
+
436
+ use_ui @ui do
437
+ # Don't use Dir.chdir with a block, it warnings a lot because
438
+ # of a downstream Dir.chdir with a block
439
+ old = Dir.getwd
440
+
441
+ begin
442
+ Dir.chdir @tempdir
443
+ assert_raises Gem::MockGemUi::SystemExitException, @ui.error do
444
+ @cmd.execute
445
+ end
446
+ ensure
447
+ Dir.chdir old
448
+ end
449
+ end
450
+
451
+ wait_for_child_process_to_exit
452
+
453
+ assert_path_exists 'whatever/doc/a-2', 'documentation not installed'
454
+ end
455
+
419
456
  def test_execute_saves_build_args
420
457
  specs = spec_fetcher do |fetcher|
421
458
  fetcher.gem 'a', 2