rubygems-update 3.7.2 → 4.0.0.beta1

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 (206) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +1413 -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 +990 -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 +7 -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 +75 -83
  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 +45 -35
  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 +13 -35
  30. data/bundler/lib/bundler/endpoint_specification.rb +0 -22
  31. data/bundler/lib/bundler/errors.rb +1 -5
  32. data/bundler/lib/bundler/feature_flag.rb +0 -33
  33. data/bundler/lib/bundler/fetcher/compact_index.rb +1 -1
  34. data/bundler/lib/bundler/friendly_errors.rb +2 -2
  35. data/bundler/lib/bundler/index.rb +0 -7
  36. data/bundler/lib/bundler/inline.rb +1 -1
  37. data/bundler/lib/bundler/installer/gem_installer.rb +0 -11
  38. data/bundler/lib/bundler/installer.rb +0 -6
  39. data/bundler/lib/bundler/lockfile_generator.rb +1 -1
  40. data/bundler/lib/bundler/lockfile_parser.rb +2 -12
  41. data/bundler/lib/bundler/man/bundle-add.1 +1 -1
  42. data/bundler/lib/bundler/man/bundle-binstubs.1 +3 -6
  43. data/bundler/lib/bundler/man/bundle-binstubs.1.ronn +4 -6
  44. data/bundler/lib/bundler/man/bundle-cache.1 +2 -14
  45. data/bundler/lib/bundler/man/bundle-cache.1.ronn +1 -14
  46. data/bundler/lib/bundler/man/bundle-check.1 +2 -5
  47. data/bundler/lib/bundler/man/bundle-check.1.ronn +0 -5
  48. data/bundler/lib/bundler/man/bundle-clean.1 +1 -1
  49. data/bundler/lib/bundler/man/bundle-config.1 +6 -33
  50. data/bundler/lib/bundler/man/bundle-config.1.ronn +20 -55
  51. data/bundler/lib/bundler/man/bundle-console.1 +1 -1
  52. data/bundler/lib/bundler/man/bundle-doctor.1 +1 -1
  53. data/bundler/lib/bundler/man/bundle-env.1 +1 -1
  54. data/bundler/lib/bundler/man/bundle-exec.1 +2 -5
  55. data/bundler/lib/bundler/man/bundle-exec.1.ronn +1 -5
  56. data/bundler/lib/bundler/man/bundle-fund.1 +1 -1
  57. data/bundler/lib/bundler/man/bundle-gem.1 +3 -6
  58. data/bundler/lib/bundler/man/bundle-gem.1.ronn +2 -5
  59. data/bundler/lib/bundler/man/bundle-help.1 +1 -1
  60. data/bundler/lib/bundler/man/bundle-info.1 +1 -1
  61. data/bundler/lib/bundler/man/bundle-init.1 +1 -1
  62. data/bundler/lib/bundler/man/bundle-install.1 +8 -59
  63. data/bundler/lib/bundler/man/bundle-install.1.ronn +12 -107
  64. data/bundler/lib/bundler/man/bundle-issue.1 +1 -1
  65. data/bundler/lib/bundler/man/bundle-licenses.1 +1 -1
  66. data/bundler/lib/bundler/man/bundle-list.1 +6 -1
  67. data/bundler/lib/bundler/man/bundle-list.1.ronn +5 -0
  68. data/bundler/lib/bundler/man/bundle-lock.1 +1 -1
  69. data/bundler/lib/bundler/man/bundle-open.1 +1 -1
  70. data/bundler/lib/bundler/man/bundle-outdated.1 +1 -1
  71. data/bundler/lib/bundler/man/bundle-platform.1 +1 -1
  72. data/bundler/lib/bundler/man/bundle-plugin.1 +2 -9
  73. data/bundler/lib/bundler/man/bundle-plugin.1.ronn +0 -8
  74. data/bundler/lib/bundler/man/bundle-pristine.1 +1 -1
  75. data/bundler/lib/bundler/man/bundle-remove.1 +2 -8
  76. data/bundler/lib/bundler/man/bundle-remove.1.ronn +1 -8
  77. data/bundler/lib/bundler/man/bundle-show.1 +2 -5
  78. data/bundler/lib/bundler/man/bundle-show.1.ronn +0 -4
  79. data/bundler/lib/bundler/man/bundle-update.1 +1 -1
  80. data/bundler/lib/bundler/man/bundle-version.1 +1 -1
  81. data/bundler/lib/bundler/man/bundle.1 +1 -10
  82. data/bundler/lib/bundler/man/bundle.1.ronn +0 -9
  83. data/bundler/lib/bundler/man/gemfile.5 +1 -1
  84. data/bundler/lib/bundler/man/index.txt +0 -2
  85. data/bundler/lib/bundler/materialization.rb +1 -1
  86. data/bundler/lib/bundler/plugin/installer.rb +0 -10
  87. data/bundler/lib/bundler/plugin/source_list.rb +1 -1
  88. data/bundler/lib/bundler/plugin.rb +1 -1
  89. data/bundler/lib/bundler/resolver.rb +1 -1
  90. data/bundler/lib/bundler/ruby_dsl.rb +2 -0
  91. data/bundler/lib/bundler/ruby_version.rb +1 -3
  92. data/bundler/lib/bundler/rubygems_ext.rb +1 -1
  93. data/bundler/lib/bundler/rubygems_gem_installer.rb +1 -1
  94. data/bundler/lib/bundler/rubygems_integration.rb +1 -5
  95. data/bundler/lib/bundler/self_manager.rb +1 -1
  96. data/bundler/lib/bundler/settings.rb +7 -26
  97. data/bundler/lib/bundler/shared_helpers.rb +8 -20
  98. data/bundler/lib/bundler/source/git/git_proxy.rb +3 -11
  99. data/bundler/lib/bundler/source/git.rb +2 -3
  100. data/bundler/lib/bundler/source/path.rb +3 -7
  101. data/bundler/lib/bundler/source/rubygems.rb +11 -17
  102. data/bundler/lib/bundler/source.rb +1 -1
  103. data/bundler/lib/bundler/source_list.rb +4 -45
  104. data/bundler/lib/bundler/source_map.rb +2 -5
  105. data/bundler/lib/bundler/spec_set.rb +6 -15
  106. data/bundler/lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt +7 -129
  107. data/bundler/lib/bundler/templates/newgem/circleci/config.yml.tt +12 -0
  108. data/bundler/lib/bundler/templates/newgem/ext/newgem/Cargo.toml.tt +1 -1
  109. data/bundler/lib/bundler/templates/newgem/ext/newgem/extconf-go.rb.tt +11 -0
  110. data/bundler/lib/bundler/templates/newgem/ext/newgem/go.mod.tt +5 -0
  111. data/bundler/lib/bundler/templates/newgem/ext/newgem/newgem-go.c.tt +2 -0
  112. data/bundler/lib/bundler/templates/newgem/ext/newgem/newgem.go.tt +31 -0
  113. data/bundler/lib/bundler/templates/newgem/github/workflows/main.yml.tt +6 -0
  114. data/bundler/lib/bundler/templates/newgem/gitlab-ci.yml.tt +9 -0
  115. data/bundler/lib/bundler/templates/newgem/newgem.gemspec.tt +4 -1
  116. data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool/timed_stack.rb +26 -23
  117. data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool/version.rb +1 -1
  118. data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool.rb +50 -6
  119. data/bundler/lib/bundler/vendor/fileutils/lib/fileutils.rb +57 -52
  120. data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +5 -2
  121. data/bundler/lib/bundler/vendor/thor/lib/thor/runner.rb +1 -1
  122. data/bundler/lib/bundler/vendor/uri/lib/uri/common.rb +57 -15
  123. data/bundler/lib/bundler/vendor/uri/lib/uri/file.rb +1 -1
  124. data/bundler/lib/bundler/vendor/uri/lib/uri/generic.rb +34 -21
  125. data/bundler/lib/bundler/vendor/uri/lib/uri/http.rb +12 -0
  126. data/bundler/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb +9 -8
  127. data/bundler/lib/bundler/vendor/uri/lib/uri/version.rb +2 -2
  128. data/bundler/lib/bundler/version.rb +1 -1
  129. data/bundler/lib/bundler/vlad.rb +1 -14
  130. data/bundler/lib/bundler.rb +6 -28
  131. data/doc/MAINTAINERS.txt +0 -7
  132. data/doc/bundler/UPGRADING.md +11 -5
  133. data/doc/rubygems/CONTRIBUTING.md +1 -1
  134. data/lib/rubygems/basic_specification.rb +3 -9
  135. data/lib/rubygems/bundler_version_finder.rb +1 -0
  136. data/lib/rubygems/command.rb +1 -1
  137. data/lib/rubygems/command_manager.rb +3 -4
  138. data/lib/rubygems/commands/build_command.rb +0 -7
  139. data/lib/rubygems/commands/cert_command.rb +1 -1
  140. data/lib/rubygems/commands/install_command.rb +1 -5
  141. data/lib/rubygems/commands/setup_command.rb +5 -3
  142. data/lib/rubygems/config_file.rb +1 -1
  143. data/lib/rubygems/dependency.rb +1 -1
  144. data/lib/rubygems/dependency_installer.rb +0 -77
  145. data/lib/rubygems/dependency_list.rb +1 -2
  146. data/lib/rubygems/deprecate.rb +74 -72
  147. data/lib/rubygems/doctor.rb +1 -1
  148. data/lib/rubygems/errors.rb +1 -1
  149. data/lib/rubygems/exceptions.rb +2 -3
  150. data/lib/rubygems/ext/builder.rb +6 -2
  151. data/lib/rubygems/ext/cargo_builder.rb +2 -2
  152. data/lib/rubygems/ext/cmake_builder.rb +97 -8
  153. data/lib/rubygems/ext/configure_builder.rb +2 -2
  154. data/lib/rubygems/ext/ext_conf_builder.rb +6 -2
  155. data/lib/rubygems/ext/rake_builder.rb +2 -2
  156. data/lib/rubygems/gem_runner.rb +0 -1
  157. data/lib/rubygems/install_update_options.rb +1 -2
  158. data/lib/rubygems/installer.rb +16 -54
  159. data/lib/rubygems/name_tuple.rb +7 -1
  160. data/lib/rubygems/package/tar_header.rb +4 -4
  161. data/lib/rubygems/package/tar_reader.rb +2 -0
  162. data/lib/rubygems/package/tar_writer.rb +1 -1
  163. data/lib/rubygems/package.rb +21 -12
  164. data/lib/rubygems/platform.rb +31 -11
  165. data/lib/rubygems/remote_fetcher.rb +8 -5
  166. data/lib/rubygems/resolver/conflict.rb +1 -1
  167. data/lib/rubygems/resolver.rb +1 -1
  168. data/lib/rubygems/security/signer.rb +1 -1
  169. data/lib/rubygems/source.rb +2 -2
  170. data/lib/rubygems/spec_fetcher.rb +4 -4
  171. data/lib/rubygems/specification.rb +5 -96
  172. data/lib/rubygems/specification_policy.rb +0 -36
  173. data/lib/rubygems/specification_record.rb +1 -1
  174. data/lib/rubygems/text.rb +1 -1
  175. data/lib/rubygems/uninstaller.rb +17 -6
  176. data/lib/rubygems/user_interaction.rb +6 -9
  177. data/lib/rubygems/util.rb +0 -22
  178. data/lib/rubygems/validator.rb +1 -1
  179. data/lib/rubygems/vendor/net-http/lib/net/http/generic_request.rb +25 -9
  180. data/lib/rubygems/vendor/net-http/lib/net/http/responses.rb +2 -2
  181. data/lib/rubygems/vendor/net-http/lib/net/http.rb +14 -14
  182. data/lib/rubygems/vendor/optparse/lib/optparse.rb +82 -41
  183. data/lib/rubygems/vendor/resolv/lib/resolv.rb +1 -1
  184. data/lib/rubygems/vendor/timeout/lib/timeout.rb +4 -1
  185. data/lib/rubygems/vendor/uri/lib/uri/common.rb +57 -15
  186. data/lib/rubygems/vendor/uri/lib/uri/file.rb +1 -1
  187. data/lib/rubygems/vendor/uri/lib/uri/generic.rb +34 -21
  188. data/lib/rubygems/vendor/uri/lib/uri/http.rb +12 -0
  189. data/lib/rubygems/vendor/uri/lib/uri/rfc2396_parser.rb +9 -8
  190. data/lib/rubygems/vendor/uri/lib/uri/version.rb +2 -2
  191. data/lib/rubygems/version.rb +2 -17
  192. data/lib/rubygems/win_platform.rb +31 -0
  193. data/lib/rubygems.rb +10 -38
  194. data/rubygems-update.gemspec +4 -4
  195. metadata +10 -18
  196. data/bundler/lib/bundler/cli/inject.rb +0 -60
  197. data/bundler/lib/bundler/cli/viz.rb +0 -31
  198. data/bundler/lib/bundler/graph.rb +0 -152
  199. data/bundler/lib/bundler/man/bundle-inject.1 +0 -31
  200. data/bundler/lib/bundler/man/bundle-inject.1.ronn +0 -32
  201. data/bundler/lib/bundler/man/bundle-viz.1 +0 -30
  202. data/bundler/lib/bundler/man/bundle-viz.1.ronn +0 -36
  203. data/bundler/lib/bundler/similarity_detector.rb +0 -63
  204. data/lib/rubygems/commands/query_command.rb +0 -43
  205. data/lib/rubygems/compatibility.rb +0 -41
  206. data/lib/rubygems/install_default_message.rb +0 -13
@@ -7,7 +7,6 @@
7
7
  # See LICENSE.txt for permissions.
8
8
  #++
9
9
 
10
- require_relative "deprecate"
11
10
  require_relative "basic_specification"
12
11
  require_relative "stub_specification"
13
12
  require_relative "platform"
@@ -38,8 +37,6 @@ require "rbconfig"
38
37
  # items you may add to a specification.
39
38
 
40
39
  class Gem::Specification < Gem::BasicSpecification
41
- extend Gem::Deprecate
42
-
43
40
  # REFACTOR: Consider breaking out this version stuff into a separate
44
41
  # module. There's enough special stuff around it that it may justify
45
42
  # a separate class.
@@ -488,8 +485,6 @@ class Gem::Specification < Gem::BasicSpecification
488
485
  end
489
486
 
490
487
  @platform = @new_platform.to_s
491
-
492
- invalidate_memoized_attributes
493
488
  end
494
489
 
495
490
  ##
@@ -737,14 +732,6 @@ class Gem::Specification < Gem::BasicSpecification
737
732
 
738
733
  attr_accessor :autorequire # :nodoc:
739
734
 
740
- ##
741
- # Sets the default executable for this gem.
742
- #
743
- # Deprecated: You must now specify the executable name to Gem.bin_path.
744
-
745
- attr_writer :default_executable
746
- rubygems_deprecate :default_executable=
747
-
748
735
  ##
749
736
  # Allows deinstallation of gems with legacy platforms.
750
737
 
@@ -1321,7 +1308,7 @@ class Gem::Specification < Gem::BasicSpecification
1321
1308
  spec.instance_variable_set :@authors, array[12]
1322
1309
  spec.instance_variable_set :@description, array[13]
1323
1310
  spec.instance_variable_set :@homepage, array[14]
1324
- spec.instance_variable_set :@has_rdoc, array[15]
1311
+ # offset due to has_rdoc removal
1325
1312
  spec.instance_variable_set :@licenses, array[17]
1326
1313
  spec.instance_variable_set :@metadata, array[18]
1327
1314
  spec.instance_variable_set :@loaded, false
@@ -1620,14 +1607,14 @@ class Gem::Specification < Gem::BasicSpecification
1620
1607
  # spec's cached gem.
1621
1608
 
1622
1609
  def cache_dir
1623
- @cache_dir ||= File.join base_dir, "cache"
1610
+ File.join base_dir, "cache"
1624
1611
  end
1625
1612
 
1626
1613
  ##
1627
1614
  # Returns the full path to the cached gem for this spec.
1628
1615
 
1629
1616
  def cache_file
1630
- @cache_file ||= File.join cache_dir, "#{full_name}.gem"
1617
+ File.join cache_dir, "#{full_name}.gem"
1631
1618
  end
1632
1619
 
1633
1620
  ##
@@ -1716,24 +1703,6 @@ class Gem::Specification < Gem::BasicSpecification
1716
1703
  end
1717
1704
  end
1718
1705
 
1719
- ##
1720
- # The default executable for this gem.
1721
- #
1722
- # Deprecated: The name of the gem is assumed to be the name of the
1723
- # executable now. See Gem.bin_path.
1724
-
1725
- def default_executable # :nodoc:
1726
- if defined?(@default_executable) && @default_executable
1727
- result = @default_executable
1728
- elsif @executables && @executables.size == 1
1729
- result = Array(@executables).first
1730
- else
1731
- result = nil
1732
- end
1733
- result
1734
- end
1735
- rubygems_deprecate :default_executable
1736
-
1737
1706
  ##
1738
1707
  # The default value for specification attribute +name+
1739
1708
 
@@ -1757,7 +1726,7 @@ class Gem::Specification < Gem::BasicSpecification
1757
1726
  #
1758
1727
  # [depending_gem, dependency, [list_of_gems_that_satisfy_dependency]]
1759
1728
 
1760
- def dependent_gems(check_dev=true)
1729
+ def dependent_gems(check_dev = true)
1761
1730
  out = []
1762
1731
  Gem::Specification.each do |spec|
1763
1732
  deps = check_dev ? spec.dependencies : spec.runtime_dependencies
@@ -1903,10 +1872,6 @@ class Gem::Specification < Gem::BasicSpecification
1903
1872
  spec
1904
1873
  end
1905
1874
 
1906
- def full_name
1907
- @full_name ||= super
1908
- end
1909
-
1910
1875
  ##
1911
1876
  # Work around old bundler versions removing my methods
1912
1877
  # Can be removed once RubyGems can no longer install Bundler 2.5
@@ -1919,29 +1884,6 @@ class Gem::Specification < Gem::BasicSpecification
1919
1884
  @gems_dir ||= File.join(base_dir, "gems")
1920
1885
  end
1921
1886
 
1922
- ##
1923
- # Deprecated and ignored, defaults to true.
1924
- #
1925
- # Formerly used to indicate this gem was RDoc-capable.
1926
-
1927
- def has_rdoc # :nodoc:
1928
- true
1929
- end
1930
- rubygems_deprecate :has_rdoc
1931
-
1932
- ##
1933
- # Deprecated and ignored.
1934
- #
1935
- # Formerly used to indicate this gem was RDoc-capable.
1936
-
1937
- def has_rdoc=(ignored) # :nodoc:
1938
- @has_rdoc = true
1939
- end
1940
- rubygems_deprecate :has_rdoc=
1941
-
1942
- alias_method :has_rdoc?, :has_rdoc # :nodoc:
1943
- rubygems_deprecate :has_rdoc?
1944
-
1945
1887
  ##
1946
1888
  # True if this gem has files in test_files
1947
1889
 
@@ -2044,17 +1986,6 @@ class Gem::Specification < Gem::BasicSpecification
2044
1986
  end
2045
1987
  end
2046
1988
 
2047
- ##
2048
- # Expire memoized instance variables that can incorrectly generate, replace
2049
- # or miss files due changes in certain attributes used to compute them.
2050
-
2051
- def invalidate_memoized_attributes
2052
- @full_name = nil
2053
- @cache_file = nil
2054
- end
2055
-
2056
- private :invalidate_memoized_attributes
2057
-
2058
1989
  def inspect # :nodoc:
2059
1990
  if $DEBUG
2060
1991
  super
@@ -2093,8 +2024,6 @@ class Gem::Specification < Gem::BasicSpecification
2093
2024
  def internal_init # :nodoc:
2094
2025
  super
2095
2026
  @bin_dir = nil
2096
- @cache_dir = nil
2097
- @cache_file = nil
2098
2027
  @doc_dir = nil
2099
2028
  @ri_dir = nil
2100
2029
  @spec_dir = nil
@@ -2447,8 +2376,6 @@ class Gem::Specification < Gem::BasicSpecification
2447
2376
  :required_rubygems_version,
2448
2377
  :specification_version,
2449
2378
  :version,
2450
- :has_rdoc,
2451
- :default_executable,
2452
2379
  :metadata,
2453
2380
  :signing_key,
2454
2381
  ]
@@ -2586,29 +2513,11 @@ class Gem::Specification < Gem::BasicSpecification
2586
2513
  Gem::SpecificationPolicy.new(self).validate_for_resolution
2587
2514
  end
2588
2515
 
2589
- def validate_metadata
2590
- Gem::SpecificationPolicy.new(self).validate_metadata
2591
- end
2592
- rubygems_deprecate :validate_metadata
2593
-
2594
- def validate_dependencies
2595
- Gem::SpecificationPolicy.new(self).validate_dependencies
2596
- end
2597
- rubygems_deprecate :validate_dependencies
2598
-
2599
- def validate_permissions
2600
- Gem::SpecificationPolicy.new(self).validate_permissions
2601
- end
2602
- rubygems_deprecate :validate_permissions
2603
-
2604
2516
  ##
2605
2517
  # Set the version to +version+.
2606
2518
 
2607
2519
  def version=(version)
2608
- @version = Gem::Version.create(version)
2609
- return if @version.nil?
2610
-
2611
- invalidate_memoized_attributes
2520
+ @version = version.nil? ? version : Gem::Version.create(version)
2612
2521
  end
2613
2522
 
2614
2523
  def stubbed?
@@ -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(