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
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative "lockfile_parser"
4
+ require_relative "worker"
4
5
 
5
6
  module Bundler
6
7
  class Definition
@@ -9,6 +10,8 @@ module Bundler
9
10
  attr_accessor :no_lock
10
11
  end
11
12
 
13
+ attr_writer :lockfile
14
+
12
15
  attr_reader(
13
16
  :dependencies,
14
17
  :locked_checksums,
@@ -107,6 +110,7 @@ module Bundler
107
110
  @locked_ruby_version = @locked_gems.ruby_version
108
111
  @locked_deps = @locked_gems.dependencies
109
112
  @originally_locked_specs = SpecSet.new(@locked_gems.specs)
113
+ @originally_locked_sources = @locked_gems.sources
110
114
  @locked_checksums = @locked_gems.checksums
111
115
 
112
116
  if @unlocking_all
@@ -114,7 +118,16 @@ module Bundler
114
118
  @locked_sources = []
115
119
  else
116
120
  @locked_specs = @originally_locked_specs
117
- @locked_sources = @locked_gems.sources
121
+ @locked_sources = @originally_locked_sources
122
+ end
123
+
124
+ locked_gem_sources = @originally_locked_sources.select {|s| s.is_a?(Source::Rubygems) }
125
+ multisource_lockfile = locked_gem_sources.size == 1 && locked_gem_sources.first.multiple_remotes?
126
+
127
+ if multisource_lockfile
128
+ msg = "Your lockfile contains a single rubygems source section with multiple remotes, which is insecure. Make sure you run `bundle install` in non frozen mode and commit the result to make your lockfile secure."
129
+
130
+ Bundler::SharedHelpers.feature_removed! msg
118
131
  end
119
132
  else
120
133
  @locked_gems = nil
@@ -123,22 +136,10 @@ module Bundler
123
136
  @platforms = []
124
137
  @locked_deps = {}
125
138
  @locked_specs = SpecSet.new([])
126
- @originally_locked_specs = @locked_specs
127
139
  @locked_sources = []
128
- @locked_checksums = Bundler.feature_flag.lockfile_checksums?
129
- end
130
-
131
- locked_gem_sources = @locked_sources.select {|s| s.is_a?(Source::Rubygems) }
132
- @multisource_allowed = locked_gem_sources.size == 1 && locked_gem_sources.first.multiple_remotes? && Bundler.frozen_bundle?
133
-
134
- if @multisource_allowed
135
- unless sources.aggregate_global_source?
136
- msg = "Your lockfile contains a single rubygems source section with multiple remotes, which is insecure. Make sure you run `bundle install` in non frozen mode and commit the result to make your lockfile secure."
137
-
138
- Bundler::SharedHelpers.major_deprecation 2, msg
139
- end
140
-
141
- @sources.merged_gem_lockfile_sections!(locked_gem_sources.first)
140
+ @originally_locked_specs = @locked_specs
141
+ @originally_locked_sources = @locked_sources
142
+ @locked_checksums = Bundler.settings[:lockfile_checksums]
142
143
  end
143
144
 
144
145
  @unlocking_ruby ||= if @ruby_version && locked_ruby_version_object
@@ -284,12 +285,17 @@ module Bundler
284
285
  end
285
286
 
286
287
  def filter_relevant(dependencies)
287
- platforms_array = [Bundler.generic_local_platform].freeze
288
288
  dependencies.select do |d|
289
- d.should_include? && !d.gem_platforms(platforms_array).empty?
289
+ relevant_deps?(d)
290
290
  end
291
291
  end
292
292
 
293
+ def relevant_deps?(dep)
294
+ platforms_array = [Bundler.generic_local_platform].freeze
295
+
296
+ dep.should_include? && !dep.gem_platforms(platforms_array).empty?
297
+ end
298
+
293
299
  def locked_dependencies
294
300
  @locked_deps.values
295
301
  end
@@ -369,14 +375,14 @@ module Bundler
369
375
 
370
376
  msg = "`Definition#lock` was passed a target file argument. #{suggestion}"
371
377
 
372
- Bundler::SharedHelpers.major_deprecation 2, msg
378
+ Bundler::SharedHelpers.feature_removed! msg
373
379
  end
374
380
 
375
381
  write_lock(target_lockfile, preserve_unknown_sections)
376
382
  end
377
383
 
378
384
  def write_lock(file, preserve_unknown_sections)
379
- return if Definition.no_lock || file.nil?
385
+ return if Definition.no_lock || !lockfile || file.nil?
380
386
 
381
387
  contents = to_lock
382
388
 
@@ -537,7 +543,18 @@ module Bundler
537
543
 
538
544
  setup_domain!(add_checksums: true)
539
545
 
540
- specs # force materialization to real specifications, so that checksums are fetched
546
+ # force materialization to real specifications, so that checksums are fetched
547
+ specs.each do |spec|
548
+ next unless spec.source.is_a?(Bundler::Source::Rubygems)
549
+ # Checksum was fetched from the compact index API.
550
+ next if !spec.source.checksum_store.missing?(spec) && !spec.source.checksum_store.empty?(spec)
551
+ # The gem isn't installed, can't compute the checksum.
552
+ next unless spec.loaded_from
553
+
554
+ package = Gem::Package.new(spec.source.cached_built_in_gem(spec))
555
+ checksum = Checksum.from_gem_package(package)
556
+ spec.source.checksum_store.register(spec, checksum)
557
+ end
541
558
  end
542
559
 
543
560
  private
@@ -645,20 +662,12 @@ module Bundler
645
662
  end
646
663
 
647
664
  def materialize(dependencies)
648
- # Tracks potential endless loops trying to re-resolve.
649
- # TODO: Remove as dead code if not reports are received in a while
650
- incorrect_spec = nil
651
-
652
665
  specs = begin
653
666
  resolve.materialize(dependencies)
654
667
  rescue IncorrectLockfileDependencies => e
655
668
  raise if Bundler.frozen_bundle?
656
669
 
657
- spec = e.spec
658
- raise "Infinite loop while fixing lockfile dependencies" if incorrect_spec == spec
659
-
660
- incorrect_spec = spec
661
- reresolve_without([spec])
670
+ reresolve_without([e.spec])
662
671
  retry
663
672
  end
664
673
 
@@ -771,7 +780,7 @@ module Bundler
771
780
  end
772
781
 
773
782
  def precompute_source_requirements_for_indirect_dependencies?
774
- sources.non_global_rubygems_sources.all?(&:dependency_api_available?) && !sources.aggregate_global_source?
783
+ sources.non_global_rubygems_sources.all?(&:dependency_api_available?)
775
784
  end
776
785
 
777
786
  def current_platform_locked?
@@ -962,7 +971,7 @@ module Bundler
962
971
  sources.all_sources.each do |source|
963
972
  # has to be done separately, because we want to keep the locked checksum
964
973
  # store for a source, even when doing a full update
965
- if @locked_checksums && @locked_gems && locked_source = @locked_gems.sources.find {|s| s == source && !s.equal?(source) }
974
+ if @locked_checksums && @locked_gems && locked_source = @originally_locked_sources.find {|s| s == source && !s.equal?(source) }
966
975
  source.checksum_store.merge!(locked_source.checksum_store)
967
976
  end
968
977
  # If the source is unlockable and the current command allows an unlock of
@@ -983,10 +992,11 @@ module Bundler
983
992
  @missing_lockfile_dep = nil
984
993
  @changed_dependencies = []
985
994
 
986
- current_dependencies.each do |dep|
995
+ @dependencies.each do |dep|
987
996
  if dep.source
988
997
  dep.source = sources.get(dep.source)
989
998
  end
999
+ next unless relevant_deps?(dep)
990
1000
 
991
1001
  name = dep.name
992
1002
 
@@ -1044,6 +1054,8 @@ module Bundler
1044
1054
 
1045
1055
  specs.each do |s|
1046
1056
  name = s.name
1057
+ next if @gems_to_unlock.include?(name)
1058
+
1047
1059
  dep = @dependencies.find {|d| s.satisfies?(d) }
1048
1060
  lockfile_source = s.source
1049
1061
 
@@ -1057,12 +1069,13 @@ module Bundler
1057
1069
 
1058
1070
  # Replace the locked dependency's source with the equivalent source from the Gemfile
1059
1071
  s.source = replacement_source || default_source
1072
+ next if s.source_changed?
1060
1073
 
1061
1074
  source = s.source
1062
1075
  next if @sources_to_unlock.include?(source.name)
1063
1076
 
1064
1077
  # Path sources have special logic
1065
- if source.instance_of?(Source::Path) || source.instance_of?(Source::Gemspec) || (source.instance_of?(Source::Git) && !@gems_to_unlock.include?(name) && deps.include?(dep))
1078
+ if source.is_a?(Source::Path)
1066
1079
  new_spec = source.specs[s].first
1067
1080
  if new_spec
1068
1081
  s.runtime_dependencies.replace(new_spec.runtime_dependencies)
@@ -1090,7 +1103,23 @@ module Bundler
1090
1103
  @source_requirements ||= find_source_requirements
1091
1104
  end
1092
1105
 
1106
+ def preload_git_source_worker
1107
+ @preload_git_source_worker ||= Bundler::Worker.new(5, "Git source preloading", ->(source, _) { source.specs })
1108
+ end
1109
+
1110
+ def preload_git_sources
1111
+ sources.git_sources.each {|source| preload_git_source_worker.enq(source) }
1112
+ ensure
1113
+ preload_git_source_worker.stop
1114
+ end
1115
+
1093
1116
  def find_source_requirements
1117
+ if Gem.ruby_version >= Gem::Version.new("3.3")
1118
+ # Ruby 3.2 has a bug that incorrectly triggers a circular dependency warning. This version will continue to
1119
+ # fetch git repositories one by one.
1120
+ preload_git_sources
1121
+ end
1122
+
1094
1123
  # Record the specs available in each gem's source, so that those
1095
1124
  # specs will be available later when the resolver knows where to
1096
1125
  # look for that gemspec (or its dependencies)
@@ -1142,9 +1171,9 @@ module Bundler
1142
1171
  end
1143
1172
 
1144
1173
  def additional_base_requirements_to_prevent_downgrades(resolution_base)
1145
- return resolution_base unless @locked_gems && !sources.expired_sources?(@locked_gems.sources)
1174
+ return resolution_base unless @locked_gems
1146
1175
  @originally_locked_specs.each do |locked_spec|
1147
- next if locked_spec.source.is_a?(Source::Path)
1176
+ next if locked_spec.source.is_a?(Source::Path) || locked_spec.source_changed?
1148
1177
 
1149
1178
  name = locked_spec.name
1150
1179
  next if @changed_dependencies.include?(name)
@@ -1,69 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative "shared_helpers"
4
- Bundler::SharedHelpers.major_deprecation 2, "Bundler no longer integrates with " \
4
+ Bundler::SharedHelpers.feature_removed! "Bundler no longer integrates with " \
5
5
  "Capistrano, but Capistrano provides its own integration with " \
6
6
  "Bundler via the capistrano-bundler gem. Use it instead."
7
-
8
- module Bundler
9
- class Deployment
10
- def self.define_task(context, task_method = :task, opts = {})
11
- if defined?(Capistrano) && context.is_a?(Capistrano::Configuration)
12
- context_name = "capistrano"
13
- role_default = "{:except => {:no_release => true}}"
14
- error_type = ::Capistrano::CommandError
15
- else
16
- context_name = "vlad"
17
- role_default = "[:app]"
18
- error_type = ::Rake::CommandFailedError
19
- end
20
-
21
- roles = context.fetch(:bundle_roles, false)
22
- opts[:roles] = roles if roles
23
-
24
- context.send :namespace, :bundle do
25
- send :desc, <<-DESC
26
- Install the current Bundler environment. By default, gems will be \
27
- installed to the shared/bundle path. Gems in the development and \
28
- test group will not be installed. The install command is executed \
29
- with the --deployment and --quiet flags. If the bundle cmd cannot \
30
- be found then you can override the bundle_cmd variable to specify \
31
- which one it should use. The base path to the app is fetched from \
32
- the :latest_release variable. Set it for custom deploy layouts.
33
-
34
- You can override any of these defaults by setting the variables shown below.
35
-
36
- N.B. bundle_roles must be defined before you require 'bundler/#{context_name}' \
37
- in your deploy.rb file.
38
-
39
- set :bundle_gemfile, "Gemfile"
40
- set :bundle_dir, File.join(fetch(:shared_path), 'bundle')
41
- set :bundle_flags, "--deployment --quiet"
42
- set :bundle_without, [:development, :test]
43
- set :bundle_with, [:mysql]
44
- set :bundle_cmd, "bundle" # e.g. "/opt/ruby/bin/bundle"
45
- set :bundle_roles, #{role_default} # e.g. [:app, :batch]
46
- DESC
47
- send task_method, :install, opts do
48
- bundle_cmd = context.fetch(:bundle_cmd, "bundle")
49
- bundle_flags = context.fetch(:bundle_flags, "--deployment --quiet")
50
- bundle_dir = context.fetch(:bundle_dir, File.join(context.fetch(:shared_path), "bundle"))
51
- bundle_gemfile = context.fetch(:bundle_gemfile, "Gemfile")
52
- bundle_without = [*context.fetch(:bundle_without, [:development, :test])].compact
53
- bundle_with = [*context.fetch(:bundle_with, [])].compact
54
- app_path = context.fetch(:latest_release)
55
- if app_path.to_s.empty?
56
- raise error_type.new("Cannot detect current release path - make sure you have deployed at least once.")
57
- end
58
- args = ["--gemfile #{File.join(app_path, bundle_gemfile)}"]
59
- args << "--path #{bundle_dir}" unless bundle_dir.to_s.empty?
60
- args << bundle_flags.to_s
61
- args << "--without #{bundle_without.join(" ")}" unless bundle_without.empty?
62
- args << "--with #{bundle_with.join(" ")}" unless bundle_with.empty?
63
-
64
- run "cd #{app_path} && #{bundle_cmd} install #{args.join(" ")}"
65
- end
66
- end
67
- end
68
- end
69
- end
@@ -26,7 +26,7 @@ module Bundler
26
26
  end
27
27
  a, b, c, d, e = *words
28
28
  (16..79).each do |i|
29
- w[i] = SHA1_MASK & rotate((w[i - 3] ^ w[i - 8] ^ w[i - 14] ^ w[i - 16]), 1)
29
+ w[i] = SHA1_MASK & rotate(w[i - 3] ^ w[i - 8] ^ w[i - 14] ^ w[i - 16], 1)
30
30
  end
31
31
  0.upto(79) do |i|
32
32
  case i
@@ -9,8 +9,9 @@ module Bundler
9
9
 
10
10
  def self.evaluate(gemfile, lockfile, unlock)
11
11
  builder = new
12
+ builder.lockfile(lockfile)
12
13
  builder.eval_gemfile(gemfile)
13
- builder.to_definition(lockfile, unlock)
14
+ builder.to_definition(builder.lockfile_path, unlock)
14
15
  end
15
16
 
16
17
  VALID_PLATFORMS = Bundler::CurrentRuby::PLATFORM_MAP.keys.freeze
@@ -38,6 +39,7 @@ module Bundler
38
39
  @gemspecs = []
39
40
  @gemfile = nil
40
41
  @gemfiles = []
42
+ @lockfile = nil
41
43
  add_git_sources
42
44
  end
43
45
 
@@ -101,6 +103,15 @@ module Bundler
101
103
  add_dependency(name, version, options)
102
104
  end
103
105
 
106
+ # For usage in Dsl.evaluate, since lockfile is used as part of the Gemfile.
107
+ def lockfile_path
108
+ @lockfile
109
+ end
110
+
111
+ def lockfile(file)
112
+ @lockfile = file
113
+ end
114
+
104
115
  def source(source, *args, &blk)
105
116
  options = args.last.is_a?(Hash) ? args.pop.dup : {}
106
117
  options = normalize_hash(options)
@@ -175,6 +186,7 @@ module Bundler
175
186
 
176
187
  def to_definition(lockfile, unlock)
177
188
  check_primary_source_safety
189
+ lockfile = @lockfile unless @lockfile.nil?
178
190
  Definition.new(lockfile, @dependencies, @sources, unlock, @ruby_version, @optional_groups, @gemfiles)
179
191
  end
180
192
 
@@ -411,7 +423,13 @@ module Bundler
411
423
  next if VALID_PLATFORMS.include?(p)
412
424
  raise GemfileError, "`#{p}` is not a valid platform. The available options are: #{VALID_PLATFORMS.inspect}"
413
425
  end
414
- deprecate_legacy_windows_platforms(platforms)
426
+
427
+ windows_platforms = platforms.select {|pl| pl.to_s.match?(/mingw|mswin/) }
428
+ if windows_platforms.any?
429
+ windows_platforms = windows_platforms.map! {|pl| ":#{pl}" }.join(", ")
430
+ deprecated_message = "Platform #{windows_platforms} will be removed in the future. Please use platform :windows instead."
431
+ Bundler::SharedHelpers.feature_deprecated! deprecated_message
432
+ end
415
433
 
416
434
  # Save sources passed in a key
417
435
  if opts.key?("source")
@@ -477,14 +495,10 @@ module Bundler
477
495
  def normalize_source(source)
478
496
  case source
479
497
  when :gemcutter, :rubygems, :rubyforge
480
- message =
481
- "The source :#{source} is deprecated because HTTP requests are insecure.\n" \
482
- "Please change your source to 'https://rubygems.org' if possible, or 'http://rubygems.org' if not."
483
498
  removed_message =
484
499
  "The source :#{source} is disallowed because HTTP requests are insecure.\n" \
485
500
  "Please change your source to 'https://rubygems.org' if possible, or 'http://rubygems.org' if not."
486
- Bundler::SharedHelpers.major_deprecation 2, message, removed_message: removed_message
487
- "http://rubygems.org"
501
+ Bundler::SharedHelpers.feature_removed! removed_message
488
502
  when String
489
503
  source
490
504
  else
@@ -492,16 +506,6 @@ module Bundler
492
506
  end
493
507
  end
494
508
 
495
- def deprecate_legacy_windows_platforms(platforms)
496
- windows_platforms = platforms.select {|pl| pl.to_s.match?(/mingw|mswin/) }
497
- return if windows_platforms.empty?
498
-
499
- windows_platforms = windows_platforms.map! {|pl| ":#{pl}" }.join(", ")
500
- message = "Platform #{windows_platforms} is deprecated. Please use platform :windows instead."
501
- removed_message = "Platform #{windows_platforms} has been removed. Please use platform :windows instead."
502
- Bundler::SharedHelpers.major_deprecation 2, message, removed_message: removed_message
503
- end
504
-
505
509
  def check_path_source_safety
506
510
  return if @sources.global_path_source.nil?
507
511
 
@@ -513,7 +517,7 @@ module Bundler
513
517
  " gem 'rails'\n" \
514
518
  " end\n\n"
515
519
 
516
- SharedHelpers.major_deprecation(2, msg.strip)
520
+ SharedHelpers.feature_removed! msg.strip
517
521
  end
518
522
 
519
523
  def check_rubygems_source_safety
@@ -521,24 +525,10 @@ module Bundler
521
525
  end
522
526
 
523
527
  def multiple_global_source_warning
524
- if Bundler.feature_flag.bundler_4_mode?
525
- msg = "This Gemfile contains multiple global sources. " \
526
- "Each source after the first must include a block to indicate which gems " \
527
- "should come from that source"
528
- raise GemfileEvalError, msg
529
- else
530
- message =
531
- "Your Gemfile contains multiple global sources. " \
532
- "Using `source` more than once without a block is a security risk, and " \
533
- "may result in installing unexpected gems. To resolve this warning, use " \
534
- "a block to indicate which gems should come from the secondary source."
535
- removed_message =
536
- "Your Gemfile contains multiple global sources. " \
537
- "Using `source` more than once without a block is a security risk, and " \
538
- "may result in installing unexpected gems. To resolve this error, use " \
539
- "a block to indicate which gems should come from the secondary source."
540
- Bundler::SharedHelpers.major_deprecation 2, message, removed_message: removed_message
541
- end
528
+ msg = "This Gemfile contains multiple global sources. " \
529
+ "Each source after the first must include a block to indicate which gems " \
530
+ "should come from that source"
531
+ raise GemfileEvalError, msg
542
532
  end
543
533
 
544
534
  class DSLError < GemfileError
@@ -60,28 +60,6 @@ module Bundler
60
60
  end
61
61
  end
62
62
 
63
- # needed for binstubs
64
- def executables
65
- if @remote_specification
66
- @remote_specification.executables
67
- elsif _local_specification
68
- _local_specification.executables
69
- else
70
- super
71
- end
72
- end
73
-
74
- # needed for bundle clean
75
- def bindir
76
- if @remote_specification
77
- @remote_specification.bindir
78
- elsif _local_specification
79
- _local_specification.bindir
80
- else
81
- super
82
- end
83
- end
84
-
85
63
  # needed for post_install_messages during install
86
64
  def post_install_message
87
65
  if @remote_specification
@@ -6,6 +6,7 @@ module Bundler
6
6
  BUNDLER_KEYS = %w[
7
7
  BUNDLE_BIN_PATH
8
8
  BUNDLE_GEMFILE
9
+ BUNDLE_LOCKFILE
9
10
  BUNDLER_VERSION
10
11
  BUNDLER_SETUP
11
12
  GEM_HOME
@@ -25,6 +25,7 @@ module Bundler
25
25
 
26
26
  class GemNotFound < BundlerError; status_code(7); end
27
27
  class InstallHookError < BundlerError; status_code(8); end
28
+ class RemovedError < BundlerError; status_code(9); end
28
29
  class GemfileNotFound < BundlerError; status_code(10); end
29
30
  class GitError < BundlerError; status_code(11); end
30
31
  class DeprecatedError < BundlerError; status_code(12); end
@@ -76,11 +77,6 @@ module Bundler
76
77
  def mismatch_resolution_instructions
77
78
  removable, remote = [@existing, @checksum].partition(&:removable?)
78
79
  case removable.size
79
- when 0
80
- msg = +"Mismatched checksums each have an authoritative source:\n"
81
- msg << " 1. #{@existing.sources.reject(&:removable?).map(&:to_s).join(" and ")}\n"
82
- msg << " 2. #{@checksum.sources.reject(&:removable?).map(&:to_s).join(" and ")}\n"
83
- msg << "You may need to alter your Gemfile sources to resolve this issue.\n"
84
80
  when 1
85
81
  msg = +"If you trust #{remote.first.sources.first}, to resolve this issue you can:\n"
86
82
  msg << removable.first.removal_instructions
@@ -2,41 +2,8 @@
2
2
 
3
3
  module Bundler
4
4
  class FeatureFlag
5
- def self.settings_flag(flag, &default)
6
- unless Bundler::Settings::BOOL_KEYS.include?(flag.to_s)
7
- raise "Cannot use `#{flag}` as a settings feature flag since it isn't a bool key"
8
- end
9
-
10
- settings_method("#{flag}?", flag, &default)
11
- end
12
- private_class_method :settings_flag
13
-
14
- def self.settings_option(key, &default)
15
- settings_method(key, key, &default)
16
- end
17
- private_class_method :settings_option
18
-
19
- def self.settings_method(name, key, &default)
20
- define_method(name) do
21
- value = Bundler.settings[key]
22
- value = instance_eval(&default) if value.nil?
23
- value
24
- end
25
- end
26
- private_class_method :settings_method
27
-
28
5
  (1..10).each {|v| define_method("bundler_#{v}_mode?") { @major_version >= v } }
29
6
 
30
- settings_flag(:allow_offline_install) { bundler_4_mode? }
31
- settings_flag(:cache_all) { bundler_4_mode? }
32
- settings_flag(:forget_cli_options) { bundler_4_mode? }
33
- settings_flag(:global_gem_cache) { bundler_5_mode? }
34
- settings_flag(:lockfile_checksums) { bundler_4_mode? }
35
- settings_flag(:plugins) { @bundler_version >= Gem::Version.new("1.14") }
36
- settings_flag(:update_requires_all_flag) { bundler_5_mode? }
37
-
38
- settings_option(:default_cli_command) { bundler_4_mode? ? :cli_help : :install }
39
-
40
7
  def removed_major?(target_major_version)
41
8
  @major_version > target_major_version
42
9
  end
@@ -110,7 +110,7 @@ module Bundler
110
110
  def call(path, headers)
111
111
  fetcher.downloader.fetch(fetcher.fetch_uri + path, headers)
112
112
  rescue NetworkDownError => e
113
- raise unless Bundler.feature_flag.allow_offline_install? && headers["If-None-Match"]
113
+ raise unless headers["If-None-Match"]
114
114
  ui.warn "Using the cached data for the new index because of a network error: #{e}"
115
115
  Gem::Net::HTTPNotModified.new(nil, nil, nil)
116
116
  end
@@ -104,12 +104,12 @@ module Bundler
104
104
  message = message.split("-").first if exception.is_a?(Errno)
105
105
  require "cgi/escape"
106
106
  require "cgi/util" unless defined?(CGI::EscapeExt)
107
- "https://github.com/rubygems/rubygems/search?q=" \
107
+ "https://github.com/ruby/rubygems/search?q=" \
108
108
  "#{CGI.escape(message)}&type=Issues"
109
109
  end
110
110
 
111
111
  def new_issue_url
112
- "https://github.com/rubygems/rubygems/issues/new?labels=Bundler&template=bundler-related-issue.md"
112
+ "https://github.com/ruby/rubygems/issues/new?labels=Bundler&template=bundler-related-issue.md"
113
113
  end
114
114
  end
115
115
 
@@ -46,13 +46,6 @@ module Bundler
46
46
  true
47
47
  end
48
48
 
49
- def search_all(name, &blk)
50
- return enum_for(:search_all, name) unless blk
51
- specs_by_name(name).each(&blk)
52
- @duplicates[name]&.each(&blk)
53
- @sources.each {|source| source.search_all(name, &blk) }
54
- end
55
-
56
49
  # Search this index's specs, and any source indexes that this index knows
57
50
  # about, returning all of the results.
58
51
  def search(query)
@@ -44,14 +44,16 @@ def gemfile(force_latest_compatible = false, options = {}, &gemfile)
44
44
  raise ArgumentError, "Unknown options: #{opts.keys.join(", ")}" unless opts.empty?
45
45
 
46
46
  old_gemfile = ENV["BUNDLE_GEMFILE"]
47
+ old_lockfile = ENV["BUNDLE_LOCKFILE"]
47
48
 
48
49
  Bundler.unbundle_env!
49
50
 
50
51
  begin
51
52
  Bundler.instance_variable_set(:@bundle_path, Pathname.new(Gem.dir))
52
53
  Bundler::SharedHelpers.set_env "BUNDLE_GEMFILE", "Gemfile"
54
+ Bundler::SharedHelpers.set_env "BUNDLE_LOCKFILE", "Gemfile.lock"
53
55
 
54
- Bundler::Plugin.gemfile_install(&gemfile) if Bundler.feature_flag.plugins?
56
+ Bundler::Plugin.gemfile_install(&gemfile) if Bundler.settings[:plugins]
55
57
  builder = Bundler::Dsl.new
56
58
  builder.instance_eval(&gemfile)
57
59
 
@@ -94,5 +96,11 @@ def gemfile(force_latest_compatible = false, options = {}, &gemfile)
94
96
  else
95
97
  ENV["BUNDLE_GEMFILE"] = ""
96
98
  end
99
+
100
+ if old_lockfile
101
+ ENV["BUNDLE_LOCKFILE"] = old_lockfile
102
+ else
103
+ ENV["BUNDLE_LOCKFILE"] = ""
104
+ end
97
105
  end
98
106
  end
@@ -16,7 +16,6 @@ module Bundler
16
16
  def install_from_spec
17
17
  post_install_message = install
18
18
  Bundler.ui.debug "#{worker}: #{spec.name} (#{spec.version}) from #{spec.loaded_from}"
19
- generate_executable_stubs
20
19
  [true, post_install_message]
21
20
  rescue Bundler::InstallHookError, Bundler::SecurityError, Bundler::APIResponseMismatchError, Bundler::InsecureInstallPathError
22
21
  raise
@@ -71,15 +70,5 @@ module Bundler
71
70
  def out_of_space_message
72
71
  "#{install_error_message}\nYour disk is out of space. Free some space to be able to install your bundle."
73
72
  end
74
-
75
- def generate_executable_stubs
76
- return if Bundler.feature_flag.forget_cli_options?
77
- return if Bundler.settings[:inline]
78
- if Bundler.settings[:bin] && standalone
79
- installer.generate_standalone_bundler_executable_stubs(spec)
80
- elsif Bundler.settings[:bin]
81
- installer.generate_bundler_executable_stubs(spec, force: true)
82
- end
83
- end
84
73
  end
85
74
  end
@@ -7,12 +7,6 @@ require_relative "installer/gem_installer"
7
7
 
8
8
  module Bundler
9
9
  class Installer
10
- class << self
11
- attr_accessor :ambiguous_gems
12
-
13
- Installer.ambiguous_gems = []
14
- end
15
-
16
10
  attr_reader :post_install_messages, :definition
17
11
 
18
12
  # Begins the installation process for Bundler.
@@ -95,7 +95,7 @@ module Bundler
95
95
  out << " #{key}: #{val}\n"
96
96
  end
97
97
  when String
98
- out << " #{value}\n"
98
+ out << " #{value}\n"
99
99
  else
100
100
  raise ArgumentError, "#{value.inspect} can't be serialized in a lockfile"
101
101
  end