rubygems-update 3.7.2 → 4.0.0.beta2

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 (211) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +1431 -1323
  3. data/CODE_OF_CONDUCT.md +7 -129
  4. data/Manifest.txt +5 -11
  5. data/README.md +2 -2
  6. data/bundler/CHANGELOG.md +1011 -917
  7. data/bundler/README.md +4 -4
  8. data/bundler/bundler.gemspec +3 -3
  9. data/bundler/lib/bundler/build_metadata.rb +2 -2
  10. data/bundler/lib/bundler/capistrano.rb +1 -19
  11. data/bundler/lib/bundler/cli/cache.rb +1 -11
  12. data/bundler/lib/bundler/cli/common.rb +20 -3
  13. data/bundler/lib/bundler/cli/config.rb +1 -2
  14. data/bundler/lib/bundler/cli/console.rb +5 -0
  15. data/bundler/lib/bundler/cli/exec.rb +29 -4
  16. data/bundler/lib/bundler/cli/gem.rb +19 -33
  17. data/bundler/lib/bundler/cli/install.rb +9 -82
  18. data/bundler/lib/bundler/cli/issue.rb +2 -2
  19. data/bundler/lib/bundler/cli/list.rb +33 -2
  20. data/bundler/lib/bundler/cli/plugin.rb +5 -1
  21. data/bundler/lib/bundler/cli/show.rb +1 -1
  22. data/bundler/lib/bundler/cli/update.rb +3 -3
  23. data/bundler/lib/bundler/cli.rb +91 -85
  24. data/bundler/lib/bundler/compact_index_client.rb +0 -1
  25. data/bundler/lib/bundler/current_ruby.rb +3 -15
  26. data/bundler/lib/bundler/definition.rb +65 -36
  27. data/bundler/lib/bundler/deployment.rb +1 -64
  28. data/bundler/lib/bundler/digest.rb +1 -1
  29. data/bundler/lib/bundler/dsl.rb +26 -36
  30. data/bundler/lib/bundler/endpoint_specification.rb +0 -22
  31. data/bundler/lib/bundler/environment_preserver.rb +1 -0
  32. data/bundler/lib/bundler/errors.rb +1 -5
  33. data/bundler/lib/bundler/feature_flag.rb +0 -33
  34. data/bundler/lib/bundler/fetcher/compact_index.rb +1 -1
  35. data/bundler/lib/bundler/friendly_errors.rb +2 -2
  36. data/bundler/lib/bundler/index.rb +0 -7
  37. data/bundler/lib/bundler/inline.rb +9 -1
  38. data/bundler/lib/bundler/installer/gem_installer.rb +0 -11
  39. data/bundler/lib/bundler/installer.rb +0 -6
  40. data/bundler/lib/bundler/lockfile_generator.rb +1 -1
  41. data/bundler/lib/bundler/lockfile_parser.rb +2 -12
  42. data/bundler/lib/bundler/man/bundle-add.1 +1 -1
  43. data/bundler/lib/bundler/man/bundle-binstubs.1 +3 -6
  44. data/bundler/lib/bundler/man/bundle-binstubs.1.ronn +4 -6
  45. data/bundler/lib/bundler/man/bundle-cache.1 +2 -14
  46. data/bundler/lib/bundler/man/bundle-cache.1.ronn +1 -14
  47. data/bundler/lib/bundler/man/bundle-check.1 +2 -5
  48. data/bundler/lib/bundler/man/bundle-check.1.ronn +0 -5
  49. data/bundler/lib/bundler/man/bundle-clean.1 +1 -1
  50. data/bundler/lib/bundler/man/bundle-config.1 +9 -33
  51. data/bundler/lib/bundler/man/bundle-config.1.ronn +24 -55
  52. data/bundler/lib/bundler/man/bundle-console.1 +1 -1
  53. data/bundler/lib/bundler/man/bundle-doctor.1 +1 -1
  54. data/bundler/lib/bundler/man/bundle-env.1 +1 -1
  55. data/bundler/lib/bundler/man/bundle-exec.1 +2 -5
  56. data/bundler/lib/bundler/man/bundle-exec.1.ronn +1 -5
  57. data/bundler/lib/bundler/man/bundle-fund.1 +1 -1
  58. data/bundler/lib/bundler/man/bundle-gem.1 +3 -6
  59. data/bundler/lib/bundler/man/bundle-gem.1.ronn +2 -5
  60. data/bundler/lib/bundler/man/bundle-help.1 +1 -1
  61. data/bundler/lib/bundler/man/bundle-info.1 +1 -1
  62. data/bundler/lib/bundler/man/bundle-init.1 +1 -1
  63. data/bundler/lib/bundler/man/bundle-install.1 +14 -57
  64. data/bundler/lib/bundler/man/bundle-install.1.ronn +25 -105
  65. data/bundler/lib/bundler/man/bundle-issue.1 +1 -1
  66. data/bundler/lib/bundler/man/bundle-licenses.1 +1 -1
  67. data/bundler/lib/bundler/man/bundle-list.1 +6 -1
  68. data/bundler/lib/bundler/man/bundle-list.1.ronn +5 -0
  69. data/bundler/lib/bundler/man/bundle-lock.1 +1 -1
  70. data/bundler/lib/bundler/man/bundle-open.1 +1 -1
  71. data/bundler/lib/bundler/man/bundle-outdated.1 +1 -1
  72. data/bundler/lib/bundler/man/bundle-platform.1 +1 -1
  73. data/bundler/lib/bundler/man/bundle-plugin.1 +2 -9
  74. data/bundler/lib/bundler/man/bundle-plugin.1.ronn +0 -8
  75. data/bundler/lib/bundler/man/bundle-pristine.1 +1 -1
  76. data/bundler/lib/bundler/man/bundle-remove.1 +2 -8
  77. data/bundler/lib/bundler/man/bundle-remove.1.ronn +1 -8
  78. data/bundler/lib/bundler/man/bundle-show.1 +2 -5
  79. data/bundler/lib/bundler/man/bundle-show.1.ronn +0 -4
  80. data/bundler/lib/bundler/man/bundle-update.1 +1 -1
  81. data/bundler/lib/bundler/man/bundle-version.1 +1 -1
  82. data/bundler/lib/bundler/man/bundle.1 +1 -10
  83. data/bundler/lib/bundler/man/bundle.1.ronn +0 -9
  84. data/bundler/lib/bundler/man/gemfile.5 +32 -1
  85. data/bundler/lib/bundler/man/gemfile.5.ronn +28 -0
  86. data/bundler/lib/bundler/man/index.txt +0 -2
  87. data/bundler/lib/bundler/materialization.rb +1 -1
  88. data/bundler/lib/bundler/plugin/installer.rb +0 -10
  89. data/bundler/lib/bundler/plugin/source_list.rb +1 -1
  90. data/bundler/lib/bundler/plugin.rb +1 -1
  91. data/bundler/lib/bundler/resolver.rb +1 -1
  92. data/bundler/lib/bundler/ruby_dsl.rb +2 -0
  93. data/bundler/lib/bundler/ruby_version.rb +1 -3
  94. data/bundler/lib/bundler/rubygems_ext.rb +1 -1
  95. data/bundler/lib/bundler/rubygems_gem_installer.rb +1 -1
  96. data/bundler/lib/bundler/rubygems_integration.rb +1 -5
  97. data/bundler/lib/bundler/runtime.rb +5 -1
  98. data/bundler/lib/bundler/self_manager.rb +1 -1
  99. data/bundler/lib/bundler/settings.rb +8 -26
  100. data/bundler/lib/bundler/shared_helpers.rb +12 -20
  101. data/bundler/lib/bundler/source/git/git_proxy.rb +3 -11
  102. data/bundler/lib/bundler/source/git.rb +2 -3
  103. data/bundler/lib/bundler/source/path.rb +3 -7
  104. data/bundler/lib/bundler/source/rubygems.rb +11 -17
  105. data/bundler/lib/bundler/source.rb +1 -1
  106. data/bundler/lib/bundler/source_list.rb +4 -45
  107. data/bundler/lib/bundler/source_map.rb +2 -5
  108. data/bundler/lib/bundler/spec_set.rb +6 -15
  109. data/bundler/lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt +7 -129
  110. data/bundler/lib/bundler/templates/newgem/Rakefile.tt +5 -0
  111. data/bundler/lib/bundler/templates/newgem/circleci/config.yml.tt +12 -0
  112. data/bundler/lib/bundler/templates/newgem/ext/newgem/Cargo.toml.tt +1 -1
  113. data/bundler/lib/bundler/templates/newgem/ext/newgem/extconf-go.rb.tt +11 -0
  114. data/bundler/lib/bundler/templates/newgem/ext/newgem/go.mod.tt +5 -0
  115. data/bundler/lib/bundler/templates/newgem/ext/newgem/newgem-go.c.tt +2 -0
  116. data/bundler/lib/bundler/templates/newgem/ext/newgem/newgem.go.tt +31 -0
  117. data/bundler/lib/bundler/templates/newgem/github/workflows/main.yml.tt +6 -0
  118. data/bundler/lib/bundler/templates/newgem/gitlab-ci.yml.tt +9 -0
  119. data/bundler/lib/bundler/templates/newgem/newgem.gemspec.tt +4 -1
  120. data/bundler/lib/bundler/ui/shell.rb +10 -6
  121. data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool/timed_stack.rb +26 -23
  122. data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool/version.rb +1 -1
  123. data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool.rb +50 -6
  124. data/bundler/lib/bundler/vendor/fileutils/lib/fileutils.rb +57 -52
  125. data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +5 -2
  126. data/bundler/lib/bundler/vendor/thor/lib/thor/runner.rb +1 -1
  127. data/bundler/lib/bundler/vendor/uri/lib/uri/common.rb +57 -15
  128. data/bundler/lib/bundler/vendor/uri/lib/uri/file.rb +1 -1
  129. data/bundler/lib/bundler/vendor/uri/lib/uri/generic.rb +34 -21
  130. data/bundler/lib/bundler/vendor/uri/lib/uri/http.rb +12 -0
  131. data/bundler/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb +9 -8
  132. data/bundler/lib/bundler/vendor/uri/lib/uri/version.rb +2 -2
  133. data/bundler/lib/bundler/version.rb +1 -1
  134. data/bundler/lib/bundler/vlad.rb +1 -14
  135. data/bundler/lib/bundler.rb +6 -28
  136. data/doc/MAINTAINERS.txt +0 -7
  137. data/doc/bundler/UPGRADING.md +11 -5
  138. data/doc/rubygems/CONTRIBUTING.md +1 -1
  139. data/lib/rubygems/basic_specification.rb +3 -9
  140. data/lib/rubygems/bundler_version_finder.rb +38 -3
  141. data/lib/rubygems/command.rb +1 -1
  142. data/lib/rubygems/command_manager.rb +3 -4
  143. data/lib/rubygems/commands/build_command.rb +0 -7
  144. data/lib/rubygems/commands/cert_command.rb +1 -1
  145. data/lib/rubygems/commands/install_command.rb +1 -5
  146. data/lib/rubygems/commands/setup_command.rb +5 -3
  147. data/lib/rubygems/config_file.rb +1 -1
  148. data/lib/rubygems/dependency.rb +1 -1
  149. data/lib/rubygems/dependency_installer.rb +0 -77
  150. data/lib/rubygems/dependency_list.rb +1 -2
  151. data/lib/rubygems/deprecate.rb +74 -72
  152. data/lib/rubygems/doctor.rb +1 -1
  153. data/lib/rubygems/errors.rb +1 -1
  154. data/lib/rubygems/exceptions.rb +2 -3
  155. data/lib/rubygems/ext/builder.rb +6 -2
  156. data/lib/rubygems/ext/cargo_builder.rb +2 -2
  157. data/lib/rubygems/ext/cmake_builder.rb +97 -8
  158. data/lib/rubygems/ext/configure_builder.rb +2 -2
  159. data/lib/rubygems/ext/ext_conf_builder.rb +6 -2
  160. data/lib/rubygems/ext/rake_builder.rb +2 -2
  161. data/lib/rubygems/gem_runner.rb +0 -1
  162. data/lib/rubygems/install_update_options.rb +1 -2
  163. data/lib/rubygems/installer.rb +16 -54
  164. data/lib/rubygems/name_tuple.rb +7 -1
  165. data/lib/rubygems/package/tar_header.rb +4 -4
  166. data/lib/rubygems/package/tar_reader.rb +2 -0
  167. data/lib/rubygems/package/tar_writer.rb +1 -1
  168. data/lib/rubygems/package.rb +21 -12
  169. data/lib/rubygems/platform.rb +31 -11
  170. data/lib/rubygems/remote_fetcher.rb +8 -5
  171. data/lib/rubygems/resolver/conflict.rb +1 -1
  172. data/lib/rubygems/resolver.rb +1 -1
  173. data/lib/rubygems/security/signer.rb +1 -1
  174. data/lib/rubygems/source.rb +2 -2
  175. data/lib/rubygems/spec_fetcher.rb +4 -4
  176. data/lib/rubygems/specification.rb +5 -96
  177. data/lib/rubygems/specification_policy.rb +0 -36
  178. data/lib/rubygems/specification_record.rb +1 -1
  179. data/lib/rubygems/text.rb +1 -1
  180. data/lib/rubygems/uninstaller.rb +17 -6
  181. data/lib/rubygems/user_interaction.rb +6 -9
  182. data/lib/rubygems/util.rb +0 -22
  183. data/lib/rubygems/validator.rb +1 -1
  184. data/lib/rubygems/vendor/net-http/lib/net/http/generic_request.rb +25 -9
  185. data/lib/rubygems/vendor/net-http/lib/net/http/responses.rb +2 -2
  186. data/lib/rubygems/vendor/net-http/lib/net/http.rb +14 -14
  187. data/lib/rubygems/vendor/optparse/lib/optparse.rb +82 -41
  188. data/lib/rubygems/vendor/resolv/lib/resolv.rb +1 -1
  189. data/lib/rubygems/vendor/timeout/lib/timeout.rb +4 -1
  190. data/lib/rubygems/vendor/uri/lib/uri/common.rb +57 -15
  191. data/lib/rubygems/vendor/uri/lib/uri/file.rb +1 -1
  192. data/lib/rubygems/vendor/uri/lib/uri/generic.rb +34 -21
  193. data/lib/rubygems/vendor/uri/lib/uri/http.rb +12 -0
  194. data/lib/rubygems/vendor/uri/lib/uri/rfc2396_parser.rb +9 -8
  195. data/lib/rubygems/vendor/uri/lib/uri/version.rb +2 -2
  196. data/lib/rubygems/version.rb +8 -20
  197. data/lib/rubygems/win_platform.rb +31 -0
  198. data/lib/rubygems.rb +12 -40
  199. data/rubygems-update.gemspec +6 -4
  200. metadata +10 -18
  201. data/bundler/lib/bundler/cli/inject.rb +0 -60
  202. data/bundler/lib/bundler/cli/viz.rb +0 -31
  203. data/bundler/lib/bundler/graph.rb +0 -152
  204. data/bundler/lib/bundler/man/bundle-inject.1 +0 -31
  205. data/bundler/lib/bundler/man/bundle-inject.1.ronn +0 -32
  206. data/bundler/lib/bundler/man/bundle-viz.1 +0 -30
  207. data/bundler/lib/bundler/man/bundle-viz.1.ronn +0 -36
  208. data/bundler/lib/bundler/similarity_detector.rb +0 -63
  209. data/lib/rubygems/commands/query_command.rb +0 -43
  210. data/lib/rubygems/compatibility.rb +0 -41
  211. data/lib/rubygems/install_default_message.rb +0 -13
@@ -190,9 +190,6 @@ duplicate dependency on #{dep}, (#{prev.requirement}) use:
190
190
 
191
191
  ##
192
192
  # Checks that the gem does not depend on itself.
193
- # Checks that dependencies use requirements as we recommend. Warnings are
194
- # issued when dependencies are open-ended or overly strict for semantic
195
- # versioning.
196
193
 
197
194
  def validate_dependencies # :nodoc:
198
195
  warning_messages = []
@@ -200,39 +197,6 @@ duplicate dependency on #{dep}, (#{prev.requirement}) use:
200
197
  if dep.name == @specification.name # warn on self reference
201
198
  warning_messages << "Self referencing dependency is unnecessary and strongly discouraged."
202
199
  end
203
-
204
- prerelease_dep = dep.requirements_list.any? do |req|
205
- Gem::Requirement.new(req).prerelease?
206
- end
207
-
208
- warning_messages << "prerelease dependency on #{dep} is not recommended" if
209
- prerelease_dep && !@specification.version.prerelease?
210
-
211
- open_ended = dep.requirement.requirements.all? do |op, version|
212
- !version.prerelease? && [">", ">="].include?(op)
213
- end
214
-
215
- next unless open_ended
216
- op, dep_version = dep.requirement.requirements.first
217
-
218
- segments = dep_version.segments
219
-
220
- base = segments.first 2
221
-
222
- recommendation = if [">", ">="].include?(op) && segments == [0]
223
- " use a bounded requirement, such as \"~> x.y\""
224
- else
225
- bugfix = if op == ">"
226
- ", \"> #{dep_version}\""
227
- elsif op == ">=" && base != segments
228
- ", \">= #{dep_version}\""
229
- end
230
-
231
- " if #{dep.name} is semantically versioned, use:\n" \
232
- " add_#{dep.type}_dependency \"#{dep.name}\", \"~> #{base.join "."}\"#{bugfix}"
233
- end
234
-
235
- warning_messages << ["open-ended dependency on #{dep} is not recommended", recommendation].join("\n") + "\n"
236
200
  end
237
201
  if warning_messages.any?
238
202
  warning_messages.each {|warning_message| warning warning_message }
@@ -73,7 +73,7 @@ module Gem
73
73
  end
74
74
 
75
75
  ##
76
- # Adds +spec+ to the the record, keeping the collection properly sorted.
76
+ # Adds +spec+ to the record, keeping the collection properly sorted.
77
77
 
78
78
  def add_spec(spec)
79
79
  return if all.include? spec
data/lib/rubygems/text.rb CHANGED
@@ -21,7 +21,7 @@ module Gem::Text
21
21
  # Wraps +text+ to +wrap+ characters and optionally indents by +indent+
22
22
  # characters
23
23
 
24
- def format_text(text, wrap, indent=0)
24
+ def format_text(text, wrap, indent = 0)
25
25
  result = []
26
26
  work = clean_text(text)
27
27
 
@@ -42,10 +42,25 @@ class Gem::Uninstaller
42
42
  attr_reader :spec
43
43
 
44
44
  ##
45
- # Constructs an uninstaller that will uninstall +gem+
45
+ # Constructs an uninstaller that will uninstall gem named +gem+.
46
+ # +options+ is a Hash with the following keys:
47
+ #
48
+ # :version:: Version requirement for the gem to uninstall. If not specified,
49
+ # uses Gem::Requirement.default.
50
+ # :install_dir:: The directory where the gem is installed. If not specified,
51
+ # uses Gem.dir.
52
+ # :executables:: Whether executables should be removed without confirmation or not. If nil, asks the user explicitly.
53
+ # :all:: If more than one version matches the requirement, whether to forcefully remove all matching versions or ask the user to select specific matching versions that should be removed.
54
+ # :ignore:: Ignore broken dependency checks when uninstalling.
55
+ # :bin_dir:: Directory containing executables to remove. If not specified,
56
+ # uses Gem.bindir.
57
+ # :format_executable:: In order to find executables to be removed, format executable names using Gem::Installer.exec_format.
58
+ # :abort_on_dependent:: Directly abort uninstallation if dependencies would be broken, rather than asking the user for confirmation.
59
+ # :check_dev:: When checking if uninstalling gem would leave broken dependencies around, also consider development dependencies.
60
+ # :force:: Set both :all and :ignore to true for forced uninstallation.
61
+ # :user_install:: Uninstall from user gem directory instead of system directory.
46
62
 
47
63
  def initialize(gem, options = {})
48
- # TODO: document the valid options
49
64
  @gem = gem
50
65
  @version = options[:version] || Gem::Requirement.default
51
66
  @install_dir = options[:install_dir]
@@ -57,10 +72,6 @@ class Gem::Uninstaller
57
72
  @bin_dir = options[:bin_dir]
58
73
  @format_executable = options[:format_executable]
59
74
  @abort_on_dependent = options[:abort_on_dependent]
60
-
61
- # Indicate if development dependencies should be checked when
62
- # uninstalling. (default: false)
63
- #
64
75
  @check_dev = options[:check_dev]
65
76
 
66
77
  if options[:force]
@@ -6,7 +6,6 @@
6
6
  # See LICENSE.txt for permissions.
7
7
  #++
8
8
 
9
- require_relative "deprecate"
10
9
  require_relative "text"
11
10
 
12
11
  ##
@@ -170,8 +169,6 @@ end
170
169
  # Gem::StreamUI implements a simple stream based user interface.
171
170
 
172
171
  class Gem::StreamUI
173
- extend Gem::Deprecate
174
-
175
172
  ##
176
173
  # The input stream
177
174
 
@@ -193,7 +190,7 @@ class Gem::StreamUI
193
190
  # then special operations (like asking for passwords) will use the TTY
194
191
  # commands to disable character echo.
195
192
 
196
- def initialize(in_stream, out_stream, err_stream=$stderr, usetty=true)
193
+ def initialize(in_stream, out_stream, err_stream = $stderr, usetty = true)
197
194
  @ins = in_stream
198
195
  @outs = out_stream
199
196
  @errs = err_stream
@@ -246,7 +243,7 @@ class Gem::StreamUI
246
243
  # to a tty, raises an exception if default is nil, otherwise returns
247
244
  # default.
248
245
 
249
- def ask_yes_no(question, default=nil)
246
+ def ask_yes_no(question, default = nil)
250
247
  unless tty?
251
248
  if default.nil?
252
249
  raise Gem::OperationNotSupportedError,
@@ -325,14 +322,14 @@ class Gem::StreamUI
325
322
  ##
326
323
  # Display a statement.
327
324
 
328
- def say(statement="")
325
+ def say(statement = "")
329
326
  @outs.puts statement
330
327
  end
331
328
 
332
329
  ##
333
330
  # Display an informational alert. Will ask +question+ if it is not nil.
334
331
 
335
- def alert(statement, question=nil)
332
+ def alert(statement, question = nil)
336
333
  @outs.puts "INFO: #{statement}"
337
334
  ask(question) if question
338
335
  end
@@ -340,7 +337,7 @@ class Gem::StreamUI
340
337
  ##
341
338
  # Display a warning on stderr. Will ask +question+ if it is not nil.
342
339
 
343
- def alert_warning(statement, question=nil)
340
+ def alert_warning(statement, question = nil)
344
341
  @errs.puts "WARNING: #{statement}"
345
342
  ask(question) if question
346
343
  end
@@ -349,7 +346,7 @@ class Gem::StreamUI
349
346
  # Display an error message in a location expected to get error messages.
350
347
  # Will ask +question+ if it is not nil.
351
348
 
352
- def alert_error(statement, question=nil)
349
+ def alert_error(statement, question = nil)
353
350
  @errs.puts "ERROR: #{statement}"
354
351
  ask(question) if question
355
352
  end
data/lib/rubygems/util.rb CHANGED
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "deprecate"
4
-
5
3
  ##
6
4
  # This module contains various utility methods as module methods.
7
5
 
@@ -56,26 +54,6 @@ module Gem::Util
56
54
  IO.popen command, &:read
57
55
  end
58
56
 
59
- ##
60
- # Invokes system, but silences all output.
61
-
62
- def self.silent_system(*command)
63
- opt = { out: IO::NULL, err: [:child, :out] }
64
- if Hash === command.last
65
- opt.update(command.last)
66
- cmds = command[0...-1]
67
- else
68
- cmds = command.dup
69
- end
70
- system(*(cmds << opt))
71
- end
72
-
73
- class << self
74
- extend Gem::Deprecate
75
-
76
- rubygems_deprecate :silent_system
77
- end
78
-
79
57
  ##
80
58
  # Enumerates the parents of +directory+.
81
59
 
@@ -59,7 +59,7 @@ class Gem::Validator
59
59
  #--
60
60
  # TODO needs further cleanup
61
61
 
62
- def alien(gems=[])
62
+ def alien(gems = [])
63
63
  errors = Hash.new {|h,k| h[k] = {} }
64
64
 
65
65
  Gem::Specification.each do |spec|
@@ -102,6 +102,31 @@ class Gem::Net::HTTPGenericRequest
102
102
  "\#<#{self.class} #{@method}>"
103
103
  end
104
104
 
105
+ # Returns a string representation of the request with the details for pp:
106
+ #
107
+ # require 'pp'
108
+ # post = Gem::Net::HTTP::Post.new(uri)
109
+ # post.inspect # => "#<Gem::Net::HTTP::Post POST>"
110
+ # post.pretty_inspect
111
+ # # => #<Gem::Net::HTTP::Post
112
+ # POST
113
+ # path="/"
114
+ # headers={"accept-encoding" => ["gzip;q=1.0,deflate;q=0.6,identity;q=0.3"],
115
+ # "accept" => ["*/*"],
116
+ # "user-agent" => ["Ruby"],
117
+ # "host" => ["www.ruby-lang.org"]}>
118
+ #
119
+ def pretty_print(q)
120
+ q.object_group(self) {
121
+ q.breakable
122
+ q.text @method
123
+ q.breakable
124
+ q.text "path="; q.pp @path
125
+ q.breakable
126
+ q.text "headers="; q.pp to_hash
127
+ }
128
+ end
129
+
105
130
  ##
106
131
  # Don't automatically decode response content-encoding if the user indicates
107
132
  # they want to handle it.
@@ -260,7 +285,6 @@ class Gem::Net::HTTPGenericRequest
260
285
  def send_request_with_body(sock, ver, path, body)
261
286
  self.content_length = body.bytesize
262
287
  delete 'Transfer-Encoding'
263
- supply_default_content_type
264
288
  write_header sock, ver, path
265
289
  wait_for_continue sock, ver if sock.continue_timeout
266
290
  sock.write body
@@ -271,7 +295,6 @@ class Gem::Net::HTTPGenericRequest
271
295
  raise ArgumentError,
272
296
  "Content-Length not given and Transfer-Encoding is not `chunked'"
273
297
  end
274
- supply_default_content_type
275
298
  write_header sock, ver, path
276
299
  wait_for_continue sock, ver if sock.continue_timeout
277
300
  if chunked?
@@ -373,12 +396,6 @@ class Gem::Net::HTTPGenericRequest
373
396
  buf.clear
374
397
  end
375
398
 
376
- def supply_default_content_type
377
- return if content_type()
378
- warn 'net/http: Content-Type did not set; using application/x-www-form-urlencoded', uplevel: 1 if $VERBOSE
379
- set_content_type 'application/x-www-form-urlencoded'
380
- end
381
-
382
399
  ##
383
400
  # Waits up to the continue timeout for a response from the server provided
384
401
  # we're speaking HTTP 1.1 and are expecting a 100-continue response.
@@ -411,4 +428,3 @@ class Gem::Net::HTTPGenericRequest
411
428
  end
412
429
 
413
430
  end
414
-
@@ -1104,7 +1104,7 @@ class Gem::Net::HTTPResponse
1104
1104
  '3' => Gem::Net::HTTPRedirection,
1105
1105
  '4' => Gem::Net::HTTPClientError,
1106
1106
  '5' => Gem::Net::HTTPServerError
1107
- }
1107
+ }.freeze
1108
1108
  CODE_TO_OBJ = {
1109
1109
  '100' => Gem::Net::HTTPContinue,
1110
1110
  '101' => Gem::Net::HTTPSwitchProtocol,
@@ -1170,5 +1170,5 @@ class Gem::Net::HTTPResponse
1170
1170
  '508' => Gem::Net::HTTPLoopDetected,
1171
1171
  '510' => Gem::Net::HTTPNotExtended,
1172
1172
  '511' => Gem::Net::HTTPNetworkAuthenticationRequired,
1173
- }
1173
+ }.freeze
1174
1174
  end
@@ -102,14 +102,14 @@ module Gem::Net #:nodoc:
102
102
  #
103
103
  # == URIs
104
104
  #
105
- # On the internet, a URI
105
+ # On the internet, a Gem::URI
106
106
  # ({Universal Resource Identifier}[https://en.wikipedia.org/wiki/Uniform_Resource_Identifier])
107
107
  # is a string that identifies a particular resource.
108
108
  # It consists of some or all of: scheme, hostname, path, query, and fragment;
109
- # see {URI syntax}[https://en.wikipedia.org/wiki/Uniform_Resource_Identifier#Syntax].
109
+ # see {Gem::URI syntax}[https://en.wikipedia.org/wiki/Uniform_Resource_Identifier#Syntax].
110
110
  #
111
- # A Ruby {Gem::URI::Generic}[https://docs.ruby-lang.org/en/master/Gem/URI/Generic.html] object
112
- # represents an internet URI.
111
+ # A Ruby {Gem::URI::Generic}[https://docs.ruby-lang.org/en/master/Gem::URI/Generic.html] object
112
+ # represents an internet Gem::URI.
113
113
  # It provides, among others, methods
114
114
  # +scheme+, +hostname+, +path+, +query+, and +fragment+.
115
115
  #
@@ -144,7 +144,7 @@ module Gem::Net #:nodoc:
144
144
  #
145
145
  # === Queries
146
146
  #
147
- # A host-specific query adds name/value pairs to the URI:
147
+ # A host-specific query adds name/value pairs to the Gem::URI:
148
148
  #
149
149
  # _uri = uri.dup
150
150
  # params = {userId: 1, completed: false}
@@ -154,7 +154,7 @@ module Gem::Net #:nodoc:
154
154
  #
155
155
  # === Fragments
156
156
  #
157
- # A {URI fragment}[https://en.wikipedia.org/wiki/URI_fragment] has no effect
157
+ # A {Gem::URI fragment}[https://en.wikipedia.org/wiki/URI_fragment] has no effect
158
158
  # in \Gem::Net::HTTP;
159
159
  # the same data is returned, regardless of whether a fragment is included.
160
160
  #
@@ -327,9 +327,9 @@ module Gem::Net #:nodoc:
327
327
  # res = http.request(req)
328
328
  # end
329
329
  #
330
- # Or if you simply want to make a GET request, you may pass in a URI
330
+ # Or if you simply want to make a GET request, you may pass in a Gem::URI
331
331
  # object that has an \HTTPS URL. \Gem::Net::HTTP automatically turns on TLS
332
- # verification if the URI object has a 'https' :URI scheme:
332
+ # verification if the Gem::URI object has a 'https' Gem::URI scheme:
333
333
  #
334
334
  # uri # => #<Gem::URI::HTTPS https://jsonplaceholder.typicode.com/>
335
335
  # Gem::Net::HTTP.get(uri)
@@ -374,7 +374,7 @@ module Gem::Net #:nodoc:
374
374
  #
375
375
  # When environment variable <tt>'http_proxy'</tt>
376
376
  # is set to a \Gem::URI string,
377
- # the returned +http+ will have the server at that URI as its proxy;
377
+ # the returned +http+ will have the server at that Gem::URI as its proxy;
378
378
  # note that the \Gem::URI string must have a protocol
379
379
  # such as <tt>'http'</tt> or <tt>'https'</tt>:
380
380
  #
@@ -724,7 +724,7 @@ module Gem::Net #:nodoc:
724
724
  class HTTP < Protocol
725
725
 
726
726
  # :stopdoc:
727
- VERSION = "0.6.0"
727
+ VERSION = "0.7.0"
728
728
  HTTPVersion = '1.1'
729
729
  begin
730
730
  require 'zlib'
@@ -790,7 +790,7 @@ module Gem::Net #:nodoc:
790
790
  # "completed": false
791
791
  # }
792
792
  #
793
- # With URI object +uri+ and optional hash argument +headers+:
793
+ # With Gem::URI object +uri+ and optional hash argument +headers+:
794
794
  #
795
795
  # uri = Gem::URI('https://jsonplaceholder.typicode.com/todos/1')
796
796
  # headers = {'Content-type' => 'application/json; charset=UTF-8'}
@@ -863,7 +863,7 @@ module Gem::Net #:nodoc:
863
863
 
864
864
  # Posts data to a host; returns a Gem::Net::HTTPResponse object.
865
865
  #
866
- # Argument +url+ must be a URI;
866
+ # Argument +url+ must be a Gem::URI;
867
867
  # argument +data+ must be a hash:
868
868
  #
869
869
  # _uri = uri.dup
@@ -1529,7 +1529,7 @@ module Gem::Net #:nodoc:
1529
1529
  :verify_hostname,
1530
1530
  ] # :nodoc:
1531
1531
 
1532
- SSL_IVNAMES = SSL_ATTRIBUTES.map { |a| "@#{a}".to_sym } # :nodoc:
1532
+ SSL_IVNAMES = SSL_ATTRIBUTES.map { |a| "@#{a}".to_sym }.freeze # :nodoc:
1533
1533
 
1534
1534
  # Sets or returns the path to a CA certification file in PEM format.
1535
1535
  attr_accessor :ca_file
@@ -1860,7 +1860,7 @@ module Gem::Net #:nodoc:
1860
1860
  @proxy_from_env
1861
1861
  end
1862
1862
 
1863
- # The proxy URI determined from the environment for this connection.
1863
+ # The proxy Gem::URI determined from the environment for this connection.
1864
1864
  def proxy_uri # :nodoc:
1865
1865
  return if @proxy_uri == false
1866
1866
  @proxy_uri ||= Gem::URI::HTTP.new(