rubygems-update 3.5.22 → 3.6.0

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.
Files changed (242) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +91 -0
  3. data/Manifest.txt +23 -16
  4. data/README.md +14 -9
  5. data/bundler/CHANGELOG.md +83 -0
  6. data/bundler/bundler.gemspec +2 -2
  7. data/bundler/lib/bundler/build_metadata.rb +2 -2
  8. data/bundler/lib/bundler/cli/add.rb +2 -0
  9. data/bundler/lib/bundler/cli/check.rb +2 -2
  10. data/bundler/lib/bundler/cli/console.rb +0 -4
  11. data/bundler/lib/bundler/cli/doctor.rb +4 -4
  12. data/bundler/lib/bundler/cli/exec.rb +1 -0
  13. data/bundler/lib/bundler/cli/gem.rb +1 -1
  14. data/bundler/lib/bundler/cli/info.rb +2 -2
  15. data/bundler/lib/bundler/cli/inject.rb +1 -1
  16. data/bundler/lib/bundler/cli/install.rb +4 -0
  17. data/bundler/lib/bundler/cli/lock.rb +20 -1
  18. data/bundler/lib/bundler/cli/pristine.rb +1 -1
  19. data/bundler/lib/bundler/cli/show.rb +2 -2
  20. data/bundler/lib/bundler/cli.rb +23 -53
  21. data/bundler/lib/bundler/compact_index_client/cache_file.rb +0 -5
  22. data/bundler/lib/bundler/compact_index_client/updater.rb +0 -11
  23. data/bundler/lib/bundler/definition.rb +143 -76
  24. data/bundler/lib/bundler/dependency.rb +1 -1
  25. data/bundler/lib/bundler/dsl.rb +33 -28
  26. data/bundler/lib/bundler/endpoint_specification.rb +10 -1
  27. data/bundler/lib/bundler/errors.rb +10 -0
  28. data/bundler/lib/bundler/feature_flag.rb +1 -0
  29. data/bundler/lib/bundler/fetcher/compact_index.rb +1 -1
  30. data/bundler/lib/bundler/fetcher.rb +10 -3
  31. data/bundler/lib/bundler/gem_helpers.rb +21 -5
  32. data/bundler/lib/bundler/injector.rb +2 -2
  33. data/bundler/lib/bundler/inline.rb +12 -8
  34. data/bundler/lib/bundler/installer/standalone.rb +2 -2
  35. data/bundler/lib/bundler/installer.rb +4 -38
  36. data/bundler/lib/bundler/lazy_specification.rb +74 -26
  37. data/bundler/lib/bundler/lockfile_generator.rb +1 -1
  38. data/bundler/lib/bundler/lockfile_parser.rb +9 -1
  39. data/bundler/lib/bundler/man/bundle-add.1 +17 -11
  40. data/bundler/lib/bundler/man/bundle-add.1.ronn +16 -10
  41. data/bundler/lib/bundler/man/bundle-binstubs.1 +7 -4
  42. data/bundler/lib/bundler/man/bundle-binstubs.1.ronn +6 -3
  43. data/bundler/lib/bundler/man/bundle-cache.1 +30 -2
  44. data/bundler/lib/bundler/man/bundle-cache.1.ronn +31 -2
  45. data/bundler/lib/bundler/man/bundle-check.1 +3 -3
  46. data/bundler/lib/bundler/man/bundle-check.1.ronn +4 -2
  47. data/bundler/lib/bundler/man/bundle-clean.1 +1 -1
  48. data/bundler/lib/bundler/man/bundle-config.1 +3 -5
  49. data/bundler/lib/bundler/man/bundle-config.1.ronn +2 -7
  50. data/bundler/lib/bundler/man/bundle-console.1 +2 -4
  51. data/bundler/lib/bundler/man/bundle-console.1.ronn +2 -7
  52. data/bundler/lib/bundler/man/bundle-doctor.1 +2 -2
  53. data/bundler/lib/bundler/man/bundle-doctor.1.ronn +1 -1
  54. data/bundler/lib/bundler/man/bundle-env.1 +9 -0
  55. data/bundler/lib/bundler/man/bundle-env.1.ronn +10 -0
  56. data/bundler/lib/bundler/man/bundle-exec.1 +5 -2
  57. data/bundler/lib/bundler/man/bundle-exec.1.ronn +4 -1
  58. data/bundler/lib/bundler/man/bundle-fund.1 +22 -0
  59. data/bundler/lib/bundler/man/bundle-fund.1.ronn +25 -0
  60. data/bundler/lib/bundler/man/bundle-gem.1 +17 -5
  61. data/bundler/lib/bundler/man/bundle-gem.1.ronn +27 -6
  62. data/bundler/lib/bundler/man/bundle-help.1 +1 -1
  63. data/bundler/lib/bundler/man/bundle-info.1 +5 -2
  64. data/bundler/lib/bundler/man/bundle-info.1.ronn +6 -2
  65. data/bundler/lib/bundler/man/bundle-init.1 +3 -3
  66. data/bundler/lib/bundler/man/bundle-init.1.ronn +3 -2
  67. data/bundler/lib/bundler/man/bundle-inject.1 +10 -2
  68. data/bundler/lib/bundler/man/bundle-inject.1.ronn +9 -1
  69. data/bundler/lib/bundler/man/bundle-install.1 +15 -12
  70. data/bundler/lib/bundler/man/bundle-install.1.ronn +22 -18
  71. data/bundler/lib/bundler/man/bundle-issue.1 +45 -0
  72. data/bundler/lib/bundler/man/bundle-issue.1.ronn +37 -0
  73. data/bundler/lib/bundler/man/bundle-licenses.1 +9 -0
  74. data/bundler/lib/bundler/man/bundle-licenses.1.ronn +10 -0
  75. data/bundler/lib/bundler/man/bundle-list.1 +1 -1
  76. data/bundler/lib/bundler/man/bundle-list.1.ronn +4 -1
  77. data/bundler/lib/bundler/man/bundle-lock.1 +21 -6
  78. data/bundler/lib/bundler/man/bundle-lock.1.ronn +25 -4
  79. data/bundler/lib/bundler/man/bundle-open.1 +2 -2
  80. data/bundler/lib/bundler/man/bundle-open.1.ronn +2 -1
  81. data/bundler/lib/bundler/man/bundle-outdated.1 +8 -5
  82. data/bundler/lib/bundler/man/bundle-outdated.1.ronn +8 -4
  83. data/bundler/lib/bundler/man/bundle-platform.1 +1 -1
  84. data/bundler/lib/bundler/man/bundle-plugin.1 +1 -1
  85. data/bundler/lib/bundler/man/bundle-pristine.1 +1 -1
  86. data/bundler/lib/bundler/man/bundle-pristine.1.ronn +1 -1
  87. data/bundler/lib/bundler/man/bundle-remove.1 +1 -1
  88. data/bundler/lib/bundler/man/bundle-remove.1.ronn +1 -1
  89. data/bundler/lib/bundler/man/bundle-show.1 +5 -2
  90. data/bundler/lib/bundler/man/bundle-show.1.ronn +4 -0
  91. data/bundler/lib/bundler/man/bundle-update.1 +13 -7
  92. data/bundler/lib/bundler/man/bundle-update.1.ronn +14 -6
  93. data/bundler/lib/bundler/man/bundle-version.1 +1 -1
  94. data/bundler/lib/bundler/man/bundle-viz.1 +4 -4
  95. data/bundler/lib/bundler/man/bundle-viz.1.ronn +7 -3
  96. data/bundler/lib/bundler/man/bundle.1 +1 -1
  97. data/bundler/lib/bundler/man/gemfile.5 +1 -1
  98. data/bundler/lib/bundler/man/index.txt +4 -0
  99. data/bundler/lib/bundler/materialization.rb +59 -0
  100. data/bundler/lib/bundler/plugin/events.rb +24 -0
  101. data/bundler/lib/bundler/plugin/installer.rb +1 -1
  102. data/bundler/lib/bundler/plugin.rb +20 -1
  103. data/bundler/lib/bundler/process_lock.rb +10 -14
  104. data/bundler/lib/bundler/remote_specification.rb +6 -1
  105. data/bundler/lib/bundler/resolver/base.rb +6 -6
  106. data/bundler/lib/bundler/resolver/candidate.rb +2 -2
  107. data/bundler/lib/bundler/resolver/spec_group.rb +4 -3
  108. data/bundler/lib/bundler/resolver.rb +5 -5
  109. data/bundler/lib/bundler/rubygems_ext.rb +30 -27
  110. data/bundler/lib/bundler/rubygems_gem_installer.rb +3 -2
  111. data/bundler/lib/bundler/rubygems_integration.rb +23 -40
  112. data/bundler/lib/bundler/runtime.rb +27 -7
  113. data/bundler/lib/bundler/self_manager.rb +2 -3
  114. data/bundler/lib/bundler/settings.rb +6 -1
  115. data/bundler/lib/bundler/shared_helpers.rb +29 -17
  116. data/bundler/lib/bundler/source/git/git_proxy.rb +0 -6
  117. data/bundler/lib/bundler/source/git.rb +56 -31
  118. data/bundler/lib/bundler/source/metadata.rb +2 -3
  119. data/bundler/lib/bundler/source/path.rb +2 -2
  120. data/bundler/lib/bundler/source_list.rb +1 -1
  121. data/bundler/lib/bundler/spec_set.rb +81 -56
  122. data/bundler/lib/bundler/stub_specification.rb +8 -0
  123. data/bundler/lib/bundler/templates/newgem/Gemfile.tt +0 -3
  124. data/bundler/lib/bundler/templates/newgem/README.md.tt +1 -1
  125. data/bundler/lib/bundler/templates/newgem/github/workflows/main.yml.tt +15 -15
  126. data/bundler/lib/bundler/templates/newgem/newgem.gemspec.tt +4 -4
  127. data/bundler/lib/bundler/uri_credentials_filter.rb +1 -1
  128. data/bundler/lib/bundler/vendor/fileutils/COPYING +56 -0
  129. data/bundler/lib/bundler/vendor/fileutils/lib/fileutils.rb +15 -13
  130. data/bundler/lib/bundler/vendor/securerandom/COPYING +56 -0
  131. data/bundler/lib/bundler/vendor/securerandom/lib/securerandom.rb +5 -5
  132. data/bundler/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +3 -5
  133. data/bundler/lib/bundler/vendor/thor/lib/thor/group.rb +11 -0
  134. data/bundler/lib/bundler/vendor/thor/lib/thor/parser/argument.rb +1 -4
  135. data/bundler/lib/bundler/vendor/thor/lib/thor/parser/option.rb +2 -2
  136. data/bundler/lib/bundler/vendor/thor/lib/thor/parser/options.rb +2 -1
  137. data/bundler/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +9 -9
  138. data/bundler/lib/bundler/vendor/thor/lib/thor/shell/html.rb +1 -1
  139. data/bundler/lib/bundler/vendor/thor/lib/thor/shell/table_printer.rb +5 -21
  140. data/bundler/lib/bundler/vendor/thor/lib/thor/util.rb +1 -1
  141. data/bundler/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
  142. data/bundler/lib/bundler/vendor/thor/lib/thor.rb +11 -0
  143. data/bundler/lib/bundler/vendor/uri/COPYING +56 -0
  144. data/bundler/lib/bundler/vendor/uri/lib/uri/common.rb +37 -16
  145. data/bundler/lib/bundler/vendor/uri/lib/uri/file.rb +3 -3
  146. data/bundler/lib/bundler/vendor/uri/lib/uri/ftp.rb +1 -1
  147. data/bundler/lib/bundler/vendor/uri/lib/uri/generic.rb +16 -26
  148. data/bundler/lib/bundler/vendor/uri/lib/uri/http.rb +2 -2
  149. data/bundler/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb +10 -3
  150. data/bundler/lib/bundler/vendor/uri/lib/uri/rfc3986_parser.rb +26 -3
  151. data/bundler/lib/bundler/vendor/uri/lib/uri/version.rb +1 -1
  152. data/bundler/lib/bundler/vendor/uri/lib/uri.rb +9 -9
  153. data/bundler/lib/bundler/vendored_securerandom.rb +0 -2
  154. data/bundler/lib/bundler/version.rb +1 -1
  155. data/bundler/lib/bundler.rb +38 -14
  156. data/{CONTRIBUTING.md → doc/rubygems/CONTRIBUTING.md} +9 -9
  157. data/{POLICIES.md → doc/rubygems/POLICIES.md} +11 -11
  158. data/lib/rubygems/basic_specification.rb +5 -4
  159. data/lib/rubygems/commands/cleanup_command.rb +2 -2
  160. data/lib/rubygems/commands/contents_command.rb +4 -4
  161. data/lib/rubygems/commands/exec_command.rb +3 -0
  162. data/lib/rubygems/commands/pristine_command.rb +2 -2
  163. data/lib/rubygems/commands/push_command.rb +29 -5
  164. data/lib/rubygems/commands/rdoc_command.rb +2 -2
  165. data/lib/rubygems/commands/rebuild_command.rb +0 -2
  166. data/lib/rubygems/commands/setup_command.rb +7 -16
  167. data/lib/rubygems/commands/unpack_command.rb +0 -6
  168. data/lib/rubygems/commands/update_command.rb +2 -8
  169. data/lib/rubygems/config_file.rb +12 -0
  170. data/lib/rubygems/core_ext/kernel_warn.rb +2 -6
  171. data/lib/rubygems/defaults.rb +1 -1
  172. data/lib/rubygems/exceptions.rb +0 -6
  173. data/lib/rubygems/ext/builder.rb +6 -4
  174. data/lib/rubygems/ext/cargo_builder.rb +7 -4
  175. data/lib/rubygems/ext/cmake_builder.rb +7 -2
  176. data/lib/rubygems/ext/configure_builder.rb +7 -2
  177. data/lib/rubygems/ext/ext_conf_builder.rb +9 -5
  178. data/lib/rubygems/ext/rake_builder.rb +6 -1
  179. data/lib/rubygems/gem_runner.rb +9 -0
  180. data/lib/rubygems/gemcutter_utilities.rb +8 -2
  181. data/lib/rubygems/install_update_options.rb +5 -0
  182. data/lib/rubygems/installer.rb +8 -9
  183. data/lib/rubygems/package/tar_header.rb +11 -0
  184. data/lib/rubygems/package/tar_reader/entry.rb +1 -5
  185. data/lib/rubygems/platform.rb +4 -3
  186. data/lib/rubygems/psych_tree.rb +4 -0
  187. data/lib/rubygems/request_set/gem_dependency_api.rb +1 -1
  188. data/lib/rubygems/requirement.rb +0 -4
  189. data/lib/rubygems/resolver/composed_set.rb +3 -3
  190. data/lib/rubygems/resolver/git_set.rb +0 -1
  191. data/lib/rubygems/resolver/index_set.rb +2 -2
  192. data/lib/rubygems/resolver.rb +3 -3
  193. data/lib/rubygems/source/git.rb +13 -10
  194. data/lib/rubygems/spec_fetcher.rb +46 -7
  195. data/lib/rubygems/specification.rb +38 -32
  196. data/lib/rubygems/target_rbconfig.rb +50 -0
  197. data/lib/rubygems/uri.rb +1 -1
  198. data/lib/rubygems/util/licenses.rb +10 -1
  199. data/lib/rubygems/vendor/net-http/COPYING +56 -0
  200. data/lib/rubygems/vendor/net-http/lib/net/http/header.rb +1 -1
  201. data/lib/rubygems/vendor/net-http/lib/net/http/requests.rb +5 -0
  202. data/lib/rubygems/vendor/net-http/lib/net/http.rb +120 -36
  203. data/lib/rubygems/vendor/optparse/lib/optparse/ac.rb +16 -0
  204. data/lib/rubygems/vendor/optparse/lib/optparse/kwargs.rb +8 -3
  205. data/lib/rubygems/vendor/optparse/lib/optparse/version.rb +9 -0
  206. data/lib/rubygems/vendor/optparse/lib/optparse.rb +147 -51
  207. data/lib/rubygems/vendor/resolv/COPYING +56 -0
  208. data/lib/rubygems/vendor/resolv/lib/resolv.rb +50 -37
  209. data/lib/rubygems/vendor/securerandom/COPYING +56 -0
  210. data/lib/rubygems/vendor/securerandom/lib/securerandom.rb +5 -5
  211. data/lib/rubygems/vendor/timeout/COPYING +56 -0
  212. data/lib/rubygems/vendor/timeout/lib/timeout.rb +5 -8
  213. data/lib/rubygems/vendor/uri/COPYING +56 -0
  214. data/lib/rubygems/vendor/uri/lib/uri/common.rb +37 -16
  215. data/lib/rubygems/vendor/uri/lib/uri/file.rb +3 -3
  216. data/lib/rubygems/vendor/uri/lib/uri/ftp.rb +1 -1
  217. data/lib/rubygems/vendor/uri/lib/uri/generic.rb +16 -26
  218. data/lib/rubygems/vendor/uri/lib/uri/http.rb +2 -2
  219. data/lib/rubygems/vendor/uri/lib/uri/rfc2396_parser.rb +10 -3
  220. data/lib/rubygems/vendor/uri/lib/uri/rfc3986_parser.rb +26 -3
  221. data/lib/rubygems/vendor/uri/lib/uri/version.rb +1 -1
  222. data/lib/rubygems/vendor/uri/lib/uri.rb +9 -9
  223. data/lib/rubygems/vendored_securerandom.rb +0 -1
  224. data/lib/rubygems/version.rb +0 -4
  225. data/lib/rubygems.rb +30 -20
  226. data/rubygems-update.gemspec +5 -5
  227. data/setup.rb +1 -1
  228. metadata +36 -27
  229. data/bundler/lib/bundler/vendor/fileutils/LICENSE.txt +0 -22
  230. data/bundler/lib/bundler/vendor/securerandom/LICENSE.txt +0 -22
  231. data/bundler/lib/bundler/vendor/securerandom/lib/random/formatter.rb +0 -373
  232. data/bundler/lib/bundler/vendor/uri/LICENSE.txt +0 -22
  233. data/lib/rubygems/vendor/net-http/LICENSE.txt +0 -22
  234. data/lib/rubygems/vendor/net-http/lib/net/http/backward.rb +0 -40
  235. data/lib/rubygems/vendor/resolv/LICENSE.txt +0 -22
  236. data/lib/rubygems/vendor/securerandom/LICENSE.txt +0 -22
  237. data/lib/rubygems/vendor/securerandom/lib/random/formatter.rb +0 -373
  238. data/lib/rubygems/vendor/timeout/LICENSE.txt +0 -22
  239. data/lib/rubygems/vendor/uri/LICENSE.txt +0 -22
  240. /data/{MAINTAINERS.txt → doc/MAINTAINERS.txt} +0 -0
  241. /data/{bundler → doc/bundler}/UPGRADING.md +0 -0
  242. /data/{UPGRADING.md → doc/rubygems/UPGRADING.md} +0 -0
@@ -36,7 +36,6 @@ class Gem::Resolver::GitSet < Gem::Resolver::Set
36
36
  def initialize # :nodoc:
37
37
  super()
38
38
 
39
- @git = ENV["git"] || "git"
40
39
  @need_submodules = {}
41
40
  @repositories = {}
42
41
  @root_dir = Gem.dir
@@ -65,11 +65,11 @@ class Gem::Resolver::IndexSet < Gem::Resolver::Set
65
65
 
66
66
  q.breakable
67
67
 
68
- names = @all.values.map do |tuples|
68
+ names = @all.values.flat_map do |tuples|
69
69
  tuples.map do |_, tuple|
70
70
  tuple.full_name
71
71
  end
72
- end.flatten
72
+ end
73
73
 
74
74
  q.seplist names do |name|
75
75
  q.text name
@@ -59,7 +59,7 @@ class Gem::Resolver
59
59
  def self.compose_sets(*sets)
60
60
  sets.compact!
61
61
 
62
- sets = sets.map do |set|
62
+ sets = sets.flat_map do |set|
63
63
  case set
64
64
  when Gem::Resolver::BestSet then
65
65
  set
@@ -68,7 +68,7 @@ class Gem::Resolver
68
68
  else
69
69
  set
70
70
  end
71
- end.flatten
71
+ end
72
72
 
73
73
  case sets.length
74
74
  when 0 then
@@ -183,7 +183,7 @@ class Gem::Resolver
183
183
  # Proceed with resolution! Returns an array of ActivationRequest objects.
184
184
 
185
185
  def resolve
186
- Gem::Molinillo::Resolver.new(self, self).resolve(@needed.map {|d| DependencyRequest.new d, nil }).tsort.map(&:payload).compact
186
+ Gem::Molinillo::Resolver.new(self, self).resolve(@needed.map {|d| DependencyRequest.new d, nil }).tsort.filter_map(&:payload)
187
187
  rescue Gem::Molinillo::VersionConflict => e
188
188
  conflict = e.conflicts.values.first
189
189
  raise Gem::DependencyResolutionError, Conflict.new(conflict.requirement_trees.first.first, conflict.existing, conflict.requirement)
@@ -58,7 +58,6 @@ class Gem::Source::Git < Gem::Source
58
58
 
59
59
  @remote = true
60
60
  @root_dir = Gem.dir
61
- @git = ENV["git"] || "git"
62
61
  end
63
62
 
64
63
  def <=>(other)
@@ -81,6 +80,10 @@ class Gem::Source::Git < Gem::Source
81
80
  @need_submodules == other.need_submodules
82
81
  end
83
82
 
83
+ def git_command
84
+ ENV.fetch("git", "git")
85
+ end
86
+
84
87
  ##
85
88
  # Checks out the files for the repository into the install_dir.
86
89
 
@@ -90,18 +93,18 @@ class Gem::Source::Git < Gem::Source
90
93
  return false unless File.exist? repo_cache_dir
91
94
 
92
95
  unless File.exist? install_dir
93
- system @git, "clone", "--quiet", "--no-checkout",
96
+ system git_command, "clone", "--quiet", "--no-checkout",
94
97
  repo_cache_dir, install_dir
95
98
  end
96
99
 
97
100
  Dir.chdir install_dir do
98
- system @git, "fetch", "--quiet", "--force", "--tags", install_dir
101
+ system git_command, "fetch", "--quiet", "--force", "--tags", install_dir
99
102
 
100
- success = system @git, "reset", "--quiet", "--hard", rev_parse
103
+ success = system git_command, "reset", "--quiet", "--hard", rev_parse
101
104
 
102
105
  if @need_submodules
103
106
  require "open3"
104
- _, status = Open3.capture2e(@git, "submodule", "update", "--quiet", "--init", "--recursive")
107
+ _, status = Open3.capture2e(git_command, "submodule", "update", "--quiet", "--init", "--recursive")
105
108
 
106
109
  success &&= status.success?
107
110
  end
@@ -118,11 +121,11 @@ class Gem::Source::Git < Gem::Source
118
121
 
119
122
  if File.exist? repo_cache_dir
120
123
  Dir.chdir repo_cache_dir do
121
- system @git, "fetch", "--quiet", "--force", "--tags",
124
+ system git_command, "fetch", "--quiet", "--force", "--tags",
122
125
  @repository, "refs/heads/*:refs/heads/*"
123
126
  end
124
127
  else
125
- system @git, "clone", "--quiet", "--bare", "--no-hardlinks",
128
+ system git_command, "clone", "--quiet", "--bare", "--no-hardlinks",
126
129
  @repository, repo_cache_dir
127
130
  end
128
131
  end
@@ -182,7 +185,7 @@ class Gem::Source::Git < Gem::Source
182
185
  hash = nil
183
186
 
184
187
  Dir.chdir repo_cache_dir do
185
- hash = Gem::Util.popen(@git, "rev-parse", @reference).strip
188
+ hash = Gem::Util.popen(git_command, "rev-parse", @reference).strip
186
189
  end
187
190
 
188
191
  raise Gem::Exception,
@@ -201,7 +204,7 @@ class Gem::Source::Git < Gem::Source
201
204
  return [] unless install_dir
202
205
 
203
206
  Dir.chdir install_dir do
204
- Dir["{,*,*/*}.gemspec"].map do |spec_file|
207
+ Dir["{,*,*/*}.gemspec"].filter_map do |spec_file|
205
208
  directory = File.dirname spec_file
206
209
  file = File.basename spec_file
207
210
 
@@ -218,7 +221,7 @@ class Gem::Source::Git < Gem::Source
218
221
  end
219
222
  spec
220
223
  end
221
- end.compact
224
+ end
222
225
  end
223
226
  end
224
227
 
@@ -170,17 +170,56 @@ class Gem::SpecFetcher
170
170
  # alternative gem names.
171
171
 
172
172
  def suggest_gems_from_name(gem_name, type = :latest, num_results = 5)
173
- gem_name = gem_name.downcase.tr("_-", "")
174
- max = gem_name.size / 2
175
- names = available_specs(type).first.values.flatten(1)
173
+ gem_name = gem_name.downcase.tr("_-", "")
176
174
 
177
- matches = names.map do |n|
175
+ # All results for 3-character-or-shorter (minus hyphens/underscores) gem
176
+ # names get rejected, so we just return an empty array immediately instead.
177
+ return [] if gem_name.length <= 3
178
+
179
+ max = gem_name.size / 2
180
+ names = available_specs(type).first.values.flatten(1)
181
+
182
+ min_length = gem_name.length - max
183
+ max_length = gem_name.length + max
184
+
185
+ gem_name_with_postfix = "#{gem_name}ruby"
186
+ gem_name_with_prefix = "ruby#{gem_name}"
187
+
188
+ matches = names.filter_map do |n|
189
+ len = n.name.length
190
+ # If the gem doesn't support the current platform, bail early.
178
191
  next unless n.match_platform?
179
- distance = levenshtein_distance gem_name, n.name.downcase.tr("_-", "")
192
+
193
+ # If the length is min_length or shorter, we've done `max` deletions.
194
+ # This would be rejected later, so we skip it for performance.
195
+ next if len <= min_length
196
+
197
+ # The candidate name, normalized the same as gem_name.
198
+ normalized_name = n.name.downcase
199
+ normalized_name.tr!("_-", "")
200
+
201
+ # If the gem is "{NAME}-ruby" and "ruby-{NAME}", we want to return it.
202
+ # But we already removed hyphens, so we check "{NAME}ruby" and "ruby{NAME}".
203
+ next [n.name, 0] if normalized_name == gem_name_with_postfix
204
+ next [n.name, 0] if normalized_name == gem_name_with_prefix
205
+
206
+ # If the length is max_length or longer, we've done `max` insertions.
207
+ # This would be rejected later, so we skip it for performance.
208
+ next if len >= max_length
209
+
210
+ # If we found an exact match (after stripping underscores and hyphens),
211
+ # that's our most likely candidate.
212
+ # Return it immediately, and skip the rest of the loop.
213
+ return [n.name] if normalized_name == gem_name
214
+
215
+ distance = levenshtein_distance gem_name, normalized_name
216
+
217
+ # Skip current candidate, if the edit distance is greater than allowed.
180
218
  next if distance >= max
181
- return [n.name] if distance == 0
219
+
220
+ # If all else fails, return the name and the calculated distance.
182
221
  [n.name, distance]
183
- end.compact
222
+ end
184
223
 
185
224
  matches = if matches.empty? && type != :prerelease
186
225
  suggest_gems_from_name gem_name, :prerelease
@@ -391,7 +391,7 @@ class Gem::Specification < Gem::BasicSpecification
391
391
  # "homepage_uri" => "https://bestgemever.example.io",
392
392
  # "mailing_list_uri" => "https://groups.example.com/bestgemever",
393
393
  # "source_code_uri" => "https://example.com/user/bestgemever",
394
- # "wiki_uri" => "https://example.com/user/bestgemever/wiki"
394
+ # "wiki_uri" => "https://example.com/user/bestgemever/wiki",
395
395
  # "funding_uri" => "https://example.com/donate"
396
396
  # }
397
397
  #
@@ -464,10 +464,7 @@ class Gem::Specification < Gem::BasicSpecification
464
464
  # spec.platform = Gem::Platform.local
465
465
 
466
466
  def platform=(platform)
467
- if @original_platform.nil? ||
468
- @original_platform == Gem::Platform::RUBY
469
- @original_platform = platform
470
- end
467
+ @original_platform = platform
471
468
 
472
469
  case platform
473
470
  when Gem::Platform::CURRENT then
@@ -1017,7 +1014,7 @@ class Gem::Specification < Gem::BasicSpecification
1017
1014
  end
1018
1015
 
1019
1016
  def self.unresolved_specs
1020
- unresolved_deps.values.map(&:to_specs).flatten
1017
+ unresolved_deps.values.flat_map(&:to_specs)
1021
1018
  end
1022
1019
  private_class_method :unresolved_specs
1023
1020
 
@@ -1076,7 +1073,7 @@ class Gem::Specification < Gem::BasicSpecification
1076
1073
  result[spec.name] = spec
1077
1074
  end
1078
1075
 
1079
- result.map(&:last).flatten.sort_by(&:name)
1076
+ result.flat_map(&:last).sort_by(&:name)
1080
1077
  end
1081
1078
 
1082
1079
  ##
@@ -1202,21 +1199,30 @@ class Gem::Specification < Gem::BasicSpecification
1202
1199
  Gem.pre_reset_hooks.each(&:call)
1203
1200
  @specification_record = nil
1204
1201
  clear_load_cache
1205
- unresolved = unresolved_deps
1206
- unless unresolved.empty?
1207
- warn "WARN: Unresolved or ambiguous specs during Gem::Specification.reset:"
1208
- unresolved.values.each do |dep|
1209
- warn " #{dep}"
1210
-
1211
- versions = find_all_by_name(dep.name).uniq(&:full_name)
1212
- unless versions.empty?
1213
- warn " Available/installed versions of this gem:"
1214
- versions.each {|s| warn " - #{s.version}" }
1202
+
1203
+ unless unresolved_deps.empty?
1204
+ unresolved = unresolved_deps.filter_map do |name, dep|
1205
+ matching_versions = find_all_by_name(name)
1206
+ next if dep.latest_version? && matching_versions.any?(&:default_gem?)
1207
+
1208
+ [dep, matching_versions.uniq(&:full_name)]
1209
+ end.to_h
1210
+
1211
+ unless unresolved.empty?
1212
+ warn "WARN: Unresolved or ambiguous specs during Gem::Specification.reset:"
1213
+ unresolved.each do |dep, versions|
1214
+ warn " #{dep}"
1215
+
1216
+ unless versions.empty?
1217
+ warn " Available/installed versions of this gem:"
1218
+ versions.each {|s| warn " - #{s.version}" }
1219
+ end
1215
1220
  end
1221
+ warn "WARN: Clearing out unresolved specs. Try 'gem cleanup <gem>'"
1222
+ warn "Please report a bug if this causes problems."
1216
1223
  end
1217
- warn "WARN: Clearing out unresolved specs. Try 'gem cleanup <gem>'"
1218
- warn "Please report a bug if this causes problems."
1219
- unresolved.clear
1224
+
1225
+ unresolved_deps.clear
1220
1226
  end
1221
1227
  Gem.post_reset_hooks.each(&:call)
1222
1228
  end
@@ -1308,7 +1314,7 @@ class Gem::Specification < Gem::BasicSpecification
1308
1314
  spec.instance_variable_set :@summary, array[5]
1309
1315
  spec.instance_variable_set :@required_ruby_version, array[6]
1310
1316
  spec.instance_variable_set :@required_rubygems_version, array[7]
1311
- spec.instance_variable_set :@original_platform, array[8]
1317
+ spec.platform = array[8]
1312
1318
  spec.instance_variable_set :@dependencies, array[9]
1313
1319
  # offset due to rubyforge_project removal
1314
1320
  spec.instance_variable_set :@email, array[11]
@@ -1316,8 +1322,6 @@ class Gem::Specification < Gem::BasicSpecification
1316
1322
  spec.instance_variable_set :@description, array[13]
1317
1323
  spec.instance_variable_set :@homepage, array[14]
1318
1324
  spec.instance_variable_set :@has_rdoc, array[15]
1319
- spec.instance_variable_set :@new_platform, array[16]
1320
- spec.instance_variable_set :@platform, array[16].to_s
1321
1325
  spec.instance_variable_set :@licenses, [array[17]]
1322
1326
  spec.instance_variable_set :@metadata, array[18]
1323
1327
  spec.instance_variable_set :@loaded, false
@@ -1775,7 +1779,7 @@ class Gem::Specification < Gem::BasicSpecification
1775
1779
  # Returns all specs that matches this spec's runtime dependencies.
1776
1780
 
1777
1781
  def dependent_specs
1778
- runtime_dependencies.map(&:to_specs).flatten
1782
+ runtime_dependencies.flat_map(&:to_specs)
1779
1783
  end
1780
1784
 
1781
1785
  ##
@@ -1813,19 +1817,21 @@ class Gem::Specification < Gem::BasicSpecification
1813
1817
  def encode_with(coder) # :nodoc:
1814
1818
  coder.add "name", @name
1815
1819
  coder.add "version", @version
1816
- platform = case @original_platform
1820
+ platform = case @new_platform
1817
1821
  when nil, "" then
1818
1822
  "ruby"
1819
1823
  when String then
1820
- @original_platform
1824
+ @new_platform
1821
1825
  else
1822
- @original_platform.to_s
1826
+ @new_platform.to_s
1823
1827
  end
1824
1828
  coder.add "platform", platform
1829
+ coder.add "original_platform", @original_platform.to_s if platform != @original_platform.to_s
1825
1830
 
1826
1831
  attributes = @@attributes.map(&:to_s) - %w[name version platform]
1827
1832
  attributes.each do |name|
1828
- coder.add name, instance_variable_get("@#{name}")
1833
+ value = instance_variable_get("@#{name}")
1834
+ coder.add name, value unless value.nil?
1829
1835
  end
1830
1836
  end
1831
1837
 
@@ -1912,7 +1918,8 @@ class Gem::Specification < Gem::BasicSpecification
1912
1918
  end
1913
1919
 
1914
1920
  ##
1915
- # Work around bundler removing my methods
1921
+ # Work around old bundler versions removing my methods
1922
+ # Can be removed once RubyGems can no longer install Bundler 2.5
1916
1923
 
1917
1924
  def gem_dir # :nodoc:
1918
1925
  super
@@ -2624,13 +2631,12 @@ class Gem::Specification < Gem::BasicSpecification
2624
2631
  when "date"
2625
2632
  # Force Date to go through the extra coerce logic in date=
2626
2633
  self.date = val
2634
+ when "platform"
2635
+ self.platform = val
2627
2636
  else
2628
2637
  instance_variable_set "@#{ivar}", val
2629
2638
  end
2630
2639
  end
2631
-
2632
- @original_platform = @platform # for backwards compatibility
2633
- self.platform = Gem::Platform.new @platform
2634
2640
  end
2635
2641
 
2636
2642
  ##
@@ -0,0 +1,50 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "rbconfig"
4
+
5
+ ##
6
+ # A TargetConfig is a wrapper around an RbConfig object that provides a
7
+ # consistent interface for querying configuration for *deployment target
8
+ # platform*, where the gem being installed is intended to run on.
9
+ #
10
+ # The TargetConfig is typically created from the RbConfig of the running Ruby
11
+ # process, but can also be created from an RbConfig file on disk for cross-
12
+ # compiling gems.
13
+
14
+ class Gem::TargetRbConfig
15
+ attr_reader :path
16
+
17
+ def initialize(rbconfig, path)
18
+ @rbconfig = rbconfig
19
+ @path = path
20
+ end
21
+
22
+ ##
23
+ # Creates a TargetRbConfig for the platform that RubyGems is running on.
24
+
25
+ def self.for_running_ruby
26
+ new(::RbConfig, nil)
27
+ end
28
+
29
+ ##
30
+ # Creates a TargetRbConfig from the RbConfig file at the given path.
31
+ # Typically used for cross-compiling gems.
32
+
33
+ def self.from_path(rbconfig_path)
34
+ namespace = Module.new do |m|
35
+ # Load the rbconfig.rb file within a new anonymous module to avoid
36
+ # conflicts with the rbconfig for the running platform.
37
+ Kernel.load rbconfig_path, m
38
+ end
39
+ rbconfig = namespace.const_get(:RbConfig)
40
+
41
+ new(rbconfig, rbconfig_path)
42
+ end
43
+
44
+ ##
45
+ # Queries the configuration for the given key.
46
+
47
+ def [](key)
48
+ @rbconfig::CONFIG[key]
49
+ end
50
+ end
data/lib/rubygems/uri.rb CHANGED
@@ -30,7 +30,7 @@ class Gem::Uri
30
30
  begin
31
31
  Gem::URI.parse(uri)
32
32
  rescue Gem::URI::InvalidURIError
33
- Gem::URI.parse(Gem::URI::DEFAULT_PARSER.escape(uri))
33
+ Gem::URI.parse(Gem::URI::RFC2396_PARSER.escape(uri))
34
34
  end
35
35
  end
36
36
 
@@ -212,6 +212,8 @@ class Gem::Licenses
212
212
  DRL-1.0
213
213
  DRL-1.1
214
214
  DSDP
215
+ DocBook-Schema
216
+ DocBook-XML
215
217
  Dotseqn
216
218
  ECL-1.0
217
219
  ECL-2.0
@@ -275,6 +277,7 @@ class Gem::Licenses
275
277
  Glulxe
276
278
  Graphics-Gems
277
279
  Gutmann
280
+ HIDAPI
278
281
  HP-1986
279
282
  HP-1989
280
283
  HPND
@@ -285,6 +288,7 @@ class Gem::Licenses
285
288
  HPND-Kevlin-Henney
286
289
  HPND-MIT-disclaimer
287
290
  HPND-Markus-Kuhn
291
+ HPND-Netrek
288
292
  HPND-Pbmplus
289
293
  HPND-UC
290
294
  HPND-UC-export-US
@@ -418,7 +422,6 @@ class Gem::Licenses
418
422
  NTP
419
423
  NTP-0
420
424
  Naumen
421
- Net-SNMP
422
425
  NetCDF
423
426
  Newsletr
424
427
  Nokia
@@ -500,6 +503,7 @@ class Gem::Licenses
500
503
  RSCPL
501
504
  Rdisc
502
505
  Ruby
506
+ Ruby-pty
503
507
  SAX-PD
504
508
  SAX-PD-2.0
505
509
  SCEA
@@ -556,6 +560,7 @@ class Gem::Licenses
556
560
  UMich-Merit
557
561
  UPL-1.0
558
562
  URT-RLE
563
+ Ubuntu-font-1.0
559
564
  Unicode-3.0
560
565
  Unicode-DFS-2015
561
566
  Unicode-DFS-2016
@@ -574,6 +579,7 @@ class Gem::Licenses
574
579
  Wsuipa
575
580
  X11
576
581
  X11-distribute-modifications-variant
582
+ X11-swapped
577
583
  XFree86-1.1
578
584
  XSkat
579
585
  Xdebug-1.03
@@ -671,6 +677,7 @@ class Gem::Licenses
671
677
  LGPL-2.1+
672
678
  LGPL-3.0
673
679
  LGPL-3.0+
680
+ Net-SNMP
674
681
  Nunit
675
682
  StandardML-NJ
676
683
  bzip2-1.0.5
@@ -738,6 +745,7 @@ class Gem::Licenses
738
745
  WxWindows-exception-3.1
739
746
  cryptsetup-OpenSSL-exception
740
747
  eCos-exception-2.0
748
+ erlang-otp-linking-exception
741
749
  fmt-exception
742
750
  freertos-exception-2.0
743
751
  gnu-javamail-exception
@@ -745,6 +753,7 @@ class Gem::Licenses
745
753
  libpri-OpenH323-exception
746
754
  mif-exception
747
755
  openvpn-openssl-exception
756
+ romic-exception
748
757
  stunnel-exception
749
758
  u-boot-exception-2.0
750
759
  vsftpd-openssl-exception
@@ -0,0 +1,56 @@
1
+ Ruby is copyrighted free software by Yukihiro Matsumoto <[email protected]>.
2
+ You can redistribute it and/or modify it under either the terms of the
3
+ 2-clause BSDL (see the file BSDL), or the conditions below:
4
+
5
+ 1. You may make and give away verbatim copies of the source form of the
6
+ software without restriction, provided that you duplicate all of the
7
+ original copyright notices and associated disclaimers.
8
+
9
+ 2. You may modify your copy of the software in any way, provided that
10
+ you do at least ONE of the following:
11
+
12
+ a. place your modifications in the Public Domain or otherwise
13
+ make them Freely Available, such as by posting said
14
+ modifications to Usenet or an equivalent medium, or by allowing
15
+ the author to include your modifications in the software.
16
+
17
+ b. use the modified software only within your corporation or
18
+ organization.
19
+
20
+ c. give non-standard binaries non-standard names, with
21
+ instructions on where to get the original software distribution.
22
+
23
+ d. make other distribution arrangements with the author.
24
+
25
+ 3. You may distribute the software in object code or binary form,
26
+ provided that you do at least ONE of the following:
27
+
28
+ a. distribute the binaries and library files of the software,
29
+ together with instructions (in the manual page or equivalent)
30
+ on where to get the original distribution.
31
+
32
+ b. accompany the distribution with the machine-readable source of
33
+ the software.
34
+
35
+ c. give non-standard binaries non-standard names, with
36
+ instructions on where to get the original software distribution.
37
+
38
+ d. make other distribution arrangements with the author.
39
+
40
+ 4. You may modify and include the part of the software into any other
41
+ software (possibly commercial). But some files in the distribution
42
+ are not written by the author, so that they are not under these terms.
43
+
44
+ For the list of those files and their copying conditions, see the
45
+ file LEGAL.
46
+
47
+ 5. The scripts and library files supplied as input to or produced as
48
+ output from the software do not automatically fall under the
49
+ copyright of the software, but belong to whomever generated them,
50
+ and may be sold commercially, and may be aggregated with this
51
+ software.
52
+
53
+ 6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
54
+ IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
55
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
56
+ PURPOSE.
@@ -491,7 +491,7 @@ module Gem::Net::HTTPHeader
491
491
  alias canonical_each each_capitalized
492
492
 
493
493
  def capitalize(name)
494
- name.to_s.split(/-/).map {|s| s.capitalize }.join('-')
494
+ name.to_s.split('-'.freeze).map {|s| s.capitalize }.join('-'.freeze)
495
495
  end
496
496
  private :capitalize
497
497
 
@@ -124,6 +124,11 @@ end
124
124
  # - {Idempotent}[https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Idempotent_methods]: yes.
125
125
  # - {Cacheable}[https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Cacheable_methods]: no.
126
126
  #
127
+ # Related:
128
+ #
129
+ # - Gem::Net::HTTP.put: sends +PUT+ request, returns response object.
130
+ # - Gem::Net::HTTP#put: sends +PUT+ request, returns response object.
131
+ #
127
132
  class Gem::Net::HTTP::Put < Gem::Net::HTTPRequest
128
133
  METHOD = 'PUT'
129
134
  REQUEST_HAS_BODY = true
OSZAR »