rubygems-update 3.5.6 → 3.5.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (91) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +54 -0
  3. data/Manifest.txt +7 -4
  4. data/bundler/CHANGELOG.md +30 -0
  5. data/bundler/lib/bundler/build_metadata.rb +2 -2
  6. data/bundler/lib/bundler/cli/binstubs.rb +1 -1
  7. data/bundler/lib/bundler/cli/plugin.rb +3 -2
  8. data/bundler/lib/bundler/cli.rb +1 -1
  9. data/bundler/lib/bundler/dsl.rb +16 -1
  10. data/bundler/lib/bundler/gem_version_promoter.rb +42 -38
  11. data/bundler/lib/bundler/man/bundle-add.1 +1 -1
  12. data/bundler/lib/bundler/man/bundle-binstubs.1 +1 -1
  13. data/bundler/lib/bundler/man/bundle-cache.1 +1 -1
  14. data/bundler/lib/bundler/man/bundle-check.1 +1 -1
  15. data/bundler/lib/bundler/man/bundle-clean.1 +1 -1
  16. data/bundler/lib/bundler/man/bundle-config.1 +1 -1
  17. data/bundler/lib/bundler/man/bundle-console.1 +1 -1
  18. data/bundler/lib/bundler/man/bundle-doctor.1 +1 -1
  19. data/bundler/lib/bundler/man/bundle-exec.1 +1 -1
  20. data/bundler/lib/bundler/man/bundle-gem.1 +1 -1
  21. data/bundler/lib/bundler/man/bundle-help.1 +1 -1
  22. data/bundler/lib/bundler/man/bundle-info.1 +1 -1
  23. data/bundler/lib/bundler/man/bundle-init.1 +1 -1
  24. data/bundler/lib/bundler/man/bundle-inject.1 +1 -1
  25. data/bundler/lib/bundler/man/bundle-install.1 +3 -3
  26. data/bundler/lib/bundler/man/bundle-install.1.ronn +2 -2
  27. data/bundler/lib/bundler/man/bundle-list.1 +1 -1
  28. data/bundler/lib/bundler/man/bundle-lock.1 +1 -1
  29. data/bundler/lib/bundler/man/bundle-open.1 +1 -1
  30. data/bundler/lib/bundler/man/bundle-outdated.1 +1 -1
  31. data/bundler/lib/bundler/man/bundle-platform.1 +1 -1
  32. data/bundler/lib/bundler/man/bundle-plugin.1 +7 -4
  33. data/bundler/lib/bundler/man/bundle-plugin.1.ronn +7 -3
  34. data/bundler/lib/bundler/man/bundle-pristine.1 +1 -1
  35. data/bundler/lib/bundler/man/bundle-remove.1 +1 -1
  36. data/bundler/lib/bundler/man/bundle-show.1 +1 -1
  37. data/bundler/lib/bundler/man/bundle-update.1 +1 -1
  38. data/bundler/lib/bundler/man/bundle-version.1 +1 -1
  39. data/bundler/lib/bundler/man/bundle-viz.1 +1 -1
  40. data/bundler/lib/bundler/man/bundle.1 +1 -1
  41. data/bundler/lib/bundler/man/gemfile.5 +3 -3
  42. data/bundler/lib/bundler/man/gemfile.5.ronn +2 -2
  43. data/bundler/lib/bundler/plugin/installer/path.rb +18 -0
  44. data/bundler/lib/bundler/plugin/installer.rb +36 -16
  45. data/bundler/lib/bundler/plugin/source_list.rb +4 -4
  46. data/bundler/lib/bundler/resolver/candidate.rb +1 -1
  47. data/bundler/lib/bundler/resolver.rb +54 -24
  48. data/bundler/lib/bundler/self_manager.rb +1 -1
  49. data/bundler/lib/bundler/settings.rb +10 -7
  50. data/bundler/lib/bundler/source/rubygems.rb +2 -2
  51. data/bundler/lib/bundler/source_list.rb +2 -2
  52. data/bundler/lib/bundler/templates/newgem/newgem.gemspec.tt +4 -3
  53. data/bundler/lib/bundler/templates/newgem/rubocop.yml.tt +0 -5
  54. data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/static_package_source.rb +1 -0
  55. data/bundler/lib/bundler/vendored_net_http.rb +7 -3
  56. data/bundler/lib/bundler/vendored_timeout.rb +7 -3
  57. data/bundler/lib/bundler/version.rb +1 -1
  58. data/lib/rubygems/command.rb +1 -1
  59. data/lib/rubygems/command_manager.rb +2 -1
  60. data/lib/rubygems/commands/build_command.rb +2 -11
  61. data/lib/rubygems/commands/help_command.rb +2 -2
  62. data/lib/rubygems/commands/rdoc_command.rb +1 -8
  63. data/lib/rubygems/commands/rebuild_command.rb +264 -0
  64. data/lib/rubygems/config_file.rb +20 -8
  65. data/lib/rubygems/defaults.rb +4 -4
  66. data/lib/rubygems/dependency.rb +2 -2
  67. data/lib/rubygems/dependency_list.rb +1 -1
  68. data/lib/rubygems/ext/cargo_builder.rb +1 -1
  69. data/lib/rubygems/gemcutter_utilities.rb +1 -1
  70. data/lib/rubygems/gemspec_helpers.rb +19 -0
  71. data/lib/rubygems/package.rb +2 -2
  72. data/lib/rubygems/remote_fetcher.rb +1 -1
  73. data/lib/rubygems/request.rb +1 -1
  74. data/lib/rubygems/request_set.rb +1 -1
  75. data/lib/rubygems/resolver/spec_specification.rb +7 -0
  76. data/lib/rubygems/s3_uri_signer.rb +1 -1
  77. data/lib/rubygems/safe_yaml.rb +10 -1
  78. data/lib/rubygems/security.rb +1 -1
  79. data/lib/rubygems/specification.rb +1 -1
  80. data/lib/rubygems/specification_policy.rb +9 -1
  81. data/lib/rubygems/util/licenses.rb +43 -0
  82. data/lib/rubygems/vendor/molinillo/lib/molinillo/dependency_graph.rb +1 -1
  83. data/lib/rubygems/vendored_net_http.rb +5 -0
  84. data/lib/rubygems/vendored_timeout.rb +5 -0
  85. data/lib/rubygems.rb +2 -2
  86. data/rubygems-update.gemspec +1 -1
  87. metadata +10 -7
  88. data/lib/rubygems/net/http.rb +0 -3
  89. data/lib/rubygems/timeout.rb +0 -3
  90. /data/lib/rubygems/{optparse.rb → vendored_optparse.rb} +0 -0
  91. /data/lib/rubygems/{tsort.rb → vendored_tsort.rb} +0 -0
@@ -1,6 +1,6 @@
1
1
  .\" generated with nRonn/v0.11.1
2
2
  .\" https://github.com/n-ronn/nronn/tree/0.11.1
3
- .TH "BUNDLE\-PRISTINE" "1" "December 2023" ""
3
+ .TH "BUNDLE\-PRISTINE" "1" "March 2024" ""
4
4
  .SH "NAME"
5
5
  \fBbundle\-pristine\fR \- Restores installed gems to their pristine condition
6
6
  .SH "SYNOPSIS"
@@ -1,6 +1,6 @@
1
1
  .\" generated with nRonn/v0.11.1
2
2
  .\" https://github.com/n-ronn/nronn/tree/0.11.1
3
- .TH "BUNDLE\-REMOVE" "1" "December 2023" ""
3
+ .TH "BUNDLE\-REMOVE" "1" "March 2024" ""
4
4
  .SH "NAME"
5
5
  \fBbundle\-remove\fR \- Removes gems from the Gemfile
6
6
  .SH "SYNOPSIS"
@@ -1,6 +1,6 @@
1
1
  .\" generated with nRonn/v0.11.1
2
2
  .\" https://github.com/n-ronn/nronn/tree/0.11.1
3
- .TH "BUNDLE\-SHOW" "1" "December 2023" ""
3
+ .TH "BUNDLE\-SHOW" "1" "March 2024" ""
4
4
  .SH "NAME"
5
5
  \fBbundle\-show\fR \- Shows all the gems in your bundle, or the path to a gem
6
6
  .SH "SYNOPSIS"
@@ -1,6 +1,6 @@
1
1
  .\" generated with nRonn/v0.11.1
2
2
  .\" https://github.com/n-ronn/nronn/tree/0.11.1
3
- .TH "BUNDLE\-UPDATE" "1" "December 2023" ""
3
+ .TH "BUNDLE\-UPDATE" "1" "March 2024" ""
4
4
  .SH "NAME"
5
5
  \fBbundle\-update\fR \- Update your gems to the latest available versions
6
6
  .SH "SYNOPSIS"
@@ -1,6 +1,6 @@
1
1
  .\" generated with nRonn/v0.11.1
2
2
  .\" https://github.com/n-ronn/nronn/tree/0.11.1
3
- .TH "BUNDLE\-VERSION" "1" "December 2023" ""
3
+ .TH "BUNDLE\-VERSION" "1" "March 2024" ""
4
4
  .SH "NAME"
5
5
  \fBbundle\-version\fR \- Prints Bundler version information
6
6
  .SH "SYNOPSIS"
@@ -1,6 +1,6 @@
1
1
  .\" generated with nRonn/v0.11.1
2
2
  .\" https://github.com/n-ronn/nronn/tree/0.11.1
3
- .TH "BUNDLE\-VIZ" "1" "December 2023" ""
3
+ .TH "BUNDLE\-VIZ" "1" "March 2024" ""
4
4
  .SH "NAME"
5
5
  \fBbundle\-viz\fR \- Generates a visual dependency graph for your Gemfile
6
6
  .SH "SYNOPSIS"
@@ -1,6 +1,6 @@
1
1
  .\" generated with nRonn/v0.11.1
2
2
  .\" https://github.com/n-ronn/nronn/tree/0.11.1
3
- .TH "BUNDLE" "1" "December 2023" ""
3
+ .TH "BUNDLE" "1" "March 2024" ""
4
4
  .SH "NAME"
5
5
  \fBbundle\fR \- Ruby Dependency Management
6
6
  .SH "SYNOPSIS"
@@ -1,6 +1,6 @@
1
1
  .\" generated with nRonn/v0.11.1
2
2
  .\" https://github.com/n-ronn/nronn/tree/0.11.1
3
- .TH "GEMFILE" "5" "December 2023" ""
3
+ .TH "GEMFILE" "5" "March 2024" ""
4
4
  .SH "NAME"
5
5
  \fBGemfile\fR \- A format for describing gem dependencies for Ruby programs
6
6
  .SH "SYNOPSIS"
@@ -72,7 +72,7 @@ A Ruby engine is an implementation of the Ruby language\.
72
72
  .IP "\(bu" 4
73
73
  For background: the reference or original implementation of the Ruby programming language is called Matz's Ruby Interpreter \fIhttps://en\.wikipedia\.org/wiki/Ruby_MRI\fR, or MRI for short\. This is named after Ruby creator Yukihiro Matsumoto, also known as Matz\. MRI is also known as CRuby, because it is written in C\. MRI is the most widely used Ruby engine\.
74
74
  .IP "\(bu" 4
75
- Other implementations \fIhttps://www\.ruby\-lang\.org/en/about/\fR of Ruby exist\. Some of the more well\-known implementations include JRuby \fIhttp://jruby\.org/\fR and TruffleRuby \fIhttps://www\.graalvm\.org/ruby/\fR\. Rubinius is an alternative implementation of Ruby written in Ruby\. JRuby is an implementation of Ruby on the JVM, short for Java Virtual Machine\. TruffleRuby is a Ruby implementation on the GraalVM, a language toolkit built on the JVM\.
75
+ Other implementations \fIhttps://www\.ruby\-lang\.org/en/about/\fR of Ruby exist\. Some of the more well\-known implementations include JRuby \fIhttps://www\.jruby\.org/\fR and TruffleRuby \fIhttps://www\.graalvm\.org/ruby/\fR\. Rubinius is an alternative implementation of Ruby written in Ruby\. JRuby is an implementation of Ruby on the JVM, short for Java Virtual Machine\. TruffleRuby is a Ruby implementation on the GraalVM, a language toolkit built on the JVM\.
76
76
  .IP "" 0
77
77
  .SS "ENGINE VERSION"
78
78
  Each application \fImay\fR specify a Ruby engine version\. If an engine version is specified, an engine \fImust\fR also be specified\. If the engine is "ruby" the engine version specified \fImust\fR match the Ruby version\.
@@ -449,7 +449,7 @@ end
449
449
  .fi
450
450
  .IP "" 0
451
451
  .SH "GEMSPEC"
452
- The \fB\.gemspec\fR \fIhttp://guides\.rubygems\.org/specification\-reference/\fR file is where you provide metadata about your gem to Rubygems\. Some required Gemspec attributes include the name, description, and homepage of your gem\. This is also where you specify the dependencies your gem needs to run\.
452
+ The \fB\.gemspec\fR \fIhttps://guides\.rubygems\.org/specification\-reference/\fR file is where you provide metadata about your gem to Rubygems\. Some required Gemspec attributes include the name, description, and homepage of your gem\. This is also where you specify the dependencies your gem needs to run\.
453
453
  .P
454
454
  If you wish to use Bundler to help install dependencies for a gem while it is being developed, use the \fBgemspec\fR method to pull in the dependencies listed in the \fB\.gemspec\fR file\.
455
455
  .P
@@ -96,7 +96,7 @@ What exactly is an Engine?
96
96
 
97
97
  - [Other implementations](https://www.ruby-lang.org/en/about/) of Ruby exist.
98
98
  Some of the more well-known implementations include
99
- [JRuby](http://jruby.org/) and [TruffleRuby](https://www.graalvm.org/ruby/).
99
+ [JRuby](https://www.jruby.org/) and [TruffleRuby](https://www.graalvm.org/ruby/).
100
100
  Rubinius is an alternative implementation of Ruby written in Ruby.
101
101
  JRuby is an implementation of Ruby on the JVM, short for Java Virtual Machine.
102
102
  TruffleRuby is a Ruby implementation on the GraalVM, a language toolkit built on the JVM.
@@ -509,7 +509,7 @@ software is installed or some other conditions are met.
509
509
 
510
510
  ## GEMSPEC
511
511
 
512
- The [`.gemspec`](http://guides.rubygems.org/specification-reference/) file is where
512
+ The [`.gemspec`](https://guides.rubygems.org/specification-reference/) file is where
513
513
  you provide metadata about your gem to Rubygems. Some required Gemspec
514
514
  attributes include the name, description, and homepage of your gem. This is
515
515
  also where you specify the dependencies your gem needs to run.
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bundler
4
+ module Plugin
5
+ class Installer
6
+ class Path < Bundler::Source::Path
7
+ def root
8
+ Plugin.root
9
+ end
10
+
11
+ def generate_bin(spec, disable_extensions = false)
12
+ # Need to find a way without code duplication
13
+ # For now, we can ignore this
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -10,6 +10,7 @@ module Bundler
10
10
  class Installer
11
11
  autoload :Rubygems, File.expand_path("installer/rubygems", __dir__)
12
12
  autoload :Git, File.expand_path("installer/git", __dir__)
13
+ autoload :Path, File.expand_path("installer/path", __dir__)
13
14
 
14
15
  def install(names, options)
15
16
  check_sources_consistency!(options)
@@ -18,8 +19,8 @@ module Bundler
18
19
 
19
20
  if options[:git]
20
21
  install_git(names, version, options)
21
- elsif options[:local_git]
22
- install_local_git(names, version, options)
22
+ elsif options[:path]
23
+ install_path(names, version, options[:path])
23
24
  else
24
25
  sources = options[:source] || Gem.sources
25
26
  install_rubygems(names, version, sources)
@@ -45,20 +46,40 @@ module Bundler
45
46
  if options.key?(:git) && options.key?(:local_git)
46
47
  raise InvalidOption, "Remote and local plugin git sources can't be both specified"
47
48
  end
49
+
50
+ # back-compat; local_git is an alias for git
51
+ if options.key?(:local_git)
52
+ Bundler::SharedHelpers.major_deprecation(2, "--local_git is deprecated, use --git")
53
+ options[:git] = options.delete(:local_git)
54
+ end
55
+
56
+ if (options.keys & [:source, :git, :path]).length > 1
57
+ raise InvalidOption, "Only one of --source, --git, or --path may be specified"
58
+ end
59
+
60
+ if (options.key?(:branch) || options.key?(:ref)) && !options.key?(:git)
61
+ raise InvalidOption, "--#{options.key?(:branch) ? "branch" : "ref"} can only be used with git sources"
62
+ end
63
+
64
+ if options.key?(:branch) && options.key?(:ref)
65
+ raise InvalidOption, "--branch and --ref can't be both specified"
66
+ end
48
67
  end
49
68
 
50
69
  def install_git(names, version, options)
51
- uri = options.delete(:git)
52
- options["uri"] = uri
70
+ source_list = SourceList.new
71
+ source = source_list.add_git_source({ "uri" => options[:git],
72
+ "branch" => options[:branch],
73
+ "ref" => options[:ref] })
53
74
 
54
- install_all_sources(names, version, options, options[:source])
75
+ install_all_sources(names, version, source_list, source)
55
76
  end
56
77
 
57
- def install_local_git(names, version, options)
58
- uri = options.delete(:local_git)
59
- options["uri"] = uri
78
+ def install_path(names, version, path)
79
+ source_list = SourceList.new
80
+ source = source_list.add_path_source({ "path" => path })
60
81
 
61
- install_all_sources(names, version, options, options[:source])
82
+ install_all_sources(names, version, source_list, source)
62
83
  end
63
84
 
64
85
  # Installs the plugin from rubygems source and returns the path where the
@@ -70,16 +91,15 @@ module Bundler
70
91
  #
71
92
  # @return [Hash] map of names to the specs of plugins installed
72
93
  def install_rubygems(names, version, sources)
73
- install_all_sources(names, version, nil, sources)
74
- end
75
-
76
- def install_all_sources(names, version, git_source_options, rubygems_source)
77
94
  source_list = SourceList.new
78
95
 
79
- source_list.add_git_source(git_source_options) if git_source_options
80
- Array(rubygems_source).each {|remote| source_list.add_global_rubygems_remote(remote) } if rubygems_source
96
+ Array(sources).each {|remote| source_list.add_global_rubygems_remote(remote) }
97
+
98
+ install_all_sources(names, version, source_list)
99
+ end
81
100
 
82
- deps = names.map {|name| Dependency.new name, version }
101
+ def install_all_sources(names, version, source_list, source = nil)
102
+ deps = names.map {|name| Dependency.new(name, version, { "source" => source }) }
83
103
 
84
104
  Bundler.configure_gem_home_and_path(Plugin.root)
85
105
 
@@ -9,6 +9,10 @@ module Bundler
9
9
  add_source_to_list Plugin::Installer::Git.new(options), git_sources
10
10
  end
11
11
 
12
+ def add_path_source(options = {})
13
+ add_source_to_list Plugin::Installer::Path.new(options), path_sources
14
+ end
15
+
12
16
  def add_rubygems_source(options = {})
13
17
  add_source_to_list Plugin::Installer::Rubygems.new(options), @rubygems_sources
14
18
  end
@@ -17,10 +21,6 @@ module Bundler
17
21
  path_sources + git_sources + rubygems_sources + [metadata_source]
18
22
  end
19
23
 
20
- def default_source
21
- git_sources.first || global_rubygems_source
22
- end
23
-
24
24
  private
25
25
 
26
26
  def rubygems_aggregate_class
@@ -15,7 +15,7 @@ module Bundler
15
15
  # considered separately.
16
16
  #
17
17
  # Some candidates may also keep some information explicitly about the
18
- # package the refer to. These candidates are referred to as "canonical" and
18
+ # package they refer to. These candidates are referred to as "canonical" and
19
19
  # are used when materializing resolution results back into RubyGems
20
20
  # specifications that can be installed, written to lock files, and so on.
21
21
  #
@@ -50,26 +50,26 @@ module Bundler
50
50
  specs[name] = matches.sort_by {|s| [s.version, s.platform.to_s] }
51
51
  end
52
52
 
53
+ @all_versions = Hash.new do |candidates, package|
54
+ candidates[package] = all_versions_for(package)
55
+ end
56
+
53
57
  @sorted_versions = Hash.new do |candidates, package|
54
- candidates[package] = if package.root?
55
- [root_version]
56
- else
57
- all_versions_for(package).sort
58
- end
58
+ candidates[package] = filtered_versions_for(package).sort
59
59
  end
60
60
 
61
+ @sorted_versions[root] = [root_version]
62
+
61
63
  root_dependencies = prepare_dependencies(@requirements, @packages)
62
64
 
63
65
  @cached_dependencies = Hash.new do |dependencies, package|
64
- dependencies[package] = if package.root?
65
- { root_version => root_dependencies }
66
- else
67
- Hash.new do |versions, version|
68
- versions[version] = to_dependency_hash(version.dependencies.reject {|d| d.name == package.name }, @packages)
69
- end
66
+ dependencies[package] = Hash.new do |versions, version|
67
+ versions[version] = to_dependency_hash(version.dependencies.reject {|d| d.name == package.name }, @packages)
70
68
  end
71
69
  end
72
70
 
71
+ @cached_dependencies[root] = { root_version => root_dependencies }
72
+
73
73
  logger = Bundler::UI::Shell.new
74
74
  logger.level = debug? ? "debug" : "warn"
75
75
 
@@ -156,9 +156,15 @@ module Bundler
156
156
  end
157
157
 
158
158
  def versions_for(package, range=VersionRange.any)
159
- versions = range.select_versions(@sorted_versions[package])
159
+ versions = select_sorted_versions(package, range)
160
160
 
161
- sort_versions(package, versions)
161
+ # Conditional avoids (among other things) calling
162
+ # sort_versions_by_preferred with the root package
163
+ if versions.size > 1
164
+ sort_versions_by_preferred(package, versions)
165
+ else
166
+ versions
167
+ end
162
168
  end
163
169
 
164
170
  def no_versions_incompatibility_for(package, unsatisfied_term)
@@ -247,7 +253,7 @@ module Bundler
247
253
  locked_requirement = base_requirements[name]
248
254
  results = filter_matching_specs(results, locked_requirement) if locked_requirement
249
255
 
250
- versions = results.group_by(&:version).reduce([]) do |groups, (version, specs)|
256
+ results.group_by(&:version).reduce([]) do |groups, (version, specs)|
251
257
  platform_specs = package.platforms.map {|platform| select_best_platform_match(specs, platform) }
252
258
 
253
259
  # If package is a top-level dependency,
@@ -274,8 +280,6 @@ module Bundler
274
280
 
275
281
  groups
276
282
  end
277
-
278
- sort_versions(package, versions)
279
283
  end
280
284
 
281
285
  def source_for(name)
@@ -334,6 +338,21 @@ module Bundler
334
338
 
335
339
  private
336
340
 
341
+ def filtered_versions_for(package)
342
+ @gem_version_promoter.filter_versions(package, @all_versions[package])
343
+ end
344
+
345
+ def raise_all_versions_filtered_out!(package)
346
+ level = @gem_version_promoter.level
347
+ name = package.name
348
+ locked_version = package.locked_version
349
+ requirement = package.dependency
350
+
351
+ raise GemNotFound,
352
+ "#{name} is locked to #{locked_version}, while Gemfile is requesting #{requirement}. " \
353
+ "--strict --#{level} was specified, but there are no #{level} level upgrades from #{locked_version} satisfying #{requirement}, so version solving has failed"
354
+ end
355
+
337
356
  def filter_matching_specs(specs, requirements)
338
357
  Array(requirements).flat_map do |requirement|
339
358
  specs.select {| spec| requirement_satisfied_by?(requirement, spec) }
@@ -357,12 +376,8 @@ module Bundler
357
376
  requirement.satisfied_by?(spec.version) || spec.source.is_a?(Source::Gemspec)
358
377
  end
359
378
 
360
- def sort_versions(package, versions)
361
- if versions.size > 1
362
- @gem_version_promoter.sort_versions(package, versions).reverse
363
- else
364
- versions
365
- end
379
+ def sort_versions_by_preferred(package, versions)
380
+ @gem_version_promoter.sort_versions(package, versions)
366
381
  end
367
382
 
368
383
  def repository_for(package)
@@ -379,12 +394,19 @@ module Bundler
379
394
 
380
395
  next [dep_package, dep_constraint] if name == "bundler"
381
396
 
382
- versions = versions_for(dep_package, dep_constraint.range)
397
+ dep_range = dep_constraint.range
398
+ versions = select_sorted_versions(dep_package, dep_range)
383
399
  if versions.empty? && dep_package.ignores_prereleases?
400
+ @all_versions.delete(dep_package)
384
401
  @sorted_versions.delete(dep_package)
385
402
  dep_package.consider_prereleases!
386
- versions = versions_for(dep_package, dep_constraint.range)
403
+ versions = select_sorted_versions(dep_package, dep_range)
387
404
  end
405
+
406
+ if versions.empty? && select_all_versions(dep_package, dep_range).any?
407
+ raise_all_versions_filtered_out!(dep_package)
408
+ end
409
+
388
410
  next [dep_package, dep_constraint] unless versions.empty?
389
411
 
390
412
  next unless dep_package.current_platform?
@@ -393,6 +415,14 @@ module Bundler
393
415
  end.compact.to_h
394
416
  end
395
417
 
418
+ def select_sorted_versions(package, range)
419
+ range.select_versions(@sorted_versions[package])
420
+ end
421
+
422
+ def select_all_versions(package, range)
423
+ range.select_versions(@all_versions[package])
424
+ end
425
+
396
426
  def other_specs_matching_message(specs, requirement)
397
427
  message = String.new("The source contains the following gems matching '#{requirement}':\n")
398
428
  message << specs.map {|s| " * #{s.full_name}" }.join("\n")
@@ -113,7 +113,7 @@ module Bundler
113
113
  end
114
114
 
115
115
  def local_specs
116
- @local_specs ||= Bundler::Source::Rubygems.new("allow_local" => true).specs.select {|spec| spec.name == "bundler" }
116
+ @local_specs ||= Bundler::Source::Rubygems.new("allow_local" => true, "allow_cached" => true).specs.select {|spec| spec.name == "bundler" }
117
117
  end
118
118
 
119
119
  def remote_specs
@@ -492,16 +492,19 @@ module Bundler
492
492
  valid_file = file.exist? && !file.size.zero?
493
493
  return {} unless valid_file
494
494
  serializer_class.load(file.read).inject({}) do |config, (k, v)|
495
- if k.include?("-")
496
- Bundler.ui.warn "Your #{file} config includes `#{k}`, which contains the dash character (`-`).\n" \
497
- "This is deprecated, because configuration through `ENV` should be possible, but `ENV` keys cannot include dashes.\n" \
498
- "Please edit #{file} and replace any dashes in configuration keys with a triple underscore (`___`)."
495
+ unless k.start_with?("#")
496
+ if k.include?("-")
497
+ Bundler.ui.warn "Your #{file} config includes `#{k}`, which contains the dash character (`-`).\n" \
498
+ "This is deprecated, because configuration through `ENV` should be possible, but `ENV` keys cannot include dashes.\n" \
499
+ "Please edit #{file} and replace any dashes in configuration keys with a triple underscore (`___`)."
499
500
 
500
- # string hash keys are frozen
501
- k = k.gsub("-", "___")
501
+ # string hash keys are frozen
502
+ k = k.gsub("-", "___")
503
+ end
504
+
505
+ config[k] = v
502
506
  end
503
507
 
504
- config[k] = v
505
508
  config
506
509
  end
507
510
  end
@@ -17,7 +17,7 @@ module Bundler
17
17
  @remotes = []
18
18
  @dependency_names = []
19
19
  @allow_remote = false
20
- @allow_cached = false
20
+ @allow_cached = options["allow_cached"] || false
21
21
  @allow_local = options["allow_local"] || false
22
22
  @checksum_store = Checksum::Store.new
23
23
 
@@ -133,7 +133,7 @@ module Bundler
133
133
  # sources, and large_idx.merge! small_idx is way faster than
134
134
  # small_idx.merge! large_idx.
135
135
  index = @allow_remote ? remote_specs.dup : Index.new
136
- index.merge!(cached_specs) if @allow_cached || @allow_remote
136
+ index.merge!(cached_specs) if @allow_cached
137
137
  index.merge!(installed_specs) if @allow_local
138
138
  index
139
139
  end
@@ -9,7 +9,7 @@ module Bundler
9
9
  :metadata_source
10
10
 
11
11
  def global_rubygems_source
12
- @global_rubygems_source ||= rubygems_aggregate_class.new("allow_local" => true)
12
+ @global_rubygems_source ||= rubygems_aggregate_class.new("allow_local" => true, "allow_cached" => true)
13
13
  end
14
14
 
15
15
  def initialize
@@ -174,7 +174,7 @@ module Bundler
174
174
  replacement_source = replacement_sources.find {|s| s == global_rubygems_source }
175
175
  return global_rubygems_source unless replacement_source
176
176
 
177
- replacement_source.local!
177
+ replacement_source.cached!
178
178
  replacement_source
179
179
  end
180
180
 
@@ -27,9 +27,10 @@ Gem::Specification.new do |spec|
27
27
 
28
28
  # Specify which files should be added to the gem when it is released.
29
29
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
30
- spec.files = Dir.chdir(__dir__) do
31
- `git ls-files -z`.split("\x0").reject do |f|
32
- (File.expand_path(f) == __FILE__) ||
30
+ gemspec = File.basename(__FILE__)
31
+ spec.files = IO.popen(%w[git ls-files -z], chdir: __dir__, err: IO::NULL) do |ls|
32
+ ls.readlines("\x0", chomp: true).reject do |f|
33
+ (f == gemspec) ||
33
34
  f.start_with?(*%w[bin/ test/ spec/ features/ .git <%= config[:ci_config_path] %>appveyor Gemfile])
34
35
  end
35
36
  end
@@ -2,12 +2,7 @@ AllCops:
2
2
  TargetRubyVersion: <%= ::Gem::Version.new(config[:required_ruby_version]).segments[0..1].join(".") %>
3
3
 
4
4
  Style/StringLiterals:
5
- Enabled: true
6
5
  EnforcedStyle: double_quotes
7
6
 
8
7
  Style/StringLiteralsInInterpolation:
9
- Enabled: true
10
8
  EnforcedStyle: double_quotes
11
-
12
- Layout/LineLength:
13
- Max: 120
@@ -1,4 +1,5 @@
1
1
  require_relative 'package'
2
+ require_relative 'rubygems'
2
3
  require_relative 'version_constraint'
3
4
  require_relative 'incompatibility'
4
5
  require_relative 'basic_package_source'
@@ -1,8 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  begin
4
- require "rubygems/net/http"
4
+ require "rubygems/vendored_net_http"
5
5
  rescue LoadError
6
- require "net/http"
7
- Gem::Net = Net
6
+ begin
7
+ require "rubygems/net/http"
8
+ rescue LoadError
9
+ require "net/http"
10
+ Gem::Net = Net
11
+ end
8
12
  end
@@ -1,8 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  begin
4
- require "rubygems/timeout"
4
+ require "rubygems/vendored_timeout"
5
5
  rescue LoadError
6
- require "timeout"
7
- Gem::Timeout = Timeout
6
+ begin
7
+ require "rubygems/timeout"
8
+ rescue LoadError
9
+ require "timeout"
10
+ Gem::Timeout = Timeout
11
+ end
8
12
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: false
2
2
 
3
3
  module Bundler
4
- VERSION = "2.5.6".freeze
4
+ VERSION = "2.5.8".freeze
5
5
 
6
6
  def self.bundler_major_version
7
7
  @bundler_major_version ||= VERSION.split(".").first.to_i
@@ -6,7 +6,7 @@
6
6
  # See LICENSE.txt for permissions.
7
7
  #++
8
8
 
9
- require_relative "optparse"
9
+ require_relative "vendored_optparse"
10
10
  require_relative "requirement"
11
11
  require_relative "user_interaction"
12
12
 
@@ -60,6 +60,7 @@ class Gem::CommandManager
60
60
  :push,
61
61
  :query,
62
62
  :rdoc,
63
+ :rebuild,
63
64
  :search,
64
65
  :server,
65
66
  :signin,
@@ -106,7 +107,7 @@ class Gem::CommandManager
106
107
  # Register all the subcommands supported by the gem command.
107
108
 
108
109
  def initialize
109
- require_relative "timeout"
110
+ require_relative "vendored_timeout"
110
111
  @commands = {}
111
112
 
112
113
  BUILTIN_COMMANDS.each do |name|
@@ -1,11 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative "../command"
4
+ require_relative "../gemspec_helpers"
4
5
  require_relative "../package"
5
6
  require_relative "../version_option"
6
7
 
7
8
  class Gem::Commands::BuildCommand < Gem::Command
8
9
  include Gem::VersionOption
10
+ include Gem::GemspecHelpers
9
11
 
10
12
  def initialize
11
13
  super "build", "Build a gem from a gemspec"
@@ -75,17 +77,6 @@ Gems can be saved to a specified filename with the output option:
75
77
 
76
78
  private
77
79
 
78
- def find_gemspec(glob = "*.gemspec")
79
- gemspecs = Dir.glob(glob).sort
80
-
81
- if gemspecs.size > 1
82
- alert_error "Multiple gemspecs found: #{gemspecs}, please specify one"
83
- terminate_interaction(1)
84
- end
85
-
86
- gemspecs.first
87
- end
88
-
89
80
  def build_gem
90
81
  gemspec = resolve_gem_name
91
82
 
@@ -59,7 +59,7 @@ multiple environments. The RubyGems implementation is designed to be
59
59
  compatible with Bundler's Gemfile format. You can see additional
60
60
  documentation on the format at:
61
61
 
62
- http://bundler.io
62
+ https://bundler.io
63
63
 
64
64
  RubyGems automatically looks for these gem dependencies files:
65
65
 
@@ -172,7 +172,7 @@ and #platforms methods:
172
172
  See the bundler Gemfile manual page for a list of platforms supported in a gem
173
173
  dependencies file.:
174
174
 
175
- http://bundler.io/v1.6/man/gemfile.5.html
175
+ https://bundler.io/v2.5/man/gemfile.5.html
176
176
 
177
177
  Ruby Version and Engine Dependency
178
178
  ==================================
@@ -84,14 +84,7 @@ Use --overwrite to force rebuilding of documentation.
84
84
  FileUtils.rm_rf File.join(spec.doc_dir, "rdoc")
85
85
  end
86
86
 
87
- begin
88
- doc.generate
89
- rescue Errno::ENOENT => e
90
- match = / - /.match(e.message)
91
- alert_error "Unable to document #{spec.full_name}, " \
92
- " #{match.post_match} is missing, skipping"
93
- terminate_interaction 1 if specs.length == 1
94
- end
87
+ doc.generate
95
88
  end
96
89
  end
97
90
  end