bundler 2.2.32 → 2.3.2

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 (106) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +70 -0
  3. data/exe/bundle +7 -8
  4. data/lib/bundler/.document +1 -0
  5. data/lib/bundler/build_metadata.rb +2 -2
  6. data/lib/bundler/cli/doctor.rb +3 -2
  7. data/lib/bundler/cli/gem.rb +2 -1
  8. data/lib/bundler/cli/info.rb +6 -1
  9. data/lib/bundler/cli/install.rb +2 -0
  10. data/lib/bundler/cli/update.rb +2 -2
  11. data/lib/bundler/cli.rb +6 -0
  12. data/lib/bundler/compact_index_client/updater.rb +0 -5
  13. data/lib/bundler/definition.rb +29 -53
  14. data/lib/bundler/dependency.rb +5 -7
  15. data/lib/bundler/dsl.rb +18 -30
  16. data/lib/bundler/endpoint_specification.rb +0 -8
  17. data/lib/bundler/environment_preserver.rb +4 -1
  18. data/lib/bundler/fetcher/compact_index.rb +9 -4
  19. data/lib/bundler/fetcher.rb +2 -5
  20. data/lib/bundler/injector.rb +10 -1
  21. data/lib/bundler/installer/gem_installer.rb +1 -6
  22. data/lib/bundler/installer.rb +1 -4
  23. data/lib/bundler/lazy_specification.rb +17 -1
  24. data/lib/bundler/lockfile_parser.rb +10 -13
  25. data/lib/bundler/man/bundle-add.1 +10 -2
  26. data/lib/bundler/man/bundle-add.1.ronn +7 -1
  27. data/lib/bundler/man/bundle-binstubs.1 +1 -1
  28. data/lib/bundler/man/bundle-cache.1 +1 -1
  29. data/lib/bundler/man/bundle-check.1 +1 -1
  30. data/lib/bundler/man/bundle-clean.1 +1 -1
  31. data/lib/bundler/man/bundle-config.1 +3 -3
  32. data/lib/bundler/man/bundle-config.1.ronn +3 -3
  33. data/lib/bundler/man/bundle-doctor.1 +1 -1
  34. data/lib/bundler/man/bundle-exec.1 +1 -1
  35. data/lib/bundler/man/bundle-gem.1 +1 -1
  36. data/lib/bundler/man/bundle-info.1 +1 -1
  37. data/lib/bundler/man/bundle-init.1 +1 -1
  38. data/lib/bundler/man/bundle-inject.1 +1 -1
  39. data/lib/bundler/man/bundle-install.1 +2 -2
  40. data/lib/bundler/man/bundle-install.1.ronn +2 -2
  41. data/lib/bundler/man/bundle-list.1 +1 -1
  42. data/lib/bundler/man/bundle-lock.1 +1 -1
  43. data/lib/bundler/man/bundle-open.1 +1 -1
  44. data/lib/bundler/man/bundle-outdated.1 +1 -1
  45. data/lib/bundler/man/bundle-platform.1 +1 -1
  46. data/lib/bundler/man/bundle-pristine.1 +1 -1
  47. data/lib/bundler/man/bundle-remove.1 +1 -1
  48. data/lib/bundler/man/bundle-show.1 +1 -1
  49. data/lib/bundler/man/bundle-update.1 +2 -2
  50. data/lib/bundler/man/bundle-update.1.ronn +2 -1
  51. data/lib/bundler/man/bundle-viz.1 +1 -1
  52. data/lib/bundler/man/bundle.1 +1 -1
  53. data/lib/bundler/man/gemfile.5 +28 -2
  54. data/lib/bundler/man/gemfile.5.ronn +9 -1
  55. data/lib/bundler/plugin/api/source.rb +1 -0
  56. data/lib/bundler/plugin/installer.rb +1 -1
  57. data/lib/bundler/process_lock.rb +1 -1
  58. data/lib/bundler/psyched_yaml.rb +1 -13
  59. data/lib/bundler/resolver.rb +34 -31
  60. data/lib/bundler/rubygems_ext.rb +2 -0
  61. data/lib/bundler/rubygems_gem_installer.rb +1 -1
  62. data/lib/bundler/rubygems_integration.rb +11 -48
  63. data/lib/bundler/self_manager.rb +76 -0
  64. data/lib/bundler/shared_helpers.rb +4 -12
  65. data/lib/bundler/source/git/git_proxy.rb +2 -2
  66. data/lib/bundler/source/metadata.rb +1 -1
  67. data/lib/bundler/source/rubygems.rb +16 -12
  68. data/lib/bundler/source/rubygems_aggregate.rb +1 -1
  69. data/lib/bundler/source.rb +1 -1
  70. data/lib/bundler/source_list.rb +7 -29
  71. data/lib/bundler/templates/Executable.bundler +1 -1
  72. data/lib/bundler/templates/Gemfile +0 -2
  73. data/lib/bundler/templates/gems.rb +0 -3
  74. data/lib/bundler/templates/newgem/Rakefile.tt +10 -1
  75. data/lib/bundler/templates/newgem/github/workflows/main.yml.tt +2 -2
  76. data/lib/bundler/templates/newgem/newgem.gemspec.tt +1 -1
  77. data/lib/bundler/templates/newgem/sig/newgem.rbs.tt +8 -0
  78. data/lib/bundler/templates/newgem/test/minitest/{newgem_test.rb.tt → test_newgem.rb.tt} +1 -1
  79. data/lib/bundler/ui/shell.rb +1 -1
  80. data/lib/bundler/vendor/.document +1 -0
  81. data/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +6 -6
  82. data/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb +5 -3
  83. data/lib/bundler/vendor/thor/lib/thor/actions.rb +6 -2
  84. data/lib/bundler/vendor/thor/lib/thor/core_ext/hash_with_indifferent_access.rb +6 -0
  85. data/lib/bundler/vendor/thor/lib/thor/error.rb +9 -4
  86. data/lib/bundler/vendor/thor/lib/thor/parser/options.rb +19 -1
  87. data/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +22 -4
  88. data/lib/bundler/vendor/thor/lib/thor/shell.rb +1 -1
  89. data/lib/bundler/vendor/thor/lib/thor/util.rb +1 -1
  90. data/lib/bundler/vendor/uri/lib/uri/common.rb +17 -80
  91. data/lib/bundler/vendor/uri/lib/uri/ftp.rb +0 -1
  92. data/lib/bundler/vendor/uri/lib/uri/generic.rb +5 -6
  93. data/lib/bundler/vendor/uri/lib/uri/http.rb +0 -1
  94. data/lib/bundler/vendor/uri/lib/uri/https.rb +0 -1
  95. data/lib/bundler/vendor/uri/lib/uri/ldap.rb +1 -1
  96. data/lib/bundler/vendor/uri/lib/uri/mailto.rb +0 -1
  97. data/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb +1 -14
  98. data/lib/bundler/vendor/uri/lib/uri/rfc3986_parser.rb +1 -12
  99. data/lib/bundler/vendor/uri/lib/uri/version.rb +1 -1
  100. data/lib/bundler/vendor/uri/lib/uri/ws.rb +84 -0
  101. data/lib/bundler/vendor/uri/lib/uri/wss.rb +22 -0
  102. data/lib/bundler/vendor/uri/lib/uri.rb +0 -1
  103. data/lib/bundler/version.rb +1 -1
  104. data/lib/bundler.rb +9 -3
  105. metadata +10 -5
  106. data/lib/bundler/gemdeps.rb +0 -29
@@ -30,10 +30,8 @@ module Bundler
30
30
  @resolver = Molinillo::Resolver.new(self, self)
31
31
  @search_for = {}
32
32
  @base_dg = Molinillo::DependencyGraph.new
33
- aggregate_global_source = @source_requirements[:default].is_a?(Source::RubygemsAggregate)
34
33
  @base.each do |ls|
35
34
  dep = Dependency.new(ls.name, ls.version)
36
- ls.source = source_for(ls.name) unless aggregate_global_source
37
35
  @base_dg.add_vertex(ls.name, DepProxy.get_proxy(dep, ls.platform), true)
38
36
  end
39
37
  additional_base_requirements.each {|d| @base_dg.add_vertex(d.name, d) }
@@ -136,6 +134,7 @@ module Bundler
136
134
  end
137
135
  nested.reduce([]) do |groups, (version, specs)|
138
136
  next groups if locked_requirement && !locked_requirement.satisfied_by?(version)
137
+ next groups unless specs.any? {|spec| spec.match_platform(platform) }
139
138
 
140
139
  specs_by_platform = Hash.new do |current_specs, current_platform|
141
140
  current_specs[current_platform] = select_best_platform_match(specs, current_platform)
@@ -147,7 +146,7 @@ module Bundler
147
146
  next groups if @resolving_only_for_ruby
148
147
 
149
148
  spec_group = SpecGroup.create_for(specs_by_platform, @platforms, platform)
150
- groups << spec_group if spec_group
149
+ groups << spec_group
151
150
 
152
151
  groups
153
152
  end
@@ -264,30 +263,37 @@ module Bundler
264
263
  "If you are updating multiple gems in your Gemfile at once,\n" \
265
264
  "try passing them all to `bundle update`"
266
265
  else
267
- source = source_for(name)
268
- specs = source.specs.search(name)
269
- versions_with_platforms = specs.map {|s| [s.version, s.platform] }
270
- cache_message = begin
271
- " or in gems cached in #{Bundler.settings.app_cache_path}" if Bundler.app_cache.exist?
272
- rescue GemfileNotFound
273
- nil
274
- end
275
- message = String.new("Could not find gem '#{SharedHelpers.pretty_dependency(requirement)}' in #{source.to_err}#{cache_message}.\n")
276
- message << "The source contains the following versions of '#{name}': #{formatted_versions_with_platforms(versions_with_platforms)}" if versions_with_platforms.any?
266
+ message = gem_not_found_message(name, requirement, source_for(name))
277
267
  end
278
268
  raise GemNotFound, message
279
269
  end
280
270
  end
281
271
 
282
- def formatted_versions_with_platforms(versions_with_platforms)
283
- version_platform_strs = versions_with_platforms.map do |vwp|
284
- version = vwp.first
285
- platform = vwp.last
286
- version_platform_str = String.new(version.to_s)
287
- version_platform_str << " #{platform}" unless platform.nil? || platform == Gem::Platform::RUBY
288
- version_platform_str
272
+ def gem_not_found_message(name, requirement, source, extra_message = "")
273
+ specs = source.specs.search(name)
274
+ matching_part = name
275
+ requirement_label = SharedHelpers.pretty_dependency(requirement)
276
+ cache_message = begin
277
+ " or in gems cached in #{Bundler.settings.app_cache_path}" if Bundler.app_cache.exist?
278
+ rescue GemfileNotFound
279
+ nil
280
+ end
281
+ specs_matching_requirement = specs.select {| spec| requirement.matches_spec?(spec) }
282
+
283
+ if specs_matching_requirement.any?
284
+ specs = specs_matching_requirement
285
+ matching_part = requirement_label
286
+ requirement_label = "#{requirement_label} #{requirement.__platform}"
289
287
  end
290
- version_platform_strs.join(", ")
288
+
289
+ message = String.new("Could not find gem '#{requirement_label}'#{extra_message} in #{source}#{cache_message}.\n")
290
+
291
+ if specs.any?
292
+ message << "\nThe source contains the following gems matching '#{matching_part}':\n"
293
+ message << specs.map {|s| " * #{s.full_name}" }.join("\n")
294
+ end
295
+
296
+ message
291
297
  end
292
298
 
293
299
  def version_conflict_message(e)
@@ -359,19 +365,16 @@ module Bundler
359
365
 
360
366
  metadata_requirement = name.end_with?("\0")
361
367
 
362
- o << "Could not find gem '" unless metadata_requirement
363
- o << SharedHelpers.pretty_dependency(conflict.requirement)
364
- o << "'" unless metadata_requirement
365
- if conflict.requirement_trees.first.size > 1
366
- o << ", which is required by "
367
- o << "gem '#{SharedHelpers.pretty_dependency(conflict.requirement_trees.first[-2])}',"
368
+ extra_message = if conflict.requirement_trees.first.size > 1
369
+ ", which is required by gem '#{SharedHelpers.pretty_dependency(conflict.requirement_trees.first[-2])}',"
370
+ else
371
+ ""
368
372
  end
369
- o << " "
370
373
 
371
- o << if metadata_requirement
372
- "is not available in #{relevant_source}"
374
+ if metadata_requirement
375
+ o << "#{SharedHelpers.pretty_dependency(conflict.requirement)}#{extra_message} is not available in #{relevant_source}"
373
376
  else
374
- "in #{relevant_source.to_err}.\n"
377
+ o << gem_not_found_message(name, conflict.requirement, relevant_source, extra_message)
375
378
  end
376
379
  end
377
380
  end,
@@ -138,6 +138,8 @@ module Gem
138
138
  class Requirement
139
139
  module OrderIndependentComparison
140
140
  def ==(other)
141
+ return unless Gem::Requirement === other
142
+
141
143
  if _requirements_sorted? && other._requirements_sorted?
142
144
  super
143
145
  else
@@ -67,7 +67,7 @@ module Bundler
67
67
  def build_extensions
68
68
  extension_cache_path = options[:bundler_extension_cache_path]
69
69
  unless extension_cache_path && extension_dir = spec.extension_dir
70
- require "shellwords" # compensate missing require in rubygems before version 3.2.25
70
+ require "shellwords" unless Bundler.rubygems.provides?(">= 3.2.25")
71
71
  return super
72
72
  end
73
73
 
@@ -12,25 +12,21 @@ module Bundler
12
12
  EXT_LOCK = Monitor.new
13
13
  end
14
14
 
15
- def self.version
16
- @version ||= Gem::Version.new(Gem::VERSION)
17
- end
18
-
19
- def self.provides?(req_str)
20
- Gem::Requirement.new(req_str).satisfied_by?(version)
21
- end
22
-
23
15
  def initialize
24
16
  @replaced_methods = {}
25
17
  backport_ext_builder_monitor
26
18
  end
27
19
 
28
20
  def version
29
- self.class.version
21
+ @version ||= Gem.rubygems_version
30
22
  end
31
23
 
32
24
  def provides?(req_str)
33
- self.class.provides?(req_str)
25
+ Gem::Requirement.new(req_str).satisfied_by?(version)
26
+ end
27
+
28
+ def supports_bundler_trampolining?
29
+ provides?(">= 3.3.0.a")
34
30
  end
35
31
 
36
32
  def build_args
@@ -115,7 +111,7 @@ module Bundler
115
111
  Bundler.ui.error "#{e.class}: #{e.message}"
116
112
  Bundler.ui.trace e
117
113
  raise
118
- rescue YamlLibrarySyntaxError => e
114
+ rescue ::Psych::SyntaxError => e
119
115
  raise YamlSyntaxError.new(e, "Your RubyGems configuration, which is " \
120
116
  "usually located in ~/.gemrc, contains invalid YAML syntax.")
121
117
  end
@@ -142,19 +138,6 @@ module Bundler
142
138
  end
143
139
  end
144
140
 
145
- def sources=(val)
146
- # Gem.configuration creates a new Gem::ConfigFile, which by default will read ~/.gemrc
147
- # If that file exists, its settings (including sources) will overwrite the values we
148
- # are about to set here. In order to avoid that, we force memoizing the config file now.
149
- configuration
150
-
151
- Gem.sources = val
152
- end
153
-
154
- def sources
155
- Gem.sources
156
- end
157
-
158
141
  def gem_dir
159
142
  Gem.dir
160
143
  end
@@ -232,18 +215,6 @@ module Bundler
232
215
  EXT_LOCK
233
216
  end
234
217
 
235
- def with_build_args(args)
236
- ext_lock.synchronize do
237
- old_args = build_args
238
- begin
239
- self.build_args = args
240
- yield
241
- ensure
242
- self.build_args = old_args
243
- end
244
- end
245
- end
246
-
247
218
  def spec_from_gem(path, policy = nil)
248
219
  require "rubygems/security"
249
220
  require_relative "psyched_yaml"
@@ -571,10 +542,6 @@ module Bundler
571
542
  Gem::REPOSITORY_SUBDIRECTORIES
572
543
  end
573
544
 
574
- def install_with_build_args(args)
575
- yield
576
- end
577
-
578
545
  def path_separator
579
546
  Gem.path_separator
580
547
  end
@@ -604,6 +571,10 @@ module Bundler
604
571
  end
605
572
  end
606
573
 
574
+ def find_bundler(version)
575
+ find_name("bundler").find {|s| s.version.to_s == version }
576
+ end
577
+
607
578
  def find_name(name)
608
579
  Gem::Specification.stubs_for(name).map(&:to_spec)
609
580
  end
@@ -617,14 +588,6 @@ module Bundler
617
588
  Gem::Specification.send(:default_stubs, "*.gemspec")
618
589
  end
619
590
  end
620
-
621
- def use_gemdeps(gemfile)
622
- ENV["BUNDLE_GEMFILE"] ||= File.expand_path(gemfile)
623
- require_relative "gemdeps"
624
- runtime = Bundler.setup
625
- activated_spec_names = runtime.requested_specs.map(&:to_spec).sort_by(&:name)
626
- [Gemdeps.new(runtime), activated_spec_names]
627
- end
628
591
  end
629
592
 
630
593
  def self.rubygems
@@ -0,0 +1,76 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bundler
4
+ #
5
+ # This class handles installing and switching to the version of bundler needed
6
+ # by an application.
7
+ #
8
+ class SelfManager
9
+ def restart_with_locked_bundler_if_needed
10
+ return unless needs_switching? && installed?
11
+
12
+ restart_with_locked_bundler
13
+ end
14
+
15
+ def install_locked_bundler_and_restart_with_it_if_needed
16
+ return unless needs_switching?
17
+
18
+ Bundler.ui.info \
19
+ "Bundler #{current_version} is running, but your lockfile was generated with #{lockfile_version}. " \
20
+ "Installing Bundler #{lockfile_version} and restarting using that version."
21
+
22
+ install_and_restart_with_locked_bundler
23
+ end
24
+
25
+ private
26
+
27
+ def install_and_restart_with_locked_bundler
28
+ bundler_dep = Gem::Dependency.new("bundler", lockfile_version)
29
+
30
+ Gem.install(bundler_dep)
31
+ rescue StandardError => e
32
+ Bundler.ui.trace e
33
+ Bundler.ui.warn "There was an error installing the locked bundler version (#{lockfile_version}), rerun with the `--verbose` flag for more details. Going on using bundler #{current_version}."
34
+ else
35
+ restart_with_locked_bundler
36
+ end
37
+
38
+ def restart_with_locked_bundler
39
+ configured_gem_home = ENV["GEM_HOME"]
40
+ configured_gem_path = ENV["GEM_PATH"]
41
+
42
+ cmd = [$PROGRAM_NAME, *ARGV]
43
+ cmd.unshift(Gem.ruby) unless File.executable?($PROGRAM_NAME)
44
+
45
+ Bundler.with_original_env do
46
+ Kernel.exec(
47
+ { "GEM_HOME" => configured_gem_home, "GEM_PATH" => configured_gem_path, "BUNDLER_VERSION" => lockfile_version },
48
+ *cmd
49
+ )
50
+ end
51
+ end
52
+
53
+ def needs_switching?
54
+ ENV["BUNDLER_VERSION"].nil? &&
55
+ Bundler.rubygems.supports_bundler_trampolining? &&
56
+ SharedHelpers.in_bundle? &&
57
+ lockfile_version &&
58
+ !lockfile_version.end_with?(".dev") &&
59
+ lockfile_version != current_version
60
+ end
61
+
62
+ def installed?
63
+ Bundler.configure
64
+
65
+ Bundler.rubygems.find_bundler(lockfile_version)
66
+ end
67
+
68
+ def current_version
69
+ @current_version ||= Bundler::VERSION
70
+ end
71
+
72
+ def lockfile_version
73
+ @lockfile_version ||= Bundler::LockfileParser.bundled_with
74
+ end
75
+ end
76
+ end
@@ -109,7 +109,7 @@ module Bundler
109
109
  raise VirtualProtocolError.new
110
110
  rescue Errno::ENOSPC
111
111
  raise NoSpaceOnDeviceError.new(path, action)
112
- rescue *[const_get_safely(:ENOTSUP, Errno)].compact
112
+ rescue Errno::ENOTSUP
113
113
  raise OperationNotSupportedError.new(path, action)
114
114
  rescue Errno::EEXIST, Errno::ENOENT
115
115
  raise
@@ -117,13 +117,6 @@ module Bundler
117
117
  raise GenericSystemCallError.new(e, "There was an error accessing `#{path}`.")
118
118
  end
119
119
 
120
- def const_get_safely(constant_name, namespace)
121
- const_in_namespace = namespace.constants.include?(constant_name.to_s) ||
122
- namespace.constants.include?(constant_name.to_sym)
123
- return nil unless const_in_namespace
124
- namespace.const_get(constant_name)
125
- end
126
-
127
120
  def major_deprecation(major_version, message, print_caller_location: false)
128
121
  if print_caller_location
129
122
  caller_location = caller_locations(2, 2).first
@@ -246,7 +239,7 @@ module Bundler
246
239
  current = File.expand_path(SharedHelpers.pwd).tap{|x| x.untaint if RUBY_VERSION < "2.7" }
247
240
 
248
241
  until !File.directory?(current) || current == previous
249
- if ENV["BUNDLE_SPEC_RUN"]
242
+ if ENV["BUNDLER_SPEC_RUN"]
250
243
  # avoid stepping above the tmp directory when testing
251
244
  gemspec = if ENV["GEM_COMMAND"]
252
245
  # for Ruby Core
@@ -320,12 +313,11 @@ module Bundler
320
313
  end
321
314
 
322
315
  def clean_load_path
323
- bundler_lib = bundler_ruby_lib
324
-
325
316
  loaded_gem_paths = Bundler.rubygems.loaded_gem_paths
326
317
 
327
318
  $LOAD_PATH.reject! do |p|
328
- next if resolve_path(p).start_with?(bundler_lib)
319
+ resolved_path = resolve_path(p)
320
+ next if $LOADED_FEATURES.any? {|lf| lf.start_with?(resolved_path) }
329
321
  loaded_gem_paths.delete(p)
330
322
  end
331
323
  $LOAD_PATH.uniq!
@@ -95,12 +95,12 @@ module Bundler
95
95
  SharedHelpers.filesystem_access(path.dirname) do |p|
96
96
  FileUtils.mkdir_p(p)
97
97
  end
98
- git_retry "clone", configured_uri, path.to_s, "--bare", "--no-hardlinks", "--quiet"
98
+ git_retry "clone", "--bare", "--no-hardlinks", "--quiet", "--", configured_uri, path.to_s
99
99
  return unless extra_ref
100
100
  end
101
101
 
102
102
  with_path do
103
- git_retry(*["fetch", "--force", "--quiet", "--tags", configured_uri, "refs/heads/*:refs/heads/*", extra_ref].compact, :dir => path)
103
+ git_retry(*["fetch", "--force", "--quiet", "--tags", "--", configured_uri, "refs/heads/*:refs/heads/*", extra_ref].compact, :dir => path)
104
104
  end
105
105
  end
106
106
 
@@ -25,7 +25,7 @@ module Bundler
25
25
  s.loaded_from = File.expand_path("..", __FILE__)
26
26
  end
27
27
 
28
- if local_spec = Bundler.rubygems.find_name("bundler").find {|s| s.version.to_s == VERSION }
28
+ if local_spec = Bundler.rubygems.find_bundler(VERSION)
29
29
  idx << local_spec
30
30
  end
31
31
 
@@ -98,26 +98,30 @@ module Bundler
98
98
  out << " specs:\n"
99
99
  end
100
100
 
101
- def to_err
101
+ def to_s
102
102
  if remotes.empty?
103
103
  "locally installed gems"
104
- elsif @allow_remote
104
+ elsif @allow_remote && @allow_cached && @allow_local
105
+ "rubygems repository #{remote_names}, cached gems or installed locally"
106
+ elsif @allow_remote && @allow_local
105
107
  "rubygems repository #{remote_names} or installed locally"
106
- elsif @allow_cached
107
- "cached gems from rubygems repository #{remote_names} or installed locally"
108
+ elsif @allow_remote
109
+ "rubygems repository #{remote_names}"
110
+ elsif @allow_cached && @allow_local
111
+ "cached gems or installed locally"
108
112
  else
109
113
  "locally installed gems"
110
114
  end
111
115
  end
112
116
 
113
- def to_s
117
+ def identifier
114
118
  if remotes.empty?
115
119
  "locally installed gems"
116
120
  else
117
- "rubygems repository #{remote_names} or installed locally"
121
+ "rubygems repository #{remote_names}"
118
122
  end
119
123
  end
120
- alias_method :name, :to_s
124
+ alias_method :name, :identifier
121
125
 
122
126
  def specs
123
127
  @specs ||= begin
@@ -262,10 +266,6 @@ module Bundler
262
266
  @remotes.unshift(uri) unless @remotes.include?(uri)
263
267
  end
264
268
 
265
- def equivalent_remotes?(other_remotes)
266
- other_remotes.map(&method(:remove_auth)) == @remotes.map(&method(:remove_auth))
267
- end
268
-
269
269
  def spec_names
270
270
  if @allow_remote && dependency_api_available?
271
271
  remote_specs.spec_names
@@ -334,7 +334,11 @@ module Bundler
334
334
  end
335
335
 
336
336
  def credless_remotes
337
- remotes.map(&method(:suppress_configured_credentials))
337
+ if Bundler.settings[:allow_deployment_source_credential_changes]
338
+ remotes.map(&method(:remove_auth))
339
+ else
340
+ remotes.map(&method(:suppress_configured_credentials))
341
+ end
338
342
  end
339
343
 
340
344
  def remotes_for_spec(spec)
@@ -16,7 +16,7 @@ module Bundler
16
16
  @index
17
17
  end
18
18
 
19
- def to_err
19
+ def identifier
20
20
  to_s
21
21
  end
22
22
 
@@ -67,7 +67,7 @@ module Bundler
67
67
  "#<#{self.class}:0x#{object_id} #{self}>"
68
68
  end
69
69
 
70
- def to_err
70
+ def identifier
71
71
  to_s
72
72
  end
73
73
 
@@ -98,7 +98,7 @@ module Bundler
98
98
  end
99
99
 
100
100
  def get(source)
101
- source_list_for(source).find {|s| equal_source?(source, s) || equivalent_source?(source, s) }
101
+ source_list_for(source).find {|s| equivalent_source?(source, s) }
102
102
  end
103
103
 
104
104
  def lock_sources
@@ -106,14 +106,14 @@ module Bundler
106
106
  end
107
107
 
108
108
  def lock_other_sources
109
- (path_sources + git_sources + plugin_sources).sort_by(&:to_s)
109
+ (path_sources + git_sources + plugin_sources).sort_by(&:identifier)
110
110
  end
111
111
 
112
112
  def lock_rubygems_sources
113
113
  if merged_gem_lockfile_sections?
114
114
  [combine_rubygems_sources]
115
115
  else
116
- rubygems_sources.sort_by(&:to_s)
116
+ rubygems_sources.sort_by(&:identifier)
117
117
  end
118
118
  end
119
119
 
@@ -173,7 +173,7 @@ module Bundler
173
173
  end
174
174
 
175
175
  def different_sources?(lock_sources, replacement_sources)
176
- !equal_sources?(lock_sources, replacement_sources) && !equivalent_sources?(lock_sources, replacement_sources)
176
+ !equivalent_sources?(lock_sources, replacement_sources)
177
177
  end
178
178
 
179
179
  def rubygems_aggregate_class
@@ -210,34 +210,12 @@ module Bundler
210
210
  end
211
211
  end
212
212
 
213
- def equal_sources?(lock_sources, replacement_sources)
214
- lock_sources.sort_by(&:to_s) == replacement_sources.sort_by(&:to_s)
215
- end
216
-
217
- def equal_source?(source, other_source)
218
- return source.include?(other_source) if source.is_a?(Source::Rubygems) && other_source.is_a?(Source::Rubygems)
219
-
220
- source == other_source
221
- end
222
-
223
- def equivalent_source?(source, other_source)
224
- return false unless Bundler.settings[:allow_deployment_source_credential_changes] && source.is_a?(Source::Rubygems)
225
-
226
- equivalent_rubygems_sources?([source], [other_source])
227
- end
228
-
229
213
  def equivalent_sources?(lock_sources, replacement_sources)
230
- return false unless Bundler.settings[:allow_deployment_source_credential_changes]
231
-
232
- lock_rubygems_sources, lock_other_sources = lock_sources.partition {|s| s.is_a?(Source::Rubygems) }
233
- replacement_rubygems_sources, replacement_other_sources = replacement_sources.partition {|s| s.is_a?(Source::Rubygems) }
234
-
235
- equivalent_rubygems_sources?(lock_rubygems_sources, replacement_rubygems_sources) && equal_sources?(lock_other_sources, replacement_other_sources)
214
+ lock_sources.sort_by(&:identifier) == replacement_sources.sort_by(&:identifier)
236
215
  end
237
216
 
238
- def equivalent_rubygems_sources?(lock_sources, replacement_sources)
239
- actual_remotes = replacement_sources.map(&:remotes).flatten.uniq
240
- lock_sources.all? {|s| s.equivalent_remotes?(actual_remotes) }
217
+ def equivalent_source?(source, other_source)
218
+ source == other_source
241
219
  end
242
220
  end
243
221
  end
@@ -73,7 +73,7 @@ m = Module.new do
73
73
 
74
74
  requirement = bundler_gem_version.approximate_recommendation
75
75
 
76
- return requirement unless Gem::Version.new(Gem::VERSION) < Gem::Version.new("2.7.0")
76
+ return requirement unless Gem.rubygems_version < Gem::Version.new("2.7.0")
77
77
 
78
78
  requirement += ".a" if bundler_gem_version.prerelease?
79
79
 
@@ -2,6 +2,4 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
- git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
6
-
7
5
  # gem "rails"
@@ -1,8 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # A sample gems.rb
4
3
  source "https://rubygems.org"
5
4
 
6
- git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
7
-
8
5
  # gem "rails"
@@ -3,7 +3,16 @@
3
3
  require "bundler/gem_tasks"
4
4
  <% default_task_names = [config[:test_task]].compact -%>
5
5
  <% case config[:test] -%>
6
- <% when "minitest", "test-unit" -%>
6
+ <% when "minitest" -%>
7
+ require "rake/testtask"
8
+
9
+ Rake::TestTask.new(:test) do |t|
10
+ t.libs << "test"
11
+ t.libs << "lib"
12
+ t.test_files = FileList["test/**/test_*.rb"]
13
+ end
14
+
15
+ <% when "test-unit" -%>
7
16
  require "rake/testtask"
8
17
 
9
18
  Rake::TestTask.new(:test) do |t|
@@ -10,11 +10,11 @@ on:
10
10
  jobs:
11
11
  build:
12
12
  runs-on: ubuntu-latest
13
-
13
+ name: Ruby ${{ matrix.ruby }}
14
14
  strategy:
15
15
  matrix:
16
16
  ruby:
17
- - <%= RUBY_VERSION %>
17
+ - '<%= RUBY_VERSION %>'
18
18
 
19
19
  steps:
20
20
  - uses: actions/checkout@v2
@@ -39,6 +39,6 @@ Gem::Specification.new do |spec|
39
39
  # Uncomment to register a new dependency of your gem
40
40
  # spec.add_dependency "example-gem", "~> 1.0"
41
41
 
42
- # For more information and examples about making a new gem, checkout our
42
+ # For more information and examples about making a new gem, check out our
43
43
  # guide at: https://bundler.io/guides/creating_gem.html
44
44
  end
@@ -0,0 +1,8 @@
1
+ <%- config[:constant_array].each_with_index do |c, i| -%>
2
+ <%= " " * i %>module <%= c %>
3
+ <%- end -%>
4
+ <%= " " * config[:constant_array].size %>VERSION: String
5
+ <%= " " * config[:constant_array].size %># See the writing guide of rbs: https://github.com/ruby/rbs#guides
6
+ <%- (config[:constant_array].size-1).downto(0) do |i| -%>
7
+ <%= " " * i %>end
8
+ <%- end -%>
@@ -2,7 +2,7 @@
2
2
 
3
3
  require "test_helper"
4
4
 
5
- class <%= config[:constant_name] %>Test < Minitest::Test
5
+ class Test<%= config[:constant_name] %> < Minitest::Test
6
6
  def test_that_it_has_a_version_number
7
7
  refute_nil ::<%= config[:constant_name] %>::VERSION
8
8
  end
@@ -81,7 +81,7 @@ module Bundler
81
81
  def trace(e, newline = nil, force = false)
82
82
  return unless debug? || force
83
83
  msg = "#{e.class}: #{e.message}\n#{e.backtrace.join("\n ")}"
84
- tell_me(msg, nil, newline)
84
+ tell_err(msg, nil, newline)
85
85
  end
86
86
 
87
87
  def silence(&blk)
@@ -0,0 +1 @@
1
+ # Vendored files do not need to be documented