bundler 2.2.4 → 2.2.9

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of bundler might be problematic. Click here for more details.

Files changed (76) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +76 -2
  3. data/lib/bundler.rb +1 -2
  4. data/lib/bundler/build_metadata.rb +2 -2
  5. data/lib/bundler/cli.rb +1 -0
  6. data/lib/bundler/cli/cache.rb +1 -0
  7. data/lib/bundler/cli/gem.rb +14 -0
  8. data/lib/bundler/compact_index_client/updater.rb +0 -8
  9. data/lib/bundler/definition.rb +18 -32
  10. data/lib/bundler/dep_proxy.rb +15 -8
  11. data/lib/bundler/feature_flag.rb +0 -1
  12. data/lib/bundler/fetcher.rb +0 -1
  13. data/lib/bundler/gem_helper.rb +9 -7
  14. data/lib/bundler/gem_version_promoter.rb +2 -2
  15. data/lib/bundler/index.rb +6 -5
  16. data/lib/bundler/installer.rb +0 -17
  17. data/lib/bundler/installer/standalone.rb +15 -0
  18. data/lib/bundler/lazy_specification.rb +9 -18
  19. data/lib/bundler/man/bundle-add.1 +1 -1
  20. data/lib/bundler/man/bundle-binstubs.1 +1 -1
  21. data/lib/bundler/man/bundle-cache.1 +1 -1
  22. data/lib/bundler/man/bundle-check.1 +1 -1
  23. data/lib/bundler/man/bundle-clean.1 +1 -1
  24. data/lib/bundler/man/bundle-config.1 +4 -4
  25. data/lib/bundler/man/bundle-config.1.ronn +3 -3
  26. data/lib/bundler/man/bundle-doctor.1 +1 -1
  27. data/lib/bundler/man/bundle-exec.1 +1 -1
  28. data/lib/bundler/man/bundle-gem.1 +1 -1
  29. data/lib/bundler/man/bundle-info.1 +1 -1
  30. data/lib/bundler/man/bundle-init.1 +1 -1
  31. data/lib/bundler/man/bundle-inject.1 +1 -1
  32. data/lib/bundler/man/bundle-install.1 +1 -1
  33. data/lib/bundler/man/bundle-list.1 +1 -1
  34. data/lib/bundler/man/bundle-lock.1 +1 -1
  35. data/lib/bundler/man/bundle-open.1 +1 -1
  36. data/lib/bundler/man/bundle-outdated.1 +1 -1
  37. data/lib/bundler/man/bundle-platform.1 +1 -1
  38. data/lib/bundler/man/bundle-pristine.1 +1 -1
  39. data/lib/bundler/man/bundle-remove.1 +1 -1
  40. data/lib/bundler/man/bundle-show.1 +1 -1
  41. data/lib/bundler/man/bundle-update.1 +1 -1
  42. data/lib/bundler/man/bundle-viz.1 +1 -1
  43. data/lib/bundler/man/bundle.1 +1 -1
  44. data/lib/bundler/man/gemfile.5 +1 -1
  45. data/lib/bundler/resolver.rb +82 -43
  46. data/lib/bundler/resolver/spec_group.rb +56 -44
  47. data/lib/bundler/rubygems_ext.rb +16 -0
  48. data/lib/bundler/settings.rb +1 -1
  49. data/lib/bundler/shared_helpers.rb +2 -2
  50. data/lib/bundler/source/git.rb +19 -17
  51. data/lib/bundler/source/git/git_proxy.rb +35 -17
  52. data/lib/bundler/source/path/installer.rb +2 -0
  53. data/lib/bundler/source/rubygems.rb +10 -2
  54. data/lib/bundler/source_list.rb +2 -4
  55. data/lib/bundler/spec_set.rb +5 -4
  56. data/lib/bundler/templates/newgem/CHANGELOG.md.tt +5 -0
  57. data/lib/bundler/templates/newgem/Gemfile.tt +1 -1
  58. data/lib/bundler/templates/newgem/newgem.gemspec.tt +1 -1
  59. data/lib/bundler/templates/newgem/rubocop.yml.tt +3 -0
  60. data/lib/bundler/vendor/molinillo/lib/molinillo/delegates/specification_provider.rb +7 -0
  61. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +0 -1
  62. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb +11 -5
  63. data/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb +2 -2
  64. data/lib/bundler/vendor/molinillo/lib/molinillo/modules/specification_provider.rb +11 -0
  65. data/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb +11 -7
  66. data/lib/bundler/vendor/thor/lib/thor.rb +5 -6
  67. data/lib/bundler/vendor/thor/lib/thor/actions.rb +1 -1
  68. data/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +4 -2
  69. data/lib/bundler/vendor/thor/lib/thor/error.rb +1 -1
  70. data/lib/bundler/vendor/thor/lib/thor/parser/arguments.rb +5 -1
  71. data/lib/bundler/vendor/thor/lib/thor/parser/options.rb +9 -8
  72. data/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +5 -2
  73. data/lib/bundler/vendor/thor/lib/thor/shell/color.rb +5 -1
  74. data/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
  75. data/lib/bundler/version.rb +1 -1
  76. metadata +4 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cb5e62df5ac6ec81289223672d91b6b7a1229fc348a7d7d3dba5a200e87293af
4
- data.tar.gz: 8ef6f15e230d10fd4fce8918ffd0bbeff4df1d65e9921d46e0d246cc316fe79d
3
+ metadata.gz: c062fbdfa8bcfdfde2356db8e25d771f26a63ce52bd1e91d38bfee9fda101fca
4
+ data.tar.gz: 8f2bb42b3a04e2a24facdc2a859e30ab36d21607b75b828fc46f610a8da3b1fd
5
5
  SHA512:
6
- metadata.gz: 4da8e14312ce09705a4c23999a27d0cf268809ce6dbb01da190a3f93218fb68c98c21f5ef13ead345e2a46be89dacdc3c87c91e2369bc4b69e0f2a36efa8c6b4
7
- data.tar.gz: f48e22dabd54c2a4e3b87b2644ace759777a2f949fcd47322534804272314b655435dbda1aadfcbb4f7a96e2b52b0ee3666595d8a56384e51720feb17ba28a53
6
+ metadata.gz: 6db82f66c50024072fbc6fd5bebcca674790cf62108b6f914a6515e77526af70a71c95546e7286f7dd78919bf2f2ef100a3ef6fb07a0bcc5e94a43211bfbbf10
7
+ data.tar.gz: a6a7a66879e0998817aaba8ee923c4aed56db5f3393fc94d6d607015f8bf2b752b1d07f0ba1b2a42cba066781e1a013fb8642a890388663566a3eb83d55b51b4
data/CHANGELOG.md CHANGED
@@ -1,3 +1,77 @@
1
+ # 2.2.9 (February 8, 2021)
2
+
3
+ ## Enhancements:
4
+
5
+ - Stop removing existing platforms when force_ruby_platform is true [#4336](https://github.com/rubygems/rubygems/pull/4336)
6
+
7
+ ## Bug fixes:
8
+
9
+ - Don't install platform specific gems on truffleruby [#4333](https://github.com/rubygems/rubygems/pull/4333)
10
+
11
+ # 2.2.8 (February 2, 2021)
12
+
13
+ ## Enhancements:
14
+
15
+ - Add a CHANGELOG.md file to gems generated by `bundle gem` [#4093](https://github.com/rubygems/rubygems/pull/4093)
16
+ - Support gemified `set` [#4297](https://github.com/rubygems/rubygems/pull/4297)
17
+
18
+ ## Bug fixes:
19
+
20
+ - Fix standalone Kernel.require visibility [#4337](https://github.com/rubygems/rubygems/pull/4337)
21
+
22
+ ## Performance:
23
+
24
+ - Fix resolver edge cases and speed up bundler [#4277](https://github.com/rubygems/rubygems/pull/4277)
25
+
26
+ # 2.2.7 (January 26, 2021)
27
+
28
+ ## Enhancements:
29
+
30
+ - Improve error messages when dependency on bundler conflicts with running version [#4308](https://github.com/rubygems/rubygems/pull/4308)
31
+ - Avoid showing platforms with requirements in error messages [#4310](https://github.com/rubygems/rubygems/pull/4310)
32
+ - Introduce disable_local_revision_check config [#4237](https://github.com/rubygems/rubygems/pull/4237)
33
+ - Reverse rubygems require mixin with bundler standalone [#4299](https://github.com/rubygems/rubygems/pull/4299)
34
+
35
+ ## Bug fixes:
36
+
37
+ - Fix releasing from a not yet pushed branch [#4309](https://github.com/rubygems/rubygems/pull/4309)
38
+ - Install cache only once if it already exists [#4304](https://github.com/rubygems/rubygems/pull/4304)
39
+ - Fix `force_ruby_platform` no longer being respected [#4302](https://github.com/rubygems/rubygems/pull/4302)
40
+
41
+ ## Performance:
42
+
43
+ - Fix resolver dependency comparison [#4289](https://github.com/rubygems/rubygems/pull/4289)
44
+
45
+ # 2.2.6 (January 18, 2021)
46
+
47
+ ## Enhancements:
48
+
49
+ - Improve resolver debugging [#4288](https://github.com/rubygems/rubygems/pull/4288)
50
+
51
+ ## Bug fixes:
52
+
53
+ - Fix dependency locking for path source [#4293](https://github.com/rubygems/rubygems/pull/4293)
54
+
55
+ ## Performance:
56
+
57
+ - Speed up complex dependency resolves by creating DepProxy factory and cache [#4216](https://github.com/rubygems/rubygems/pull/4216)
58
+
59
+ # 2.2.5 (January 11, 2021)
60
+
61
+ ## Enhancements:
62
+
63
+ - Improve rubocop setup in the new gem template [#4220](https://github.com/rubygems/rubygems/pull/4220)
64
+ - Support repositories with default branch not named master [#4224](https://github.com/rubygems/rubygems/pull/4224)
65
+
66
+ ## Bug fixes:
67
+
68
+ - Let Net::HTTP decompress the index instead of doing it manually [#4081](https://github.com/rubygems/rubygems/pull/4081)
69
+ - Workaround for another jruby crash when autoloading a constant [#4252](https://github.com/rubygems/rubygems/pull/4252)
70
+ - Fix another performance regression in the resolver [#4243](https://github.com/rubygems/rubygems/pull/4243)
71
+ - Restore support for old git versions [#4233](https://github.com/rubygems/rubygems/pull/4233)
72
+ - Give a proper error if cache path does not have write access [#4215](https://github.com/rubygems/rubygems/pull/4215)
73
+ - Fix running `rake release` from an ambiguous ref [#4219](https://github.com/rubygems/rubygems/pull/4219)
74
+
1
75
  # 2.2.4 (December 31, 2020)
2
76
 
3
77
  ## Bug fixes:
@@ -327,7 +401,7 @@
327
401
  - Fix `bundle update` message about exclude groups saying "installed" instead of "updated" ([#7150](https://github.com/rubygems/bundler/pull/7150))
328
402
  - Fix `bundle licenses` not showing correct information about bundler itself ([#7147](https://github.com/rubygems/bundler/pull/7147))
329
403
  - Fix installation path not including ruby scope when `BUNDLE_PATH` was set ([#7163](https://github.com/rubygems/bundler/pull/7163))
330
- - Fix `bundle clean` incorrectly removing git depedencies present in the Gemfile when rubygems 3.0+ was used and path involved a symlink ([#7211](https://github.com/rubygems/bundler/pull/7211))
404
+ - Fix `bundle clean` incorrectly removing git dependencies present in the Gemfile when rubygems 3.0+ was used and path involved a symlink ([#7211](https://github.com/rubygems/bundler/pull/7211))
331
405
  - Fix platform specific gems always being re-resolved when bundler was not running under that platform ([#7212](https://github.com/rubygems/bundler/pull/7212))
332
406
  - Fix `bundle package --all-platforms` causing `bundle install` to ignore `--with` and `--without` ([#6113](https://github.com/rubygems/bundler/pull/6113))
333
407
  - Fix `MissingRevision` git errors to include the specific `git` command that failed under the hood ([#7225](https://github.com/rubygems/bundler/pull/7225))
@@ -499,7 +573,7 @@ Changes
499
573
  ## Bug fixes:
500
574
 
501
575
  - Fix issue where updating a gem resulted in the gem's version being downgraded when `BUNDLE_ONLY_UPDATE_TO_NEWER_VERSIONS` was set ([#6529](https://github.com/rubygems/bundler/issues/6529), @theflow)
502
- - Fix some rescue calls that don't specifiy error type (@utilum)
576
+ - Fix some rescue calls that don't specify error type (@utilum)
503
577
  - Fix an issue when the Lockfile would contain platform-specific gems that it didn't need ([#6491](https://github.com/rubygems/bundler/issues/6491), @segiddins)
504
578
  - Improve handling of adding new gems with only a single group to the Gemfile in `bundle add` (@agrim123)
505
579
  - Refactor check for OpenSSL in `bundle env` (@voxik)
data/lib/bundler.rb CHANGED
@@ -63,7 +63,6 @@ module Bundler
63
63
  autoload :Resolver, File.expand_path("bundler/resolver", __dir__)
64
64
  autoload :Retry, File.expand_path("bundler/retry", __dir__)
65
65
  autoload :RubyDsl, File.expand_path("bundler/ruby_dsl", __dir__)
66
- autoload :RubyGemsGemInstaller, File.expand_path("bundler/rubygems_gem_installer", __dir__)
67
66
  autoload :RubyVersion, File.expand_path("bundler/ruby_version", __dir__)
68
67
  autoload :Runtime, File.expand_path("bundler/runtime", __dir__)
69
68
  autoload :Settings, File.expand_path("bundler/settings", __dir__)
@@ -441,7 +440,7 @@ EOF
441
440
  end
442
441
 
443
442
  def local_platform
444
- return Gem::Platform::RUBY if settings[:force_ruby_platform]
443
+ return Gem::Platform::RUBY if settings[:force_ruby_platform] || Gem.platforms == [Gem::Platform::RUBY]
445
444
  Gem::Platform.local
446
445
  end
447
446
 
@@ -4,8 +4,8 @@ module Bundler
4
4
  # Represents metadata from when the Bundler gem was built.
5
5
  module BuildMetadata
6
6
  # begin ivars
7
- @built_at = "2020-12-31".freeze
8
- @git_commit_sha = "529e536f28".freeze
7
+ @built_at = "2021-02-08".freeze
8
+ @git_commit_sha = "30e740c073".freeze
9
9
  @release = true
10
10
  # end ivars
11
11
 
data/lib/bundler/cli.rb CHANGED
@@ -586,6 +586,7 @@ module Bundler
586
586
  method_option :git, :type => :boolean, :default => true, :desc => "Initialize a git repo inside your library."
587
587
  method_option :mit, :type => :boolean, :desc => "Generate an MIT license file. Set a default with `bundle config set --global gem.mit true`."
588
588
  method_option :rubocop, :type => :boolean, :desc => "Add rubocop to the generated Rakefile and gemspec. Set a default with `bundle config set --global gem.rubocop true`."
589
+ method_option :changelog, :type => :boolean, :desc => "Generate changelog file. Set a default with `bundle config set --global gem.changelog true`."
589
590
  method_option :test, :type => :string, :lazy_default => Bundler.settings["gem.test"] || "", :aliases => "-t", :banner => "Use the specified test framework for your library",
590
591
  :desc => "Generate a test directory for your library, either rspec, minitest or test-unit. Set a default with `bundle config set --global gem.test (rspec|minitest|test-unit)`."
591
592
  method_option :ci, :type => :string, :lazy_default => Bundler.settings["gem.ci"] || "",
@@ -30,6 +30,7 @@ module Bundler
30
30
  require_relative "install"
31
31
  options = self.options.dup
32
32
  options["local"] = false if Bundler.settings[:cache_all_platforms]
33
+ options["no-cache"] = true
33
34
  Bundler::CLI::Install.new(options).run
34
35
  end
35
36
 
@@ -59,6 +59,7 @@ module Bundler
59
59
  :exe => options[:exe],
60
60
  :bundler_version => bundler_dependency_version,
61
61
  :github_username => github_username.empty? ? "[USERNAME]" : github_username,
62
+ :required_ruby_version => Gem.ruby_version < Gem::Version.new("2.4.a") ? "2.3.0" : "2.4.0",
62
63
  }
63
64
  ensure_safe_gem_name(name, constant_array)
64
65
 
@@ -141,12 +142,25 @@ module Bundler
141
142
  templates.merge!("CODE_OF_CONDUCT.md.tt" => "CODE_OF_CONDUCT.md")
142
143
  end
143
144
 
145
+ if ask_and_set(:changelog, "Do you want to include a changelog?",
146
+ "A changelog is a file which contains a curated, chronologically ordered list of notable " \
147
+ "changes for each version of a project. To make it easier for users and contributors to" \
148
+ " see precisely what notable changes have been made between each release (or version) of" \
149
+ " the project. Whether consumers or developers, the end users of software are" \
150
+ " human beings who care about what's in the software. When the software changes, people " \
151
+ "want to know why and how. see https://keepachangelog.com")
152
+ config[:changelog] = true
153
+ Bundler.ui.info "Changelog enabled in config"
154
+ templates.merge!("CHANGELOG.md.tt" => "CHANGELOG.md")
155
+ end
156
+
144
157
  if ask_and_set(:rubocop, "Do you want to add rubocop as a dependency for gems you generate?",
145
158
  "RuboCop is a static code analyzer that has out-of-the-box rules for many " \
146
159
  "of the guidelines in the community style guide. " \
147
160
  "For more information, see the RuboCop docs (https://docs.rubocop.org/en/stable/) " \
148
161
  "and the Ruby Style Guides (https://github.com/rubocop-hq/ruby-style-guide).")
149
162
  config[:rubocop] = true
163
+ config[:rubocop_version] = Gem.ruby_version < Gem::Version.new("2.4.a") ? "0.81.0" : "1.7"
150
164
  Bundler.ui.info "RuboCop enabled in config"
151
165
  templates.merge!("rubocop.yml.tt" => ".rubocop.yml")
152
166
  end
@@ -1,8 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative "../vendored_fileutils"
4
- require "stringio"
5
- require "zlib"
6
4
 
7
5
  module Bundler
8
6
  class CompactIndexClient
@@ -45,18 +43,12 @@ module Bundler
45
43
  else
46
44
  "bytes=#{local_temp_path.size}-"
47
45
  end
48
- else
49
- # Fastly ignores Range when Accept-Encoding: gzip is set
50
- headers["Accept-Encoding"] = "gzip"
51
46
  end
52
47
 
53
48
  response = @fetcher.call(remote_path, headers)
54
49
  return nil if response.is_a?(Net::HTTPNotModified)
55
50
 
56
51
  content = response.body
57
- if response["Content-Encoding"] == "gzip"
58
- content = Zlib::GzipReader.new(StringIO.new(content)).read
59
- end
60
52
 
61
53
  SharedHelpers.filesystem_access(local_temp_path) do
62
54
  if response.is_a?(Net::HTTPPartialContent) && local_temp_path.size.nonzero?
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative "lockfile_parser"
4
- require "set"
5
4
 
6
5
  module Bundler
7
6
  class Definition
@@ -83,11 +82,7 @@ module Bundler
83
82
  @lockfile_contents = Bundler.read_file(lockfile)
84
83
  @locked_gems = LockfileParser.new(@lockfile_contents)
85
84
  @locked_platforms = @locked_gems.platforms
86
- if Bundler.settings[:force_ruby_platform]
87
- @platforms = [Gem::Platform::RUBY]
88
- else
89
- @platforms = @locked_platforms.dup
90
- end
85
+ @platforms = @locked_platforms.dup
91
86
  @locked_bundler_version = @locked_gems.bundler_version
92
87
  @locked_ruby_version = @locked_gems.ruby_version
93
88
 
@@ -259,23 +254,18 @@ module Bundler
259
254
  def resolve
260
255
  @resolve ||= begin
261
256
  last_resolve = converge_locked_specs
262
- resolve =
263
- if Bundler.frozen_bundle?
264
- Bundler.ui.debug "Frozen, using resolution from the lockfile"
265
- last_resolve
266
- elsif !unlocking? && nothing_changed?
267
- Bundler.ui.debug("Found no changes, using resolution from the lockfile")
268
- last_resolve
269
- else
270
- # Run a resolve against the locally available gems
271
- Bundler.ui.debug("Found changes from the lockfile, re-resolving dependencies because #{change_reason}")
272
- expanded_dependencies = expand_dependencies(dependencies + metadata_dependencies, @remote)
273
- last_resolve.merge Resolver.resolve(expanded_dependencies, index, source_requirements, last_resolve, gem_version_promoter, additional_base_requirements_for_resolve, platforms)
274
- end
275
-
276
- # filter out gems that _can_ be installed on multiple platforms, but don't need
277
- # to be
278
- resolve.for(expand_dependencies(dependencies, true), [], false, false, false)
257
+ if Bundler.frozen_bundle?
258
+ Bundler.ui.debug "Frozen, using resolution from the lockfile"
259
+ last_resolve
260
+ elsif !unlocking? && nothing_changed?
261
+ Bundler.ui.debug("Found no changes, using resolution from the lockfile")
262
+ last_resolve
263
+ else
264
+ # Run a resolve against the locally available gems
265
+ Bundler.ui.debug("Found changes from the lockfile, re-resolving dependencies because #{change_reason}")
266
+ expanded_dependencies = expand_dependencies(dependencies + metadata_dependencies, @remote)
267
+ Resolver.resolve(expanded_dependencies, index, source_requirements, last_resolve, gem_version_promoter, additional_base_requirements_for_resolve, platforms)
268
+ end
279
269
  end
280
270
  end
281
271
 
@@ -604,7 +594,7 @@ module Bundler
604
594
  deps_for_source = @dependencies.select {|s| s.source == source }
605
595
  locked_deps_for_source = @locked_deps.values.select {|dep| dep.source == locked_source }
606
596
 
607
- Set.new(deps_for_source) != Set.new(locked_deps_for_source)
597
+ deps_for_source.sort != locked_deps_for_source.sort
608
598
  end
609
599
 
610
600
  def specs_for_source_changed?(source)
@@ -818,11 +808,6 @@ module Bundler
818
808
  # commonly happens if the version changed in the gemspec
819
809
  next unless new_spec
820
810
 
821
- new_runtime_deps = new_spec.dependencies.select {|d| d.type != :development }
822
- old_runtime_deps = s.dependencies.select {|d| d.type != :development }
823
- # If the dependencies of the path source have changed and locked spec can't satisfy new dependencies, unlock it
824
- next unless new_runtime_deps.sort == old_runtime_deps.sort || new_runtime_deps.all? {|d| satisfies_locked_spec?(d) }
825
-
826
811
  s.dependencies.replace(new_spec.dependencies)
827
812
  end
828
813
 
@@ -889,7 +874,7 @@ module Bundler
889
874
  dependencies.each do |dep|
890
875
  dep = Dependency.new(dep, ">= 0") unless dep.respond_to?(:name)
891
876
  next unless remote || dep.current_platform?
892
- target_platforms = dep.gem_platforms(remote ? Resolver.sort_platforms(@platforms) : [generic_local_platform])
877
+ target_platforms = dep.gem_platforms(remote ? @platforms : [generic_local_platform])
893
878
  deps += expand_dependency_with_platforms(dep, target_platforms)
894
879
  end
895
880
  deps
@@ -897,7 +882,7 @@ module Bundler
897
882
 
898
883
  def expand_dependency_with_platforms(dep, platforms)
899
884
  platforms.map do |p|
900
- DepProxy.new(dep, p)
885
+ DepProxy.get_proxy(dep, p)
901
886
  end
902
887
  end
903
888
 
@@ -918,6 +903,7 @@ module Bundler
918
903
  metadata_dependencies.each do |dep|
919
904
  source_requirements[dep.name] = sources.metadata_source
920
905
  end
906
+ source_requirements[:default_bundler] = source_requirements["bundler"] || source_requirements[:default]
921
907
  source_requirements["bundler"] = sources.metadata_source # needs to come last to override
922
908
  source_requirements
923
909
  end
@@ -977,7 +963,7 @@ module Bundler
977
963
  next requirements if @locked_gems.dependencies[name] != dependency
978
964
  next requirements if dependency.source.is_a?(Source::Path)
979
965
  dep = Gem::Dependency.new(name, ">= #{locked_spec.version}")
980
- requirements[name] = DepProxy.new(dep, locked_spec.platform)
966
+ requirements[name] = DepProxy.get_proxy(dep, locked_spec.platform)
981
967
  requirements
982
968
  end.values
983
969
  end
@@ -4,19 +4,18 @@ module Bundler
4
4
  class DepProxy
5
5
  attr_reader :__platform, :dep
6
6
 
7
+ @proxies = {}
8
+
9
+ def self.get_proxy(dep, platform)
10
+ @proxies[[dep, platform]] ||= new(dep, platform).freeze
11
+ end
12
+
7
13
  def initialize(dep, platform)
8
14
  @dep = dep
9
15
  @__platform = platform
10
16
  end
11
17
 
12
- def hash
13
- @hash ||= [dep, __platform].hash
14
- end
15
-
16
- def ==(other)
17
- return false if other.class != self.class
18
- dep == other.dep && __platform == other.__platform
19
- end
18
+ private_class_method :new
20
19
 
21
20
  alias_method :eql?, :==
22
21
 
@@ -39,6 +38,14 @@ module Bundler
39
38
  s
40
39
  end
41
40
 
41
+ def dup
42
+ raise NoMethodError.new("DepProxy cannot be duplicated")
43
+ end
44
+
45
+ def clone
46
+ raise NoMethodError.new("DepProxy cannot be cloned")
47
+ end
48
+
42
49
  private
43
50
 
44
51
  def method_missing(*args, &blk)
@@ -27,7 +27,6 @@ module Bundler
27
27
 
28
28
  (1..10).each {|v| define_method("bundler_#{v}_mode?") { major_version >= v } }
29
29
 
30
- settings_flag(:allow_bundler_dependency_conflicts) { bundler_3_mode? }
31
30
  settings_flag(:allow_offline_install) { bundler_3_mode? }
32
31
  settings_flag(:auto_clean_without_path) { bundler_3_mode? }
33
32
  settings_flag(:cache_all) { bundler_3_mode? }
@@ -137,7 +137,6 @@ module Bundler
137
137
  end
138
138
 
139
139
  specs.each do |name, version, platform, dependencies, metadata|
140
- next if name == "bundler"
141
140
  spec = if dependencies
142
141
  EndpointSpecification.new(name, version, platform, dependencies, metadata)
143
142
  else
@@ -116,19 +116,21 @@ module Bundler
116
116
 
117
117
  def git_push(remote = nil)
118
118
  remote ||= default_remote
119
- perform_git_push remote
120
- perform_git_push "#{remote} #{version_tag}"
119
+ perform_git_push "#{remote} refs/heads/#{current_branch}"
120
+ perform_git_push "#{remote} refs/tags/#{version_tag}"
121
121
  Bundler.ui.confirm "Pushed git commits and release tag."
122
122
  end
123
123
 
124
124
  def default_remote
125
- current_branch = sh(%w[git rev-parse --abbrev-ref HEAD]).strip
126
- return "origin" if current_branch.empty?
125
+ remote_for_branch, status = sh_with_status(%W[git config --get branch.#{current_branch}.remote])
126
+ return "origin" unless status.success?
127
127
 
128
- remote_for_branch = sh(%W[git config --get branch.#{current_branch}.remote]).strip
129
- return "origin" if remote_for_branch.empty?
128
+ remote_for_branch.strip
129
+ end
130
130
 
131
- remote_for_branch
131
+ def current_branch
132
+ # We can replace this with `git branch --show-current` once we drop support for git < 2.22.0
133
+ sh(%w[git rev-parse --abbrev-ref HEAD]).gsub(%r{\Aheads/}, "").strip
132
134
  end
133
135
 
134
136
  def allowed_push_host
@@ -81,8 +81,8 @@ module Bundler
81
81
  sort_dep_specs(spec_groups, locked_spec)
82
82
  end.tap do |specs|
83
83
  if DEBUG
84
- warn before_result
85
- warn " after sort_versions: #{debug_format_result(dep, specs).inspect}"
84
+ puts before_result
85
+ puts " after sort_versions: #{debug_format_result(dep, specs).inspect}"
86
86
  end
87
87
  end
88
88
  end
data/lib/bundler/index.rb CHANGED
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "set"
4
-
5
3
  module Bundler
6
4
  class Index
7
5
  include Enumerable
@@ -65,11 +63,14 @@ module Bundler
65
63
  def unsorted_search(query, base)
66
64
  results = local_search(query, base)
67
65
 
68
- seen = results.map(&:full_name).to_set unless @sources.empty?
66
+ seen = results.map(&:full_name).uniq unless @sources.empty?
69
67
 
70
68
  @sources.each do |source|
71
69
  source.unsorted_search(query, base).each do |spec|
72
- results << spec if seen.add?(spec.full_name)
70
+ next if seen.include?(spec.full_name)
71
+
72
+ seen << spec.full_name
73
+ results << spec
73
74
  end
74
75
  end
75
76
 
@@ -170,7 +171,7 @@ module Bundler
170
171
  def dependencies_eql?(spec, other_spec)
171
172
  deps = spec.dependencies.select {|d| d.type != :development }
172
173
  other_deps = other_spec.dependencies.select {|d| d.type != :development }
173
- Set.new(deps) == Set.new(other_deps)
174
+ deps.sort == other_deps.sort
174
175
  end
175
176
 
176
177
  def add_source(index)