bundler 2.2.3 → 2.2.8

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 (78) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +73 -2
  3. data/bundler.gemspec +1 -1
  4. data/lib/bundler.rb +0 -1
  5. data/lib/bundler/build_metadata.rb +2 -2
  6. data/lib/bundler/cli.rb +3 -5
  7. data/lib/bundler/cli/cache.rb +1 -0
  8. data/lib/bundler/cli/gem.rb +14 -0
  9. data/lib/bundler/compact_index_client/updater.rb +0 -8
  10. data/lib/bundler/definition.rb +17 -27
  11. data/lib/bundler/dep_proxy.rb +15 -8
  12. data/lib/bundler/feature_flag.rb +0 -1
  13. data/lib/bundler/fetcher.rb +0 -1
  14. data/lib/bundler/gem_helper.rb +9 -7
  15. data/lib/bundler/gem_version_promoter.rb +2 -2
  16. data/lib/bundler/index.rb +6 -5
  17. data/lib/bundler/installer.rb +0 -17
  18. data/lib/bundler/installer/standalone.rb +15 -0
  19. data/lib/bundler/lazy_specification.rb +9 -18
  20. data/{man → lib/bundler/man}/bundle-add.1 +1 -1
  21. data/{man → lib/bundler/man}/bundle-binstubs.1 +1 -1
  22. data/{man → lib/bundler/man}/bundle-cache.1 +1 -1
  23. data/{man → lib/bundler/man}/bundle-check.1 +1 -1
  24. data/{man → lib/bundler/man}/bundle-clean.1 +1 -1
  25. data/{man → lib/bundler/man}/bundle-config.1 +4 -4
  26. data/lib/bundler/man/bundle-config.1.ronn +3 -3
  27. data/{man → lib/bundler/man}/bundle-doctor.1 +1 -1
  28. data/{man → lib/bundler/man}/bundle-exec.1 +1 -1
  29. data/{man → lib/bundler/man}/bundle-gem.1 +1 -1
  30. data/{man → lib/bundler/man}/bundle-info.1 +1 -1
  31. data/{man → lib/bundler/man}/bundle-init.1 +1 -1
  32. data/{man → lib/bundler/man}/bundle-inject.1 +1 -1
  33. data/{man → lib/bundler/man}/bundle-install.1 +1 -1
  34. data/{man → lib/bundler/man}/bundle-list.1 +1 -1
  35. data/{man → lib/bundler/man}/bundle-lock.1 +1 -1
  36. data/{man → lib/bundler/man}/bundle-open.1 +1 -1
  37. data/{man → lib/bundler/man}/bundle-outdated.1 +1 -1
  38. data/{man → lib/bundler/man}/bundle-platform.1 +1 -1
  39. data/{man → lib/bundler/man}/bundle-pristine.1 +1 -1
  40. data/{man → lib/bundler/man}/bundle-remove.1 +1 -1
  41. data/{man → lib/bundler/man}/bundle-show.1 +1 -1
  42. data/{man → lib/bundler/man}/bundle-update.1 +1 -1
  43. data/{man → lib/bundler/man}/bundle-viz.1 +1 -1
  44. data/{man → lib/bundler/man}/bundle.1 +1 -1
  45. data/{man → lib/bundler/man}/gemfile.5 +1 -1
  46. data/{man → lib/bundler/man}/index.txt +0 -0
  47. data/lib/bundler/resolver.rb +82 -43
  48. data/lib/bundler/resolver/spec_group.rb +56 -44
  49. data/lib/bundler/rubygems_ext.rb +16 -0
  50. data/lib/bundler/settings.rb +1 -1
  51. data/lib/bundler/shared_helpers.rb +2 -2
  52. data/lib/bundler/source/git.rb +19 -17
  53. data/lib/bundler/source/git/git_proxy.rb +54 -49
  54. data/lib/bundler/source/path/installer.rb +2 -0
  55. data/lib/bundler/source/rubygems.rb +10 -2
  56. data/lib/bundler/source_list.rb +2 -4
  57. data/lib/bundler/spec_set.rb +5 -4
  58. data/lib/bundler/templates/newgem/CHANGELOG.md.tt +5 -0
  59. data/lib/bundler/templates/newgem/Gemfile.tt +1 -1
  60. data/lib/bundler/templates/newgem/newgem.gemspec.tt +1 -1
  61. data/lib/bundler/templates/newgem/rubocop.yml.tt +3 -0
  62. data/lib/bundler/vendor/molinillo/lib/molinillo/delegates/specification_provider.rb +7 -0
  63. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +0 -1
  64. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb +11 -5
  65. data/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb +2 -2
  66. data/lib/bundler/vendor/molinillo/lib/molinillo/modules/specification_provider.rb +11 -0
  67. data/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb +11 -7
  68. data/lib/bundler/vendor/thor/lib/thor.rb +5 -6
  69. data/lib/bundler/vendor/thor/lib/thor/actions.rb +1 -1
  70. data/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +4 -2
  71. data/lib/bundler/vendor/thor/lib/thor/error.rb +1 -1
  72. data/lib/bundler/vendor/thor/lib/thor/parser/arguments.rb +5 -1
  73. data/lib/bundler/vendor/thor/lib/thor/parser/options.rb +9 -8
  74. data/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +5 -2
  75. data/lib/bundler/vendor/thor/lib/thor/shell/color.rb +5 -1
  76. data/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
  77. data/lib/bundler/version.rb +1 -1
  78. metadata +30 -29
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e6d1efe11ee2c513b90baf20e54b599a1cec72355056997c53b1d62a064c4237
4
- data.tar.gz: ac82de915bc8c58b391a19e61f3abcad69dc279a531e09cadcc59083653fc7f9
3
+ metadata.gz: ecc144a2ffbedf2460fd802504e4bf73715f0ffd07baf7d27ef00697d3e316f1
4
+ data.tar.gz: cd63494a4857929510cebb582cef49aa0ff539d1a186697ad0fa3ea2c7812296
5
5
  SHA512:
6
- metadata.gz: 835e64c01ad6e8c66e0c2e7199457f0b6ce5ecb2ff8c8e4af557e40c9186bd734cbff607a45ec9a751f6ad0e6790e81a78b206b1082a7b2a7a22526b6422b280
7
- data.tar.gz: 07ed7766695917265535b4a5803ff799d201aaa910d73ba4b185f5f18836e1d1ec3967535b7b68c4c55d3af05c038ec6bcde8f66e8068db5576e16929ead145d
6
+ metadata.gz: 1edc265326d10957e714d5937f7b6e481b0b9773b8e8a46679704ff6f9ce6bd51b1f4cb7d061b95568ce7507b4a3ff078aa38dfa9a6fb726434554dcb33e1df1
7
+ data.tar.gz: f322244527a59ade88ad8456e0b0953bfc93c765b927deb5b4fedcc099ac518b5e36924e19945c3a64c8459bb6e752693412f742858c8127fa6742fc3c1454e1
data/CHANGELOG.md CHANGED
@@ -1,3 +1,74 @@
1
+ # 2.2.8 (February 2, 2021)
2
+
3
+ ## Enhancements:
4
+
5
+ - Add a CHANGELOG.md file to gems generated by `bundle gem` [#4093](https://github.com/rubygems/rubygems/pull/4093)
6
+ - Support gemified `set` [#4297](https://github.com/rubygems/rubygems/pull/4297)
7
+
8
+ ## Bug fixes:
9
+
10
+ - Fix standalone Kernel.require visibility [#4337](https://github.com/rubygems/rubygems/pull/4337)
11
+
12
+ ## Performance:
13
+
14
+ - Fix resolver edge cases and speed up bundler [#4277](https://github.com/rubygems/rubygems/pull/4277)
15
+
16
+ # 2.2.7 (January 26, 2021)
17
+
18
+ ## Enhancements:
19
+
20
+ - Improve error messages when dependency on bundler conflicts with running version [#4308](https://github.com/rubygems/rubygems/pull/4308)
21
+ - Avoid showing platforms with requirements in error messages [#4310](https://github.com/rubygems/rubygems/pull/4310)
22
+ - Introduce disable_local_revision_check config [#4237](https://github.com/rubygems/rubygems/pull/4237)
23
+ - Reverse rubygems require mixin with bundler standalone [#4299](https://github.com/rubygems/rubygems/pull/4299)
24
+
25
+ ## Bug fixes:
26
+
27
+ - Fix releasing from a not yet pushed branch [#4309](https://github.com/rubygems/rubygems/pull/4309)
28
+ - Install cache only once if it already exists [#4304](https://github.com/rubygems/rubygems/pull/4304)
29
+ - Fix `force_ruby_platform` no longer being respected [#4302](https://github.com/rubygems/rubygems/pull/4302)
30
+
31
+ ## Performance:
32
+
33
+ - Fix resolver dependency comparison [#4289](https://github.com/rubygems/rubygems/pull/4289)
34
+
35
+ # 2.2.6 (January 18, 2021)
36
+
37
+ ## Enhancements:
38
+
39
+ - Improve resolver debugging [#4288](https://github.com/rubygems/rubygems/pull/4288)
40
+
41
+ ## Bug fixes:
42
+
43
+ - Fix dependency locking for path source [#4293](https://github.com/rubygems/rubygems/pull/4293)
44
+
45
+ ## Performance:
46
+
47
+ - Speed up complex dependency resolves by creating DepProxy factory and cache [#4216](https://github.com/rubygems/rubygems/pull/4216)
48
+
49
+ # 2.2.5 (January 11, 2021)
50
+
51
+ ## Enhancements:
52
+
53
+ - Improve rubocop setup in the new gem template [#4220](https://github.com/rubygems/rubygems/pull/4220)
54
+ - Support repositories with default branch not named master [#4224](https://github.com/rubygems/rubygems/pull/4224)
55
+
56
+ ## Bug fixes:
57
+
58
+ - Let Net::HTTP decompress the index instead of doing it manually [#4081](https://github.com/rubygems/rubygems/pull/4081)
59
+ - Workaround for another jruby crash when autoloading a constant [#4252](https://github.com/rubygems/rubygems/pull/4252)
60
+ - Fix another performance regression in the resolver [#4243](https://github.com/rubygems/rubygems/pull/4243)
61
+ - Restore support for old git versions [#4233](https://github.com/rubygems/rubygems/pull/4233)
62
+ - Give a proper error if cache path does not have write access [#4215](https://github.com/rubygems/rubygems/pull/4215)
63
+ - Fix running `rake release` from an ambiguous ref [#4219](https://github.com/rubygems/rubygems/pull/4219)
64
+
65
+ # 2.2.4 (December 31, 2020)
66
+
67
+ ## Bug fixes:
68
+
69
+ - Fix bundle man pages display on truffleruby [#4209](https://github.com/rubygems/rubygems/pull/4209)
70
+ - Fix Windows + JRuby no longer being able to install git sources [#4196](https://github.com/rubygems/rubygems/pull/4196)
71
+
1
72
  # 2.2.3 (December 22, 2020)
2
73
 
3
74
  ## Bug fixes:
@@ -320,7 +391,7 @@
320
391
  - Fix `bundle update` message about exclude groups saying "installed" instead of "updated" ([#7150](https://github.com/rubygems/bundler/pull/7150))
321
392
  - Fix `bundle licenses` not showing correct information about bundler itself ([#7147](https://github.com/rubygems/bundler/pull/7147))
322
393
  - Fix installation path not including ruby scope when `BUNDLE_PATH` was set ([#7163](https://github.com/rubygems/bundler/pull/7163))
323
- - 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))
394
+ - 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))
324
395
  - Fix platform specific gems always being re-resolved when bundler was not running under that platform ([#7212](https://github.com/rubygems/bundler/pull/7212))
325
396
  - Fix `bundle package --all-platforms` causing `bundle install` to ignore `--with` and `--without` ([#6113](https://github.com/rubygems/bundler/pull/6113))
326
397
  - Fix `MissingRevision` git errors to include the specific `git` command that failed under the hood ([#7225](https://github.com/rubygems/bundler/pull/7225))
@@ -492,7 +563,7 @@ Changes
492
563
  ## Bug fixes:
493
564
 
494
565
  - 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)
495
- - Fix some rescue calls that don't specifiy error type (@utilum)
566
+ - Fix some rescue calls that don't specify error type (@utilum)
496
567
  - 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)
497
568
  - Improve handling of adding new gems with only a single group to the Gemfile in `bundle add` (@agrim123)
498
569
  - Refactor check for OpenSSL in `bundle env` (@voxik)
data/bundler.gemspec CHANGED
@@ -34,7 +34,7 @@ Gem::Specification.new do |s|
34
34
  s.required_ruby_version = ">= 2.3.0"
35
35
  s.required_rubygems_version = ">= 2.5.2"
36
36
 
37
- s.files = Dir.glob("{lib,man,exe}/**/*", File::FNM_DOTMATCH).reject {|f| File.directory?(f) }
37
+ s.files = Dir.glob("{lib,exe}/**/*", File::FNM_DOTMATCH).reject {|f| File.directory?(f) }
38
38
 
39
39
  # Include the CHANGELOG.md, LICENSE.md, README.md manually
40
40
  s.files += %w[CHANGELOG.md LICENSE.md README.md]
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__)
@@ -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-22".freeze
8
- @git_commit_sha = "29dc3c8398".freeze
7
+ @built_at = "2021-02-02".freeze
8
+ @git_commit_sha = "4015e550dc".freeze
9
9
  @release = true
10
10
  # end ivars
11
11
 
data/lib/bundler/cli.rb CHANGED
@@ -122,9 +122,7 @@ module Bundler
122
122
  else command = "bundle-#{cli}"
123
123
  end
124
124
 
125
- man_path = File.expand_path("../../../man", __FILE__)
126
- # man files are located under ruby's mandir with the default gems of bundler
127
- man_path = RbConfig::CONFIG["mandir"] unless File.directory?(man_path)
125
+ man_path = File.expand_path("man", __dir__)
128
126
  man_pages = Hash[Dir.glob(File.join(man_path, "**", "*")).grep(/.*\.\d*\Z/).collect do |f|
129
127
  [File.basename(f, ".*"), f]
130
128
  end]
@@ -134,8 +132,7 @@ module Bundler
134
132
  if Bundler.which("man") && man_path !~ %r{^file:/.+!/META-INF/jruby.home/.+}
135
133
  Kernel.exec "man #{man_page}"
136
134
  else
137
- fallback_man_path = File.expand_path("../man", __FILE__)
138
- puts File.read("#{fallback_man_path}/#{File.basename(man_page)}.ronn")
135
+ puts File.read("#{man_path}/#{File.basename(man_page)}.ronn")
139
136
  end
140
137
  elsif command_path = Bundler.which("bundler-#{cli}")
141
138
  Kernel.exec(command_path, "--help")
@@ -589,6 +586,7 @@ module Bundler
589
586
  method_option :git, :type => :boolean, :default => true, :desc => "Initialize a git repo inside your library."
590
587
  method_option :mit, :type => :boolean, :desc => "Generate an MIT license file. Set a default with `bundle config set --global gem.mit true`."
591
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`."
592
590
  method_option :test, :type => :string, :lazy_default => Bundler.settings["gem.test"] || "", :aliases => "-t", :banner => "Use the specified test framework for your library",
593
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)`."
594
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
@@ -259,23 +258,18 @@ module Bundler
259
258
  def resolve
260
259
  @resolve ||= begin
261
260
  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)
261
+ if Bundler.frozen_bundle?
262
+ Bundler.ui.debug "Frozen, using resolution from the lockfile"
263
+ last_resolve
264
+ elsif !unlocking? && nothing_changed?
265
+ Bundler.ui.debug("Found no changes, using resolution from the lockfile")
266
+ last_resolve
267
+ else
268
+ # Run a resolve against the locally available gems
269
+ Bundler.ui.debug("Found changes from the lockfile, re-resolving dependencies because #{change_reason}")
270
+ expanded_dependencies = expand_dependencies(dependencies + metadata_dependencies, @remote)
271
+ Resolver.resolve(expanded_dependencies, index, source_requirements, last_resolve, gem_version_promoter, additional_base_requirements_for_resolve, platforms)
272
+ end
279
273
  end
280
274
  end
281
275
 
@@ -604,7 +598,7 @@ module Bundler
604
598
  deps_for_source = @dependencies.select {|s| s.source == source }
605
599
  locked_deps_for_source = @locked_deps.values.select {|dep| dep.source == locked_source }
606
600
 
607
- Set.new(deps_for_source) != Set.new(locked_deps_for_source)
601
+ deps_for_source.sort != locked_deps_for_source.sort
608
602
  end
609
603
 
610
604
  def specs_for_source_changed?(source)
@@ -818,11 +812,6 @@ module Bundler
818
812
  # commonly happens if the version changed in the gemspec
819
813
  next unless new_spec
820
814
 
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
815
  s.dependencies.replace(new_spec.dependencies)
827
816
  end
828
817
 
@@ -889,7 +878,7 @@ module Bundler
889
878
  dependencies.each do |dep|
890
879
  dep = Dependency.new(dep, ">= 0") unless dep.respond_to?(:name)
891
880
  next unless remote || dep.current_platform?
892
- target_platforms = dep.gem_platforms(remote ? Resolver.sort_platforms(@platforms) : [generic_local_platform])
881
+ target_platforms = dep.gem_platforms(remote ? @platforms : [generic_local_platform])
893
882
  deps += expand_dependency_with_platforms(dep, target_platforms)
894
883
  end
895
884
  deps
@@ -897,7 +886,7 @@ module Bundler
897
886
 
898
887
  def expand_dependency_with_platforms(dep, platforms)
899
888
  platforms.map do |p|
900
- DepProxy.new(dep, p)
889
+ DepProxy.get_proxy(dep, p)
901
890
  end
902
891
  end
903
892
 
@@ -918,6 +907,7 @@ module Bundler
918
907
  metadata_dependencies.each do |dep|
919
908
  source_requirements[dep.name] = sources.metadata_source
920
909
  end
910
+ source_requirements[:default_bundler] = source_requirements["bundler"] || source_requirements[:default]
921
911
  source_requirements["bundler"] = sources.metadata_source # needs to come last to override
922
912
  source_requirements
923
913
  end
@@ -977,7 +967,7 @@ module Bundler
977
967
  next requirements if @locked_gems.dependencies[name] != dependency
978
968
  next requirements if dependency.source.is_a?(Source::Path)
979
969
  dep = Gem::Dependency.new(name, ">= #{locked_spec.version}")
980
- requirements[name] = DepProxy.new(dep, locked_spec.platform)
970
+ requirements[name] = DepProxy.get_proxy(dep, locked_spec.platform)
981
971
  requirements
982
972
  end.values
983
973
  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)