rubygems-update 3.1.0.pre3 → 3.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (171) hide show
  1. checksums.yaml +4 -4
  2. data/.bundle/config +2 -0
  3. data/CONTRIBUTING.md +1 -1
  4. data/Gemfile +8 -0
  5. data/Gemfile.lock +43 -0
  6. data/History.txt +97 -2
  7. data/Manifest.txt +21 -3
  8. data/README.md +4 -4
  9. data/Rakefile +11 -10
  10. data/bin/update_rubygems +1 -1
  11. data/bundler/CHANGELOG.md +56 -3
  12. data/bundler/lib/bundler.rb +0 -1
  13. data/bundler/lib/bundler/build_metadata.rb +2 -0
  14. data/bundler/lib/bundler/cli.rb +1 -1
  15. data/bundler/lib/bundler/cli/config.rb +1 -1
  16. data/bundler/lib/bundler/cli/install.rb +3 -2
  17. data/bundler/lib/bundler/cli/update.rb +1 -1
  18. data/bundler/lib/bundler/feature_flag.rb +1 -1
  19. data/bundler/lib/bundler/fetcher.rb +2 -2
  20. data/bundler/lib/bundler/fetcher/downloader.rb +1 -1
  21. data/bundler/lib/bundler/fetcher/index.rb +1 -1
  22. data/bundler/lib/bundler/friendly_errors.rb +1 -1
  23. data/bundler/lib/bundler/gem_helper.rb +13 -12
  24. data/bundler/lib/bundler/inline.rb +36 -31
  25. data/bundler/lib/bundler/lazy_specification.rb +0 -1
  26. data/bundler/lib/bundler/mirror.rb +3 -3
  27. data/bundler/lib/bundler/plugin/api/source.rb +2 -4
  28. data/bundler/lib/bundler/remote_specification.rb +0 -2
  29. data/bundler/lib/bundler/rubygems_integration.rb +15 -13
  30. data/bundler/lib/bundler/settings.rb +7 -4
  31. data/bundler/lib/bundler/setup.rb +5 -0
  32. data/bundler/lib/bundler/source/git.rb +5 -5
  33. data/bundler/lib/bundler/source/git/git_proxy.rb +3 -2
  34. data/bundler/lib/bundler/source/rubygems.rb +3 -3
  35. data/bundler/lib/bundler/source/rubygems/remote.rb +1 -1
  36. data/bundler/lib/bundler/uri_credentials_filter.rb +7 -3
  37. data/bundler/lib/bundler/vendor/fileutils/lib/fileutils.rb +3 -3
  38. data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +26 -48
  39. data/bundler/lib/bundler/vendor/thor/lib/thor.rb +7 -0
  40. data/bundler/lib/bundler/vendor/thor/lib/thor/actions.rb +10 -6
  41. data/bundler/lib/bundler/vendor/thor/lib/thor/base.rb +29 -19
  42. data/bundler/lib/bundler/vendor/thor/lib/thor/nested_context.rb +29 -0
  43. data/bundler/lib/bundler/vendor/thor/lib/thor/parser/arguments.rb +1 -1
  44. data/bundler/lib/bundler/vendor/thor/lib/thor/parser/option.rb +13 -2
  45. data/bundler/lib/bundler/vendor/thor/lib/thor/runner.rb +8 -9
  46. data/bundler/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +10 -1
  47. data/bundler/lib/bundler/vendor/thor/lib/thor/shell/html.rb +2 -2
  48. data/bundler/lib/bundler/vendor/thor/lib/thor/util.rb +17 -1
  49. data/bundler/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
  50. data/bundler/lib/bundler/vendor/uri/lib/uri.rb +104 -0
  51. data/bundler/lib/bundler/vendor/uri/lib/uri/common.rb +744 -0
  52. data/bundler/lib/bundler/vendor/uri/lib/uri/file.rb +94 -0
  53. data/bundler/lib/bundler/vendor/uri/lib/uri/ftp.rb +267 -0
  54. data/bundler/lib/bundler/vendor/uri/lib/uri/generic.rb +1568 -0
  55. data/bundler/lib/bundler/vendor/uri/lib/uri/http.rb +88 -0
  56. data/bundler/lib/bundler/vendor/uri/lib/uri/https.rb +23 -0
  57. data/bundler/lib/bundler/vendor/uri/lib/uri/ldap.rb +261 -0
  58. data/bundler/lib/bundler/vendor/uri/lib/uri/ldaps.rb +21 -0
  59. data/bundler/lib/bundler/vendor/uri/lib/uri/mailto.rb +294 -0
  60. data/bundler/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb +546 -0
  61. data/bundler/lib/bundler/vendor/uri/lib/uri/rfc3986_parser.rb +125 -0
  62. data/bundler/lib/bundler/vendor/uri/lib/uri/version.rb +6 -0
  63. data/bundler/lib/bundler/vendored_uri.rb +4 -0
  64. data/bundler/lib/bundler/version.rb +1 -1
  65. data/bundler/man/bundle-add.1 +1 -1
  66. data/bundler/man/bundle-add.1.txt +1 -1
  67. data/bundler/man/bundle-binstubs.1 +1 -1
  68. data/bundler/man/bundle-binstubs.1.txt +1 -1
  69. data/bundler/man/bundle-cache.1 +1 -1
  70. data/bundler/man/bundle-cache.1.txt +1 -1
  71. data/bundler/man/bundle-check.1 +1 -1
  72. data/bundler/man/bundle-check.1.txt +1 -1
  73. data/bundler/man/bundle-clean.1 +1 -1
  74. data/bundler/man/bundle-clean.1.txt +1 -1
  75. data/bundler/man/bundle-config.1 +1 -1
  76. data/bundler/man/bundle-config.1.txt +1 -1
  77. data/bundler/man/bundle-doctor.1 +1 -1
  78. data/bundler/man/bundle-doctor.1.txt +1 -1
  79. data/bundler/man/bundle-exec.1 +1 -1
  80. data/bundler/man/bundle-exec.1.txt +1 -1
  81. data/bundler/man/bundle-gem.1 +1 -1
  82. data/bundler/man/bundle-gem.1.txt +1 -1
  83. data/bundler/man/bundle-info.1 +1 -1
  84. data/bundler/man/bundle-info.1.txt +1 -1
  85. data/bundler/man/bundle-init.1 +1 -1
  86. data/bundler/man/bundle-init.1.txt +1 -1
  87. data/bundler/man/bundle-inject.1 +1 -1
  88. data/bundler/man/bundle-inject.1.txt +1 -1
  89. data/bundler/man/bundle-install.1 +1 -1
  90. data/bundler/man/bundle-install.1.txt +1 -1
  91. data/bundler/man/bundle-list.1 +1 -1
  92. data/bundler/man/bundle-list.1.txt +1 -1
  93. data/bundler/man/bundle-lock.1 +1 -1
  94. data/bundler/man/bundle-lock.1.txt +1 -1
  95. data/bundler/man/bundle-open.1 +1 -1
  96. data/bundler/man/bundle-open.1.txt +1 -1
  97. data/bundler/man/bundle-outdated.1 +1 -1
  98. data/bundler/man/bundle-outdated.1.txt +1 -1
  99. data/bundler/man/bundle-platform.1 +1 -1
  100. data/bundler/man/bundle-platform.1.txt +1 -1
  101. data/bundler/man/bundle-pristine.1 +1 -1
  102. data/bundler/man/bundle-pristine.1.txt +1 -1
  103. data/bundler/man/bundle-remove.1 +1 -1
  104. data/bundler/man/bundle-remove.1.txt +1 -1
  105. data/bundler/man/bundle-show.1 +1 -1
  106. data/bundler/man/bundle-show.1.txt +1 -1
  107. data/bundler/man/bundle-update.1 +1 -1
  108. data/bundler/man/bundle-update.1.txt +1 -1
  109. data/bundler/man/bundle-viz.1 +1 -1
  110. data/bundler/man/bundle-viz.1.txt +1 -1
  111. data/bundler/man/bundle.1 +1 -1
  112. data/bundler/man/bundle.1.txt +1 -1
  113. data/bundler/man/gemfile.5 +1 -1
  114. data/bundler/man/gemfile.5.txt +1 -1
  115. data/lib/rubygems.rb +64 -47
  116. data/lib/rubygems/basic_specification.rb +1 -1
  117. data/lib/rubygems/command.rb +29 -7
  118. data/lib/rubygems/commands/generate_index_command.rb +3 -0
  119. data/lib/rubygems/commands/help_command.rb +1 -1
  120. data/lib/rubygems/commands/setup_command.rb +30 -15
  121. data/lib/rubygems/commands/sources_command.rb +17 -3
  122. data/lib/rubygems/commands/uninstall_command.rb +1 -1
  123. data/lib/rubygems/core_ext/kernel_require.rb +1 -1
  124. data/lib/rubygems/core_ext/kernel_warn.rb +8 -4
  125. data/lib/rubygems/ext/builder.rb +4 -2
  126. data/lib/rubygems/remote_fetcher.rb +20 -31
  127. data/lib/rubygems/request.rb +2 -0
  128. data/lib/rubygems/request_set/gem_dependency_api.rb +1 -1
  129. data/lib/rubygems/resolver/api_set.rb +1 -1
  130. data/lib/rubygems/resolver/api_specification.rb +1 -1
  131. data/lib/rubygems/server.rb +1 -1
  132. data/lib/rubygems/source.rb +7 -1
  133. data/lib/rubygems/source_list.rb +2 -0
  134. data/lib/rubygems/specification.rb +12 -8
  135. data/lib/rubygems/specification_policy.rb +53 -30
  136. data/lib/rubygems/test_case.rb +60 -0
  137. data/lib/rubygems/uri_formatter.rb +0 -1
  138. data/lib/rubygems/uri_parser.rb +36 -0
  139. data/lib/rubygems/uri_parsing.rb +23 -0
  140. data/lib/rubygems/util.rb +7 -1
  141. data/lib/rubygems/version.rb +1 -1
  142. data/rubygems-update.gemspec +1 -8
  143. data/test/rubygems/specifications/rubyforge-0.0.1.gemspec +14 -0
  144. data/test/rubygems/test_gem.rb +90 -46
  145. data/test/rubygems/test_gem_command.rb +38 -9
  146. data/test/rubygems/test_gem_commands_build_command.rb +18 -1
  147. data/test/rubygems/test_gem_commands_generate_index_command.rb +37 -1
  148. data/test/rubygems/test_gem_commands_help_command.rb +1 -6
  149. data/test/rubygems/test_gem_commands_server_command.rb +6 -2
  150. data/test/rubygems/test_gem_commands_setup_command.rb +56 -10
  151. data/test/rubygems/test_gem_commands_sources_command.rb +113 -1
  152. data/test/rubygems/test_gem_commands_uninstall_command.rb +1 -0
  153. data/test/rubygems/test_gem_gem_runner.rb +3 -1
  154. data/test/rubygems/test_gem_indexer.rb +1 -1
  155. data/test/rubygems/test_gem_installer.rb +10 -23
  156. data/test/rubygems/test_gem_package.rb +3 -8
  157. data/test/rubygems/test_gem_package_tar_writer.rb +5 -0
  158. data/test/rubygems/test_gem_request_set.rb +52 -0
  159. data/test/rubygems/test_gem_source.rb +14 -0
  160. data/test/rubygems/test_gem_specification.rb +74 -54
  161. data/test/rubygems/test_gem_stub_specification.rb +0 -1
  162. data/test/rubygems/test_project_sanity.rb +0 -43
  163. data/test/rubygems/test_remote_fetch_error.rb +1 -1
  164. data/test/rubygems/test_require.rb +41 -42
  165. data/util/bisect +0 -21
  166. data/util/ci.sh +1 -1
  167. data/util/update_changelog.rb +7 -10
  168. metadata +27 -93
  169. data/bundler/lib/bundler/gem_remote_fetcher.rb +0 -43
  170. data/bundler/lib/bundler/vendor/fileutils/lib/fileutils/version.rb +0 -5
  171. data/bundler/lib/bundler/vendor/thor/lib/thor/core_ext/io_binary_read.rb +0 -12
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "BUNDLE\-PRISTINE" "1" "November 2019" "" ""
4
+ .TH "BUNDLE\-PRISTINE" "1" "January 2020" "" ""
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBbundle\-pristine\fR \- Restores installed gems to their pristine condition
@@ -41,4 +41,4 @@ DESCRIPTION
41
41
 
42
42
 
43
43
 
44
- November 2019 BUNDLE-PRISTINE(1)
44
+ January 2020 BUNDLE-PRISTINE(1)
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "BUNDLE\-REMOVE" "1" "November 2019" "" ""
4
+ .TH "BUNDLE\-REMOVE" "1" "January 2020" "" ""
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBbundle\-remove\fR \- Removes gems from the Gemfile
@@ -31,4 +31,4 @@ OPTIONS
31
31
 
32
32
 
33
33
 
34
- November 2019 BUNDLE-REMOVE(1)
34
+ January 2020 BUNDLE-REMOVE(1)
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "BUNDLE\-SHOW" "1" "November 2019" "" ""
4
+ .TH "BUNDLE\-SHOW" "1" "January 2020" "" ""
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBbundle\-show\fR \- Shows all the gems in your bundle, or the path to a gem
@@ -24,4 +24,4 @@ OPTIONS
24
24
 
25
25
 
26
26
 
27
- November 2019 BUNDLE-SHOW(1)
27
+ January 2020 BUNDLE-SHOW(1)
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "BUNDLE\-UPDATE" "1" "November 2019" "" ""
4
+ .TH "BUNDLE\-UPDATE" "1" "January 2020" "" ""
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBbundle\-update\fR \- Update your gems to the latest available versions
@@ -387,4 +387,4 @@ RECOMMENDED WORKFLOW
387
387
 
388
388
 
389
389
 
390
- November 2019 BUNDLE-UPDATE(1)
390
+ January 2020 BUNDLE-UPDATE(1)
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "BUNDLE\-VIZ" "1" "November 2019" "" ""
4
+ .TH "BUNDLE\-VIZ" "1" "January 2020" "" ""
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBbundle\-viz\fR \- Generates a visual dependency graph for your Gemfile
@@ -36,4 +36,4 @@ OPTIONS
36
36
 
37
37
 
38
38
 
39
- November 2019 BUNDLE-VIZ(1)
39
+ January 2020 BUNDLE-VIZ(1)
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "BUNDLE" "1" "November 2019" "" ""
4
+ .TH "BUNDLE" "1" "January 2020" "" ""
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBbundle\fR \- Ruby Dependency Management
@@ -113,4 +113,4 @@ OBSOLETE
113
113
 
114
114
 
115
115
 
116
- November 2019 BUNDLE(1)
116
+ January 2020 BUNDLE(1)
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "GEMFILE" "5" "November 2019" "" ""
4
+ .TH "GEMFILE" "5" "January 2020" "" ""
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBGemfile\fR \- A format for describing gem dependencies for Ruby programs
@@ -646,4 +646,4 @@ SOURCE PRIORITY
646
646
 
647
647
 
648
648
 
649
- November 2019 GEMFILE(5)
649
+ January 2020 GEMFILE(5)
@@ -9,7 +9,7 @@
9
9
  require 'rbconfig'
10
10
 
11
11
  module Gem
12
- VERSION = "3.1.0.pre3".freeze
12
+ VERSION = "3.1.4".freeze
13
13
  end
14
14
 
15
15
  # Must be first since it unloads the prelude from 1.9.2
@@ -26,19 +26,19 @@ require 'rubygems/errors'
26
26
  # For user documentation, see:
27
27
  #
28
28
  # * <tt>gem help</tt> and <tt>gem help [command]</tt>
29
- # * {RubyGems User Guide}[http://guides.rubygems.org/]
30
- # * {Frequently Asked Questions}[http://guides.rubygems.org/faqs]
29
+ # * {RubyGems User Guide}[https://guides.rubygems.org/]
30
+ # * {Frequently Asked Questions}[https://guides.rubygems.org/faqs]
31
31
  #
32
32
  # For gem developer documentation see:
33
33
  #
34
- # * {Creating Gems}[http://guides.rubygems.org/make-your-own-gem]
34
+ # * {Creating Gems}[https://guides.rubygems.org/make-your-own-gem]
35
35
  # * Gem::Specification
36
36
  # * Gem::Version for version dependency notes
37
37
  #
38
38
  # Further RubyGems documentation can be found at:
39
39
  #
40
- # * {RubyGems Guides}[http://guides.rubygems.org]
41
- # * {RubyGems API}[http://www.rubydoc.info/github/rubygems/rubygems] (also available from
40
+ # * {RubyGems Guides}[https://guides.rubygems.org]
41
+ # * {RubyGems API}[https://www.rubydoc.info/github/rubygems/rubygems] (also available from
42
42
  # <tt>gem server</tt>)
43
43
  #
44
44
  # == RubyGems Plugins
@@ -160,24 +160,14 @@ module Gem
160
160
  ].freeze
161
161
 
162
162
  ##
163
- # Exception classes used in a Gem.read_binary +rescue+ statement. Not all of
164
- # these are defined in Ruby 1.8.7, hence the need for this convoluted setup.
163
+ # Exception classes used in a Gem.read_binary +rescue+ statement
165
164
 
166
- READ_BINARY_ERRORS = begin
167
- read_binary_errors = [Errno::EACCES, Errno::EROFS, Errno::ENOSYS]
168
- read_binary_errors << Errno::ENOTSUP if Errno.const_defined?(:ENOTSUP)
169
- read_binary_errors
170
- end.freeze
165
+ READ_BINARY_ERRORS = [Errno::EACCES, Errno::EROFS, Errno::ENOSYS, Errno::ENOTSUP].freeze
171
166
 
172
167
  ##
173
- # Exception classes used in Gem.write_binary +rescue+ statement. Not all of
174
- # these are defined in Ruby 1.8.7.
168
+ # Exception classes used in Gem.write_binary +rescue+ statement
175
169
 
176
- WRITE_BINARY_ERRORS = begin
177
- write_binary_errors = [Errno::ENOSYS]
178
- write_binary_errors << Errno::ENOTSUP if Errno.const_defined?(:ENOTSUP)
179
- write_binary_errors
180
- end.freeze
170
+ WRITE_BINARY_ERRORS = [Errno::ENOSYS, Errno::ENOTSUP].freeze
181
171
 
182
172
  @@win_platform = nil
183
173
 
@@ -199,6 +189,8 @@ module Gem
199
189
  @pre_reset_hooks ||= []
200
190
  @post_reset_hooks ||= []
201
191
 
192
+ @default_source_date_epoch = nil
193
+
202
194
  ##
203
195
  # Try to activate a gem containing +path+. Returns true if
204
196
  # activation succeeded or wasn't needed because it was already
@@ -1246,20 +1238,43 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
1246
1238
  end
1247
1239
 
1248
1240
  ##
1249
- # The SOURCE_DATE_EPOCH environment variable (or, if that's not set, the current time), converted to Time object.
1250
- # This is used throughout RubyGems for enabling reproducible builds.
1241
+ # If the SOURCE_DATE_EPOCH environment variable is set, returns it's value.
1242
+ # Otherwise, returns the time that `Gem.source_date_epoch_string` was
1243
+ # first called in the same format as SOURCE_DATE_EPOCH.
1251
1244
  #
1252
- # If it is not set as an environment variable already, this also sets it.
1245
+ # NOTE(@duckinator): The implementation is a tad weird because we want to:
1246
+ # 1. Make builds reproducible by default, by having this function always
1247
+ # return the same result during a given run.
1248
+ # 2. Allow changing ENV['SOURCE_DATE_EPOCH'] at runtime, since multiple
1249
+ # tests that set this variable will be run in a single process.
1250
+ #
1251
+ # If you simplify this function and a lot of tests fail, that is likely
1252
+ # due to #2 above.
1253
1253
  #
1254
1254
  # Details on SOURCE_DATE_EPOCH:
1255
1255
  # https://reproducible-builds.org/specs/source-date-epoch/
1256
1256
 
1257
- def self.source_date_epoch
1258
- if ENV["SOURCE_DATE_EPOCH"].nil? || ENV["SOURCE_DATE_EPOCH"].empty?
1259
- ENV["SOURCE_DATE_EPOCH"] = Time.now.to_i.to_s
1260
- end
1257
+ def self.source_date_epoch_string
1258
+ # The value used if $SOURCE_DATE_EPOCH is not set.
1259
+ @default_source_date_epoch ||= Time.now.to_i.to_s
1260
+
1261
+ specified_epoch = ENV["SOURCE_DATE_EPOCH"]
1262
+
1263
+ # If it's empty or just whitespace, treat it like it wasn't set at all.
1264
+ specified_epoch = nil if !specified_epoch.nil? && specified_epoch.strip.empty?
1265
+
1266
+ epoch = specified_epoch || @default_source_date_epoch
1261
1267
 
1262
- Time.at(ENV["SOURCE_DATE_EPOCH"].to_i).utc.freeze
1268
+ epoch.strip
1269
+ end
1270
+
1271
+ ##
1272
+ # Returns the value of Gem.source_date_epoch_string, as a Time object.
1273
+ #
1274
+ # This is used throughout RubyGems for enabling reproducible builds.
1275
+
1276
+ def self.source_date_epoch
1277
+ Time.at(self.source_date_epoch_string.to_i).utc.freeze
1263
1278
  end
1264
1279
 
1265
1280
  # FIX: Almost everywhere else we use the `def self.` way of defining class
@@ -1291,10 +1306,11 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
1291
1306
  #
1292
1307
 
1293
1308
  def register_default_spec(spec)
1294
- new_format = spec.require_paths.any? {|path| spec.files.any? {|f| f.start_with? path } }
1309
+ extended_require_paths = spec.require_paths.map {|f| f + "/"}
1310
+ new_format = extended_require_paths.any? {|path| spec.files.any? {|f| f.start_with? path } }
1295
1311
 
1296
1312
  if new_format
1297
- prefix_group = spec.require_paths.map {|f| f + "/"}.join("|")
1313
+ prefix_group = extended_require_paths.join("|")
1298
1314
  prefix_pattern = /^(#{prefix_group})/
1299
1315
  end
1300
1316
 
@@ -1376,23 +1392,24 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
1376
1392
 
1377
1393
  MARSHAL_SPEC_DIR = "quick/Marshal.#{Gem.marshal_version}/".freeze
1378
1394
 
1379
- autoload :BundlerVersionFinder, 'rubygems/bundler_version_finder'
1380
- autoload :ConfigFile, 'rubygems/config_file'
1381
- autoload :Dependency, 'rubygems/dependency'
1382
- autoload :DependencyList, 'rubygems/dependency_list'
1383
- autoload :Installer, 'rubygems/installer'
1384
- autoload :Licenses, 'rubygems/util/licenses'
1385
- autoload :PathSupport, 'rubygems/path_support'
1386
- autoload :Platform, 'rubygems/platform'
1387
- autoload :RequestSet, 'rubygems/request_set'
1388
- autoload :Requirement, 'rubygems/requirement'
1389
- autoload :Resolver, 'rubygems/resolver'
1390
- autoload :Source, 'rubygems/source'
1391
- autoload :SourceList, 'rubygems/source_list'
1392
- autoload :SpecFetcher, 'rubygems/spec_fetcher'
1393
- autoload :Specification, 'rubygems/specification'
1394
- autoload :Util, 'rubygems/util'
1395
- autoload :Version, 'rubygems/version'
1395
+ autoload :BundlerVersionFinder, File.expand_path('rubygems/bundler_version_finder', __dir__)
1396
+ autoload :ConfigFile, File.expand_path('rubygems/config_file', __dir__)
1397
+ autoload :Dependency, File.expand_path('rubygems/dependency', __dir__)
1398
+ autoload :DependencyList, File.expand_path('rubygems/dependency_list', __dir__)
1399
+ autoload :Installer, File.expand_path('rubygems/installer', __dir__)
1400
+ autoload :Licenses, File.expand_path('rubygems/util/licenses', __dir__)
1401
+ autoload :NameTuple, File.expand_path('rubygems/name_tuple', __dir__)
1402
+ autoload :PathSupport, File.expand_path('rubygems/path_support', __dir__)
1403
+ autoload :Platform, File.expand_path('rubygems/platform', __dir__)
1404
+ autoload :RequestSet, File.expand_path('rubygems/request_set', __dir__)
1405
+ autoload :Requirement, File.expand_path('rubygems/requirement', __dir__)
1406
+ autoload :Resolver, File.expand_path('rubygems/resolver', __dir__)
1407
+ autoload :Source, File.expand_path('rubygems/source', __dir__)
1408
+ autoload :SourceList, File.expand_path('rubygems/source_list', __dir__)
1409
+ autoload :SpecFetcher, File.expand_path('rubygems/spec_fetcher', __dir__)
1410
+ autoload :Specification, File.expand_path('rubygems/specification', __dir__)
1411
+ autoload :Util, File.expand_path('rubygems/util', __dir__)
1412
+ autoload :Version, File.expand_path('rubygems/version', __dir__)
1396
1413
 
1397
1414
  require "rubygems/specification"
1398
1415
  end
@@ -78,7 +78,7 @@ class Gem::BasicSpecification
78
78
  elsif missing_extensions?
79
79
  @ignored = true
80
80
 
81
- if RUBY_ENGINE == platform || Gem::Platform.local === platform
81
+ if Gem::Platform::RUBY == platform || Gem::Platform.local === platform
82
82
  warn "Ignoring #{full_name} because its extensions are not built. " +
83
83
  "Try: gem pristine #{name} --version #{version}"
84
84
  end
@@ -369,22 +369,44 @@ class Gem::Command
369
369
  end
370
370
  end
371
371
 
372
- def deprecate_option(short_name: nil, long_name: nil, version: nil)
373
- @deprecated_options[command].merge!({ short_name => { "rg_version_to_expire" => version } }) if short_name
374
- @deprecated_options[command].merge!({ long_name => { "rg_version_to_expire" => version } }) if long_name
372
+ ##
373
+ # Mark a command-line option as deprecated, and optionally specify a
374
+ # deprecation horizon.
375
+ #
376
+ # Note that with the current implementation, every version of the option needs
377
+ # to be explicitly deprecated, so to deprecate an option defined as
378
+ #
379
+ # add_option('-t', '--[no-]test', 'Set test mode') do |value, options|
380
+ # # ... stuff ...
381
+ # end
382
+ #
383
+ # you would need to explicitly add a call to `deprecate_option` for every
384
+ # version of the option you want to deprecate, like
385
+ #
386
+ # deprecate_option('-t')
387
+ # deprecate_option('--test')
388
+ # deprecate_option('--no-test')
389
+
390
+ def deprecate_option(name, version: nil, extra_msg: nil)
391
+ @deprecated_options[command].merge!({ name => { "rg_version_to_expire" => version, "extra_msg" => extra_msg } })
375
392
  end
376
393
 
377
394
  def check_deprecated_options(options)
378
395
  options.each do |option|
379
396
  if option_is_deprecated?(option)
380
- version_to_expire = @deprecated_options[command][option]["rg_version_to_expire"]
397
+ deprecation = @deprecated_options[command][option]
398
+ version_to_expire = deprecation["rg_version_to_expire"]
381
399
 
382
400
  deprecate_option_msg = if version_to_expire
383
- "The \"#{option}\" option has been deprecated and will be removed in Rubygems #{version_to_expire}, its use is discouraged."
401
+ "The \"#{option}\" option has been deprecated and will be removed in Rubygems #{version_to_expire}."
384
402
  else
385
- "The \"#{option}\" option has been deprecated and will be removed in future versions of Rubygems, its use is discouraged."
403
+ "The \"#{option}\" option has been deprecated and will be removed in future versions of Rubygems."
386
404
  end
387
405
 
406
+ extra_msg = deprecation["extra_msg"]
407
+
408
+ deprecate_option_msg += " #{extra_msg}" if extra_msg
409
+
388
410
  alert_warning(deprecate_option_msg)
389
411
  end
390
412
  end
@@ -624,7 +646,7 @@ basic help message containing pointers to more information.
624
646
  http://localhost:8808/
625
647
  with info about installed gems
626
648
  Further information:
627
- http://guides.rubygems.org
649
+ https://guides.rubygems.org
628
650
  HELP
629
651
 
630
652
  # :startdoc:
@@ -25,6 +25,9 @@ class Gem::Commands::GenerateIndexCommand < Gem::Command
25
25
  options[:build_modern] = value
26
26
  end
27
27
 
28
+ deprecate_option('--modern', version: '4.0', extra_msg: 'Modern indexes (specs, latest_specs, and prerelease_specs) are always generated, so this option is not needed.')
29
+ deprecate_option('--no-modern', version: '4.0', extra_msg: 'The `--no-modern` option is currently ignored. Modern indexes (specs, latest_specs, and prerelease_specs) are always generated.')
30
+
28
31
  add_option '--update',
29
32
  'Update modern indexes with gems added',
30
33
  'since the last update' do |value, options|
@@ -38,7 +38,7 @@ Some examples of 'gem' usage.
38
38
 
39
39
  * Create a gem:
40
40
 
41
- See http://guides.rubygems.org/make-your-own-gem/
41
+ See https://guides.rubygems.org/make-your-own-gem/
42
42
 
43
43
  * See information about RubyGems:
44
44
 
@@ -17,6 +17,7 @@ class Gem::Commands::SetupCommand < Gem::Command
17
17
 
18
18
  super 'setup', 'Install RubyGems',
19
19
  :format_executable => true, :document => %w[ri],
20
+ :force => true,
20
21
  :site_or_vendor => 'sitelibdir',
21
22
  :destdir => '', :prefix => '', :previous_version => '',
22
23
  :regenerate_binstubs => true
@@ -88,6 +89,11 @@ class Gem::Commands::SetupCommand < Gem::Command
88
89
  options[:regenerate_binstubs] = value
89
90
  end
90
91
 
92
+ add_option '-f', '--[no-]force',
93
+ 'Forcefully overwrite binstubs' do |value, options|
94
+ options[:force] = value
95
+ end
96
+
91
97
  add_option('-E', '--[no-]env-shebang',
92
98
  'Rewrite executables with a shebang',
93
99
  'of /usr/bin/env') do |value, options|
@@ -98,7 +104,7 @@ class Gem::Commands::SetupCommand < Gem::Command
98
104
  end
99
105
 
100
106
  def check_ruby_version
101
- required_version = Gem::Requirement.new '>= 1.8.7'
107
+ required_version = Gem::Requirement.new '>= 2.3.0'
102
108
 
103
109
  unless required_version.satisfied_by? Gem.ruby_version
104
110
  alert_error "Expected Ruby version #{required_version}, is #{Gem.ruby_version}"
@@ -199,10 +205,10 @@ By default, this RubyGems will install gem as:
199
205
  say
200
206
 
201
207
  say "RubyGems installed the following executables:"
202
- say @bin_file_names.map { |name| "\t#{name}\n" }
208
+ say bin_file_names.map { |name| "\t#{name}\n" }
203
209
  say
204
210
 
205
- unless @bin_file_names.grep(/#{File::SEPARATOR}gem$/)
211
+ unless bin_file_names.grep(/#{File::SEPARATOR}gem$/)
206
212
  say "If `gem` was installed by a previous RubyGems installation, you may need"
207
213
  say "to remove it by hand."
208
214
  say
@@ -235,8 +241,6 @@ By default, this RubyGems will install gem as:
235
241
  end
236
242
 
237
243
  def install_executables(bin_dir)
238
- @bin_file_names = []
239
-
240
244
  prog_mode = options[:prog_mode] || 0755
241
245
 
242
246
  executables = { 'gem' => 'bin' }
@@ -249,13 +253,7 @@ By default, this RubyGems will install gem as:
249
253
  bin_files -= %w[update_rubygems]
250
254
 
251
255
  bin_files.each do |bin_file|
252
- bin_file_formatted = if options[:format_executable]
253
- Gem.default_exec_format % bin_file
254
- else
255
- bin_file
256
- end
257
-
258
- dest_file = File.join bin_dir, bin_file_formatted
256
+ dest_file = target_bin_path(bin_dir, bin_file)
259
257
  bin_tmp_file = File.join Dir.tmpdir, "#{bin_file}.#{$$}"
260
258
 
261
259
  begin
@@ -267,7 +265,7 @@ By default, this RubyGems will install gem as:
267
265
  end
268
266
 
269
267
  install bin_tmp_file, dest_file, :mode => prog_mode
270
- @bin_file_names << dest_file
268
+ bin_file_names << dest_file
271
269
  ensure
272
270
  rm bin_tmp_file
273
271
  end
@@ -429,13 +427,15 @@ By default, this RubyGems will install gem as:
429
427
  Dir.chdir("bundler") do
430
428
  built_gem = Gem::Package.build(bundler_spec)
431
429
  begin
432
- installer = Gem::Installer.at(built_gem, env_shebang: options[:env_shebang], format_executable: options[:format_executable], install_as_default: true, bin_dir: bin_dir, wrappers: true)
430
+ installer = Gem::Installer.at(built_gem, env_shebang: options[:env_shebang], format_executable: options[:format_executable], force: options[:force], install_as_default: true, bin_dir: bin_dir, wrappers: true)
433
431
  installer.install
434
432
  ensure
435
433
  FileUtils.rm_f built_gem
436
434
  end
437
435
  end
438
436
 
437
+ bundler_spec.executables.each {|executable| bin_file_names << target_bin_path(bin_dir, executable) }
438
+
439
439
  say "Bundler #{bundler_spec.version} installed"
440
440
  end
441
441
 
@@ -592,7 +592,7 @@ abort "#{deprecation_message}"
592
592
  history_string = ""
593
593
 
594
594
  until versions.length == 0 or
595
- versions.shift < options[:previous_version] do
595
+ versions.shift <= options[:previous_version] do
596
596
  history_string += version_lines.shift + text.shift
597
597
  end
598
598
 
@@ -626,4 +626,19 @@ abort "#{deprecation_message}"
626
626
  command.invoke(*args)
627
627
  end
628
628
 
629
+ private
630
+
631
+ def target_bin_path(bin_dir, bin_file)
632
+ bin_file_formatted = if options[:format_executable]
633
+ Gem.default_exec_format % bin_file
634
+ else
635
+ bin_file
636
+ end
637
+ File.join bin_dir, bin_file_formatted
638
+ end
639
+
640
+ def bin_file_names
641
+ @bin_file_names ||= []
642
+ end
643
+
629
644
  end