bundler 2.5.5 → 2.5.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (76) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +51 -0
  3. data/lib/bundler/build_metadata.rb +2 -2
  4. data/lib/bundler/cli/binstubs.rb +1 -1
  5. data/lib/bundler/cli/gem.rb +1 -1
  6. data/lib/bundler/cli/lock.rb +5 -4
  7. data/lib/bundler/cli/plugin.rb +3 -2
  8. data/lib/bundler/cli.rb +2 -2
  9. data/lib/bundler/definition.rb +54 -28
  10. data/lib/bundler/dsl.rb +16 -1
  11. data/lib/bundler/environment_preserver.rb +3 -3
  12. data/lib/bundler/fetcher/downloader.rb +1 -1
  13. data/lib/bundler/fetcher.rb +2 -2
  14. data/lib/bundler/gem_version_promoter.rb +42 -38
  15. data/lib/bundler/injector.rb +1 -1
  16. data/lib/bundler/installer.rb +2 -2
  17. data/lib/bundler/man/bundle-add.1 +1 -1
  18. data/lib/bundler/man/bundle-binstubs.1 +1 -1
  19. data/lib/bundler/man/bundle-cache.1 +1 -1
  20. data/lib/bundler/man/bundle-check.1 +1 -1
  21. data/lib/bundler/man/bundle-clean.1 +1 -1
  22. data/lib/bundler/man/bundle-config.1 +1 -1
  23. data/lib/bundler/man/bundle-console.1 +1 -1
  24. data/lib/bundler/man/bundle-doctor.1 +1 -1
  25. data/lib/bundler/man/bundle-exec.1 +1 -1
  26. data/lib/bundler/man/bundle-gem.1 +1 -1
  27. data/lib/bundler/man/bundle-help.1 +1 -1
  28. data/lib/bundler/man/bundle-info.1 +1 -1
  29. data/lib/bundler/man/bundle-init.1 +1 -1
  30. data/lib/bundler/man/bundle-inject.1 +1 -1
  31. data/lib/bundler/man/bundle-install.1 +3 -3
  32. data/lib/bundler/man/bundle-install.1.ronn +2 -2
  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-plugin.1 +7 -4
  39. data/lib/bundler/man/bundle-plugin.1.ronn +7 -3
  40. data/lib/bundler/man/bundle-pristine.1 +1 -1
  41. data/lib/bundler/man/bundle-remove.1 +1 -1
  42. data/lib/bundler/man/bundle-show.1 +1 -1
  43. data/lib/bundler/man/bundle-update.1 +1 -1
  44. data/lib/bundler/man/bundle-version.1 +1 -1
  45. data/lib/bundler/man/bundle-viz.1 +1 -1
  46. data/lib/bundler/man/bundle.1 +1 -1
  47. data/lib/bundler/man/gemfile.5 +3 -3
  48. data/lib/bundler/man/gemfile.5.ronn +2 -2
  49. data/lib/bundler/mirror.rb +3 -3
  50. data/lib/bundler/plugin/api/source.rb +2 -2
  51. data/lib/bundler/plugin/installer/path.rb +18 -0
  52. data/lib/bundler/plugin/installer.rb +36 -16
  53. data/lib/bundler/plugin/source_list.rb +4 -4
  54. data/lib/bundler/resolver/candidate.rb +1 -1
  55. data/lib/bundler/resolver.rb +54 -24
  56. data/lib/bundler/runtime.rb +1 -1
  57. data/lib/bundler/self_manager.rb +1 -1
  58. data/lib/bundler/settings.rb +14 -11
  59. data/lib/bundler/source/git/git_proxy.rb +1 -1
  60. data/lib/bundler/source/git.rb +1 -1
  61. data/lib/bundler/source/rubygems/remote.rb +1 -1
  62. data/lib/bundler/source/rubygems.rb +4 -4
  63. data/lib/bundler/source_list.rb +2 -2
  64. data/lib/bundler/spec_set.rb +1 -1
  65. data/lib/bundler/templates/newgem/newgem.gemspec.tt +4 -3
  66. data/lib/bundler/templates/newgem/rubocop.yml.tt +0 -5
  67. data/lib/bundler/uri_credentials_filter.rb +2 -2
  68. data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +22 -22
  69. data/lib/bundler/vendor/pub_grub/lib/pub_grub/static_package_source.rb +1 -0
  70. data/lib/bundler/vendored_net_http.rb +7 -3
  71. data/lib/bundler/vendored_timeout.rb +7 -3
  72. data/lib/bundler/vendored_uri.rb +18 -1
  73. data/lib/bundler/version.rb +1 -1
  74. data/lib/bundler/yaml_serializer.rb +12 -0
  75. data/lib/bundler.rb +3 -2
  76. metadata +4 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: aaaf17b908dc3f0037d6da507f2177ef2cc21e023691c98f608d5ab3699431c2
4
- data.tar.gz: 64233d285e149e70f795b71cef8c92cff52360f9e86be7be3318067450c1da53
3
+ metadata.gz: b343f681293b03c25fbc82c8d4c323154aec1af8dc5f34e619779c7f4d4c634b
4
+ data.tar.gz: 0566537e3cc941f3160e5060c806f0418907cca56e8d0e56a5b79dbb7d9bd94f
5
5
  SHA512:
6
- metadata.gz: 3033d4bad54a516fc1ef08d38f9de79aa79ea0a4f7c944e3c9f770808aa82f571b6caf8af6545281d3eca71022caeab475f478831a37fd78ed93b2627104a09b
7
- data.tar.gz: d0035deab10246f235ec44b910a7a4552b725a5f4372a9eee20119f1e073eac9d355cda044bb56ad50390a3f879ee161b29783847d9dad92d107b75013b7f88d
6
+ metadata.gz: 2effd5a50b198e6113853e8d695bcc98d396f6bc0d036e55756a7615755fa8f7498fbab09f7b51d13aef5fe0c2acd1de807c16f7446c5a188de18f7793ebab4b
7
+ data.tar.gz: 8cdafdd6dbe2da1aa03e44717211fc88440974c03c2057f57ecf514c5b9253d1aa7f1e9994758bcfb5ba614435b0853d070dfe32bfd25a7a033f45b03db86ca2
data/CHANGELOG.md CHANGED
@@ -1,3 +1,54 @@
1
+ # 2.5.9 (April 12, 2024)
2
+
3
+ ## Bug fixes:
4
+
5
+ - Fix installing plugins via relative paths [#7571](https://github.com/rubygems/rubygems/pull/7571)
6
+
7
+ # 2.5.8 (April 11, 2024)
8
+
9
+ ## Enhancements:
10
+
11
+ - Allow installing plugins from path via CLI [#6960](https://github.com/rubygems/rubygems/pull/6960)
12
+ - Improve validation of `bundle plugin install` options [#7529](https://github.com/rubygems/rubygems/pull/7529)
13
+
14
+ ## Bug fixes:
15
+
16
+ - Fix resolver error message when it runs out of versions due to `--strict --patch` filtering out everything [#7527](https://github.com/rubygems/rubygems/pull/7527)
17
+ - Fix incorrect `bundle update --bundler` message [#7516](https://github.com/rubygems/rubygems/pull/7516)
18
+
19
+ # 2.5.7 (March 22, 2024)
20
+
21
+ ## Deprecations:
22
+
23
+ - Deprecate `bundle plugin install --local-git=` [#7048](https://github.com/rubygems/rubygems/pull/7048)
24
+
25
+ ## Enhancements:
26
+
27
+ - Ignore commented out keys in config file [#7514](https://github.com/rubygems/rubygems/pull/7514)
28
+ - Fix exclusion of `.gemspec` file itself in `bundle gem` generated gemspec file [#7488](https://github.com/rubygems/rubygems/pull/7488)
29
+ - Remove redundant configs from `bundle gem` generated rubocop configuration [#7478](https://github.com/rubygems/rubygems/pull/7478)
30
+ - Add `gitlab:` git source shorthand [#7449](https://github.com/rubygems/rubygems/pull/7449)
31
+ - Use full path for `instance_eval` in `Bundler::DSL#eval_gemfile` [#7471](https://github.com/rubygems/rubygems/pull/7471)
32
+
33
+ ## Documentation:
34
+
35
+ - Use https instead of http in documentation links [#7481](https://github.com/rubygems/rubygems/pull/7481)
36
+
37
+ # 2.5.6 (February 6, 2024)
38
+
39
+ ## Deprecations:
40
+
41
+ - Refactor lockfile generation and deprecate `Definition#lock` with explicit lockfile [#7047](https://github.com/rubygems/rubygems/pull/7047)
42
+
43
+ ## Enhancements:
44
+
45
+ - Bump `required_ruby_version` to be used in `bundle gem` template [#7430](https://github.com/rubygems/rubygems/pull/7430)
46
+
47
+ ## Bug fixes:
48
+
49
+ - Fix musl platform not being added to the lockfile [#7441](https://github.com/rubygems/rubygems/pull/7441)
50
+ - Let `Bundler.with_original_env` properly restore env variables originally empty [#7383](https://github.com/rubygems/rubygems/pull/7383)
51
+
1
52
  # 2.5.5 (January 18, 2024)
2
53
 
3
54
  ## Bug fixes:
@@ -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 = "2024-01-18".freeze
8
- @git_commit_sha = "2efa8cec93".freeze
7
+ @built_at = "2024-04-12".freeze
8
+ @git_commit_sha = "4304697e0c".freeze
9
9
  @release = true
10
10
  # end ivars
11
11
 
@@ -45,7 +45,7 @@ module Bundler
45
45
  next
46
46
  end
47
47
 
48
- Bundler.settings.temporary(path: (Bundler.settings[:path] || Bundler.root)) do
48
+ Bundler.settings.temporary(path: Bundler.settings[:path] || Bundler.root) do
49
49
  installer.generate_standalone_bundler_executable_stubs(spec, installer_opts)
50
50
  end
51
51
  else
@@ -437,7 +437,7 @@ module Bundler
437
437
  end
438
438
 
439
439
  def required_ruby_version
440
- "2.6.0"
440
+ "3.0.0"
441
441
  end
442
442
 
443
443
  def rubocop_version
@@ -33,8 +33,11 @@ module Bundler
33
33
  update = { bundler: bundler }
34
34
  end
35
35
 
36
+ file = options[:lockfile]
37
+ file = file ? Pathname.new(file).expand_path : Bundler.default_lockfile
38
+
36
39
  Bundler.settings.temporary(frozen: false) do
37
- definition = Bundler.definition(update)
40
+ definition = Bundler.definition(update, file)
38
41
 
39
42
  Bundler::CLI::Common.configure_gem_version_promoter(definition, options) if options[:update]
40
43
 
@@ -60,10 +63,8 @@ module Bundler
60
63
  if print
61
64
  puts definition.to_lock
62
65
  else
63
- file = options[:lockfile]
64
- file = file ? File.expand_path(file) : Bundler.default_lockfile
65
66
  puts "Writing lockfile to #{file}"
66
- definition.lock(file)
67
+ definition.lock
67
68
  end
68
69
  end
69
70
 
@@ -5,14 +5,15 @@ module Bundler
5
5
  class CLI::Plugin < Thor
6
6
  desc "install PLUGINS", "Install the plugin from the source"
7
7
  long_desc <<-D
8
- Install plugins either from the rubygems source provided (with --source option) or from a git source provided with --git (for remote repos) or --local_git (for local repos). If no sources are provided, it uses Gem.sources
8
+ Install plugins either from the rubygems source provided (with --source option), from a git source provided with --git, or a local path provided with --path. If no sources are provided, it uses Gem.sources
9
9
  D
10
10
  method_option "source", type: :string, default: nil, banner: "URL of the RubyGems source to fetch the plugin from"
11
11
  method_option "version", type: :string, default: nil, banner: "The version of the plugin to fetch"
12
12
  method_option "git", type: :string, default: nil, banner: "URL of the git repo to fetch from"
13
- method_option "local_git", type: :string, default: nil, banner: "Path of the local git repo to fetch from"
13
+ method_option "local_git", type: :string, default: nil, banner: "Path of the local git repo to fetch from (deprecated)"
14
14
  method_option "branch", type: :string, default: nil, banner: "The git branch to checkout"
15
15
  method_option "ref", type: :string, default: nil, banner: "The git revision to check out"
16
+ method_option "path", type: :string, default: nil, banner: "Path of a local gem to directly use"
16
17
  def install(*plugins)
17
18
  Bundler::Plugin.install(plugins, options)
18
19
  end
data/lib/bundler/cli.rb CHANGED
@@ -620,7 +620,7 @@ module Bundler
620
620
  method_option "major", type: :boolean, banner: "If updating, prefer updating to next major version (default)"
621
621
  method_option "pre", type: :boolean, banner: "If updating, always choose the highest allowed version, regardless of prerelease status"
622
622
  method_option "strict", type: :boolean, banner: "If updating, do not allow any gem to be updated past latest --patch | --minor | --major"
623
- method_option "conservative", type: :boolean, banner: "If updating, use bundle install conservative update behavior and do not allow shared dependencies to be updated"
623
+ method_option "conservative", type: :boolean, banner: "If updating, use bundle install conservative update behavior and do not allow shared dependencies to be updated"
624
624
  method_option "bundler", type: :string, lazy_default: "> 0.a", banner: "Update the locked version of bundler"
625
625
  def lock
626
626
  require_relative "cli/lock"
@@ -785,7 +785,7 @@ module Bundler
785
785
  return unless SharedHelpers.md5_available?
786
786
 
787
787
  latest = Fetcher::CompactIndex.
788
- new(nil, Source::Rubygems::Remote.new(Bundler::URI("https://rubygems.org")), nil, nil).
788
+ new(nil, Source::Rubygems::Remote.new(Gem::URI("https://rubygems.org")), nil, nil).
789
789
  send(:compact_index_client).
790
790
  instance_variable_get(:@cache).
791
791
  dependencies("bundler").
@@ -320,38 +320,26 @@ module Bundler
320
320
  dependencies.map(&:groups).flatten.uniq
321
321
  end
322
322
 
323
- def lock(file, preserve_unknown_sections = false)
324
- return if Definition.no_lock
325
-
326
- contents = to_lock
327
-
328
- # Convert to \r\n if the existing lock has them
329
- # i.e., Windows with `git config core.autocrlf=true`
330
- contents.gsub!(/\n/, "\r\n") if @lockfile_contents.match?("\r\n")
331
-
332
- if @locked_bundler_version
333
- locked_major = @locked_bundler_version.segments.first
334
- current_major = bundler_version_to_lock.segments.first
335
-
336
- updating_major = locked_major < current_major
337
- end
323
+ def lock(file_or_preserve_unknown_sections = false, preserve_unknown_sections_or_unused = false)
324
+ if [true, false, nil].include?(file_or_preserve_unknown_sections)
325
+ target_lockfile = lockfile || Bundler.default_lockfile
326
+ preserve_unknown_sections = file_or_preserve_unknown_sections
327
+ else
328
+ target_lockfile = file_or_preserve_unknown_sections
329
+ preserve_unknown_sections = preserve_unknown_sections_or_unused
338
330
 
339
- preserve_unknown_sections ||= !updating_major && (Bundler.frozen_bundle? || !(unlocking? || @unlocking_bundler))
331
+ suggestion = if target_lockfile == lockfile
332
+ "To fix this warning, remove it from the `Definition#lock` call."
333
+ else
334
+ "Instead, instantiate a new definition passing `#{target_lockfile}`, and call `lock` without a file argument on that definition"
335
+ end
340
336
 
341
- if file && File.exist?(file) && lockfiles_equal?(@lockfile_contents, contents, preserve_unknown_sections)
342
- return if Bundler.frozen_bundle?
343
- SharedHelpers.filesystem_access(file) { FileUtils.touch(file) }
344
- return
345
- end
337
+ msg = "`Definition#lock` was passed a target file argument. #{suggestion}"
346
338
 
347
- if Bundler.frozen_bundle?
348
- Bundler.ui.error "Cannot write a changed lockfile while frozen."
349
- return
339
+ Bundler::SharedHelpers.major_deprecation 2, msg
350
340
  end
351
341
 
352
- SharedHelpers.filesystem_access(file) do |p|
353
- File.open(p, "wb") {|f| f.puts(contents) }
354
- end
342
+ write_lock(target_lockfile, preserve_unknown_sections)
355
343
  end
356
344
 
357
345
  def locked_ruby_version
@@ -518,7 +506,45 @@ module Bundler
518
506
  end
519
507
 
520
508
  def lockfile_exists?
521
- lockfile && File.exist?(lockfile)
509
+ file_exists?(lockfile)
510
+ end
511
+
512
+ def file_exists?(file)
513
+ file && File.exist?(file)
514
+ end
515
+
516
+ def write_lock(file, preserve_unknown_sections)
517
+ return if Definition.no_lock
518
+
519
+ contents = to_lock
520
+
521
+ # Convert to \r\n if the existing lock has them
522
+ # i.e., Windows with `git config core.autocrlf=true`
523
+ contents.gsub!(/\n/, "\r\n") if @lockfile_contents.match?("\r\n")
524
+
525
+ if @locked_bundler_version
526
+ locked_major = @locked_bundler_version.segments.first
527
+ current_major = bundler_version_to_lock.segments.first
528
+
529
+ updating_major = locked_major < current_major
530
+ end
531
+
532
+ preserve_unknown_sections ||= !updating_major && (Bundler.frozen_bundle? || !(unlocking? || @unlocking_bundler))
533
+
534
+ if file_exists?(file) && lockfiles_equal?(@lockfile_contents, contents, preserve_unknown_sections)
535
+ return if Bundler.frozen_bundle?
536
+ SharedHelpers.filesystem_access(file) { FileUtils.touch(file) }
537
+ return
538
+ end
539
+
540
+ if Bundler.frozen_bundle?
541
+ Bundler.ui.error "Cannot write a changed lockfile while frozen."
542
+ return
543
+ end
544
+
545
+ SharedHelpers.filesystem_access(file) do |p|
546
+ File.open(p, "wb") {|f| f.puts(contents) }
547
+ end
522
548
  end
523
549
 
524
550
  def resolver
data/lib/bundler/dsl.rb CHANGED
@@ -19,6 +19,7 @@ module Bundler
19
19
  platform platforms type source install_if gemfile force_ruby_platform].freeze
20
20
 
21
21
  GITHUB_PULL_REQUEST_URL = %r{\Ahttps://github\.com/([A-Za-z0-9_\-\.]+/[A-Za-z0-9_\-\.]+)/pull/(\d+)\z}
22
+ GITLAB_MERGE_REQUEST_URL = %r{\Ahttps://gitlab\.com/([A-Za-z0-9_\-\./]+)/-/merge_requests/(\d+)\z}
22
23
 
23
24
  attr_reader :gemspecs, :gemfile
24
25
  attr_accessor :dependencies
@@ -46,7 +47,7 @@ module Bundler
46
47
  @gemfile = expanded_gemfile_path
47
48
  @gemfiles << expanded_gemfile_path
48
49
  contents ||= Bundler.read_file(@gemfile.to_s)
49
- instance_eval(contents, gemfile.to_s, 1)
50
+ instance_eval(contents, @gemfile.to_s, 1)
50
51
  rescue Exception => e # rubocop:disable Lint/RescueException
51
52
  message = "There was an error " \
52
53
  "#{e.is_a?(GemfileEvalError) ? "evaluating" : "parsing"} " \
@@ -308,6 +309,20 @@ module Bundler
308
309
  repo_name ||= user_name
309
310
  "https://#{user_name}@bitbucket.org/#{user_name}/#{repo_name}.git"
310
311
  end
312
+
313
+ git_source(:gitlab) do |repo_name|
314
+ if repo_name =~ GITLAB_MERGE_REQUEST_URL
315
+ {
316
+ "git" => "https://gitlab.com/#{$1}.git",
317
+ "branch" => nil,
318
+ "ref" => "refs/merge-requests/#{$2}/head",
319
+ "tag" => nil,
320
+ }
321
+ else
322
+ repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
323
+ "https://gitlab.com/#{repo_name}.git"
324
+ end
325
+ end
311
326
  end
312
327
 
313
328
  def with_source(source)
@@ -58,9 +58,9 @@ module Bundler
58
58
  env = @original.clone
59
59
  @keys.each do |key|
60
60
  value = env[key]
61
- if !value.nil? && !value.empty?
61
+ if !value.nil?
62
62
  env[@prefix + key] ||= value
63
- elsif value.nil?
63
+ else
64
64
  env[@prefix + key] ||= INTENTIONALLY_NIL
65
65
  end
66
66
  end
@@ -72,7 +72,7 @@ module Bundler
72
72
  env = @original.clone
73
73
  @keys.each do |key|
74
74
  value_original = env[@prefix + key]
75
- next if value_original.nil? || value_original.empty?
75
+ next if value_original.nil?
76
76
  if value_original == INTENTIONALLY_NIL
77
77
  env.delete(key)
78
78
  else
@@ -23,7 +23,7 @@ module Bundler
23
23
  when Gem::Net::HTTPSuccess, Gem::Net::HTTPNotModified
24
24
  response
25
25
  when Gem::Net::HTTPRedirection
26
- new_uri = Bundler::URI.parse(response["location"])
26
+ new_uri = Gem::URI.parse(response["location"])
27
27
  if new_uri.host == uri.host
28
28
  new_uri.user = uri.user
29
29
  new_uri.password = uri.password
@@ -111,7 +111,7 @@ module Bundler
111
111
  spec -= [nil, "ruby", ""]
112
112
  spec_file_name = "#{spec.join "-"}.gemspec"
113
113
 
114
- uri = Bundler::URI.parse("#{remote_uri}#{Gem::MARSHAL_SPEC_DIR}#{spec_file_name}.rz")
114
+ uri = Gem::URI.parse("#{remote_uri}#{Gem::MARSHAL_SPEC_DIR}#{spec_file_name}.rz")
115
115
  spec = if uri.scheme == "file"
116
116
  path = Gem::Util.correct_for_windows_path(uri.path)
117
117
  Bundler.safe_load_marshal Bundler.rubygems.inflate(Gem.read_binary(path))
@@ -255,7 +255,7 @@ module Bundler
255
255
 
256
256
  con = Gem::Net::HTTP::Persistent.new name: "bundler", proxy: :ENV
257
257
  if gem_proxy = Gem.configuration[:http_proxy]
258
- con.proxy = Bundler::URI.parse(gem_proxy) if gem_proxy != :no_proxy
258
+ con.proxy = Gem::URI.parse(gem_proxy) if gem_proxy != :no_proxy
259
259
  end
260
260
 
261
261
  if remote_uri.scheme == "https"
@@ -45,17 +45,37 @@ module Bundler
45
45
 
46
46
  # Given a Resolver::Package and an Array of Specifications of available
47
47
  # versions for a gem, this method will return the Array of Specifications
48
- # sorted (and possibly truncated if strict is true) in an order to give
49
- # preference to the current level (:major, :minor or :patch) when resolution
50
- # is deciding what versions best resolve all dependencies in the bundle.
48
+ # sorted in an order to give preference to the current level (:major, :minor
49
+ # or :patch) when resolution is deciding what versions best resolve all
50
+ # dependencies in the bundle.
51
51
  # @param package [Resolver::Package] The package being resolved.
52
52
  # @param specs [Specification] An array of Specifications for the package.
53
- # @return [Specification] A new instance of the Specification Array sorted and
54
- # possibly filtered.
53
+ # @return [Specification] A new instance of the Specification Array sorted.
55
54
  def sort_versions(package, specs)
56
- specs = filter_dep_specs(specs, package) if strict
55
+ locked_version = package.locked_version
57
56
 
58
- sort_dep_specs(specs, package)
57
+ result = specs.sort do |a, b|
58
+ unless package.prerelease_specified? || pre?
59
+ a_pre = a.prerelease?
60
+ b_pre = b.prerelease?
61
+
62
+ next 1 if a_pre && !b_pre
63
+ next -1 if b_pre && !a_pre
64
+ end
65
+
66
+ if major? || locked_version.nil?
67
+ b <=> a
68
+ elsif either_version_older_than_locked?(a, b, locked_version)
69
+ b <=> a
70
+ elsif segments_do_not_match?(a, b, :major)
71
+ a <=> b
72
+ elsif !minor? && segments_do_not_match?(a, b, :minor)
73
+ a <=> b
74
+ else
75
+ b <=> a
76
+ end
77
+ end
78
+ post_sort(result, package.unlock?, locked_version)
59
79
  end
60
80
 
61
81
  # @return [bool] Convenience method for testing value of level variable.
@@ -73,9 +93,18 @@ module Bundler
73
93
  pre == true
74
94
  end
75
95
 
76
- private
96
+ # Given a Resolver::Package and an Array of Specifications of available
97
+ # versions for a gem, this method will truncate the Array if strict
98
+ # is true. That means filtering out downgrades from the version currently
99
+ # locked, and filtering out upgrades that go past the selected level (major,
100
+ # minor, or patch).
101
+ # @param package [Resolver::Package] The package being resolved.
102
+ # @param specs [Specification] An array of Specifications for the package.
103
+ # @return [Specification] A new instance of the Specification Array
104
+ # truncated.
105
+ def filter_versions(package, specs)
106
+ return specs unless strict
77
107
 
78
- def filter_dep_specs(specs, package)
79
108
  locked_version = package.locked_version
80
109
  return specs if locked_version.nil? || major?
81
110
 
@@ -89,32 +118,7 @@ module Bundler
89
118
  end
90
119
  end
91
120
 
92
- def sort_dep_specs(specs, package)
93
- locked_version = package.locked_version
94
-
95
- result = specs.sort do |a, b|
96
- unless package.prerelease_specified? || pre?
97
- a_pre = a.prerelease?
98
- b_pre = b.prerelease?
99
-
100
- next -1 if a_pre && !b_pre
101
- next 1 if b_pre && !a_pre
102
- end
103
-
104
- if major? || locked_version.nil?
105
- a <=> b
106
- elsif either_version_older_than_locked?(a, b, locked_version)
107
- a <=> b
108
- elsif segments_do_not_match?(a, b, :major)
109
- b <=> a
110
- elsif !minor? && segments_do_not_match?(a, b, :minor)
111
- b <=> a
112
- else
113
- a <=> b
114
- end
115
- end
116
- post_sort(result, package.unlock?, locked_version)
117
- end
121
+ private
118
122
 
119
123
  def either_version_older_than_locked?(a, b, locked_version)
120
124
  a.version < locked_version || b.version < locked_version
@@ -133,13 +137,13 @@ module Bundler
133
137
  if unlock || locked_version.nil?
134
138
  result
135
139
  else
136
- move_version_to_end(result, locked_version)
140
+ move_version_to_beginning(result, locked_version)
137
141
  end
138
142
  end
139
143
 
140
- def move_version_to_end(result, version)
144
+ def move_version_to_beginning(result, version)
141
145
  move, keep = result.partition {|s| s.version.to_s == version.to_s }
142
- keep.concat(move)
146
+ move.concat(keep)
143
147
  end
144
148
  end
145
149
  end
@@ -50,7 +50,7 @@ module Bundler
50
50
  append_to(gemfile_path, build_gem_lines(@options[:conservative_versioning])) if @deps.any?
51
51
 
52
52
  # since we resolved successfully, write out the lockfile
53
- @definition.lock(Bundler.default_lockfile)
53
+ @definition.lock
54
54
 
55
55
  # invalidate the cached Bundler.definition
56
56
  Bundler.reset_paths!
@@ -260,8 +260,8 @@ module Bundler
260
260
  true
261
261
  end
262
262
 
263
- def lock(opts = {})
264
- @definition.lock(Bundler.default_lockfile, opts[:preserve_unknown_sections])
263
+ def lock
264
+ @definition.lock
265
265
  end
266
266
  end
267
267
  end
@@ -1,6 +1,6 @@
1
1
  .\" generated with nRonn/v0.11.1
2
2
  .\" https://github.com/n-ronn/nronn/tree/0.11.1
3
- .TH "BUNDLE\-ADD" "1" "December 2023" ""
3
+ .TH "BUNDLE\-ADD" "1" "March 2024" ""
4
4
  .SH "NAME"
5
5
  \fBbundle\-add\fR \- Add gem to the Gemfile and run bundle install
6
6
  .SH "SYNOPSIS"
@@ -1,6 +1,6 @@
1
1
  .\" generated with nRonn/v0.11.1
2
2
  .\" https://github.com/n-ronn/nronn/tree/0.11.1
3
- .TH "BUNDLE\-BINSTUBS" "1" "December 2023" ""
3
+ .TH "BUNDLE\-BINSTUBS" "1" "March 2024" ""
4
4
  .SH "NAME"
5
5
  \fBbundle\-binstubs\fR \- Install the binstubs of the listed gems
6
6
  .SH "SYNOPSIS"
@@ -1,6 +1,6 @@
1
1
  .\" generated with nRonn/v0.11.1
2
2
  .\" https://github.com/n-ronn/nronn/tree/0.11.1
3
- .TH "BUNDLE\-CACHE" "1" "December 2023" ""
3
+ .TH "BUNDLE\-CACHE" "1" "March 2024" ""
4
4
  .SH "NAME"
5
5
  \fBbundle\-cache\fR \- Package your needed \fB\.gem\fR files into your application
6
6
  .SH "SYNOPSIS"
@@ -1,6 +1,6 @@
1
1
  .\" generated with nRonn/v0.11.1
2
2
  .\" https://github.com/n-ronn/nronn/tree/0.11.1
3
- .TH "BUNDLE\-CHECK" "1" "December 2023" ""
3
+ .TH "BUNDLE\-CHECK" "1" "March 2024" ""
4
4
  .SH "NAME"
5
5
  \fBbundle\-check\fR \- Verifies if dependencies are satisfied by installed gems
6
6
  .SH "SYNOPSIS"
@@ -1,6 +1,6 @@
1
1
  .\" generated with nRonn/v0.11.1
2
2
  .\" https://github.com/n-ronn/nronn/tree/0.11.1
3
- .TH "BUNDLE\-CLEAN" "1" "December 2023" ""
3
+ .TH "BUNDLE\-CLEAN" "1" "March 2024" ""
4
4
  .SH "NAME"
5
5
  \fBbundle\-clean\fR \- Cleans up unused gems in your bundler directory
6
6
  .SH "SYNOPSIS"
@@ -1,6 +1,6 @@
1
1
  .\" generated with nRonn/v0.11.1
2
2
  .\" https://github.com/n-ronn/nronn/tree/0.11.1
3
- .TH "BUNDLE\-CONFIG" "1" "December 2023" ""
3
+ .TH "BUNDLE\-CONFIG" "1" "March 2024" ""
4
4
  .SH "NAME"
5
5
  \fBbundle\-config\fR \- Set bundler configuration options
6
6
  .SH "SYNOPSIS"
@@ -1,6 +1,6 @@
1
1
  .\" generated with nRonn/v0.11.1
2
2
  .\" https://github.com/n-ronn/nronn/tree/0.11.1
3
- .TH "BUNDLE\-CONSOLE" "1" "December 2023" ""
3
+ .TH "BUNDLE\-CONSOLE" "1" "March 2024" ""
4
4
  .SH "NAME"
5
5
  \fBbundle\-console\fR \- Deprecated way to open an IRB session with the bundle pre\-loaded
6
6
  .SH "SYNOPSIS"
@@ -1,6 +1,6 @@
1
1
  .\" generated with nRonn/v0.11.1
2
2
  .\" https://github.com/n-ronn/nronn/tree/0.11.1
3
- .TH "BUNDLE\-DOCTOR" "1" "December 2023" ""
3
+ .TH "BUNDLE\-DOCTOR" "1" "March 2024" ""
4
4
  .SH "NAME"
5
5
  \fBbundle\-doctor\fR \- Checks the bundle for common problems
6
6
  .SH "SYNOPSIS"
@@ -1,6 +1,6 @@
1
1
  .\" generated with nRonn/v0.11.1
2
2
  .\" https://github.com/n-ronn/nronn/tree/0.11.1
3
- .TH "BUNDLE\-EXEC" "1" "December 2023" ""
3
+ .TH "BUNDLE\-EXEC" "1" "March 2024" ""
4
4
  .SH "NAME"
5
5
  \fBbundle\-exec\fR \- Execute a command in the context of the bundle
6
6
  .SH "SYNOPSIS"
@@ -1,6 +1,6 @@
1
1
  .\" generated with nRonn/v0.11.1
2
2
  .\" https://github.com/n-ronn/nronn/tree/0.11.1
3
- .TH "BUNDLE\-GEM" "1" "December 2023" ""
3
+ .TH "BUNDLE\-GEM" "1" "March 2024" ""
4
4
  .SH "NAME"
5
5
  \fBbundle\-gem\fR \- Generate a project skeleton for creating a rubygem
6
6
  .SH "SYNOPSIS"
@@ -1,6 +1,6 @@
1
1
  .\" generated with nRonn/v0.11.1
2
2
  .\" https://github.com/n-ronn/nronn/tree/0.11.1
3
- .TH "BUNDLE\-HELP" "1" "December 2023" ""
3
+ .TH "BUNDLE\-HELP" "1" "March 2024" ""
4
4
  .SH "NAME"
5
5
  \fBbundle\-help\fR \- Displays detailed help for each subcommand
6
6
  .SH "SYNOPSIS"
@@ -1,6 +1,6 @@
1
1
  .\" generated with nRonn/v0.11.1
2
2
  .\" https://github.com/n-ronn/nronn/tree/0.11.1
3
- .TH "BUNDLE\-INFO" "1" "December 2023" ""
3
+ .TH "BUNDLE\-INFO" "1" "March 2024" ""
4
4
  .SH "NAME"
5
5
  \fBbundle\-info\fR \- Show information for the given gem in your bundle
6
6
  .SH "SYNOPSIS"
@@ -1,6 +1,6 @@
1
1
  .\" generated with nRonn/v0.11.1
2
2
  .\" https://github.com/n-ronn/nronn/tree/0.11.1
3
- .TH "BUNDLE\-INIT" "1" "December 2023" ""
3
+ .TH "BUNDLE\-INIT" "1" "March 2024" ""
4
4
  .SH "NAME"
5
5
  \fBbundle\-init\fR \- Generates a Gemfile into the current working directory
6
6
  .SH "SYNOPSIS"
@@ -1,6 +1,6 @@
1
1
  .\" generated with nRonn/v0.11.1
2
2
  .\" https://github.com/n-ronn/nronn/tree/0.11.1
3
- .TH "BUNDLE\-INJECT" "1" "December 2023" ""
3
+ .TH "BUNDLE\-INJECT" "1" "March 2024" ""
4
4
  .SH "NAME"
5
5
  \fBbundle\-inject\fR \- Add named gem(s) with version requirements to Gemfile
6
6
  .SH "SYNOPSIS"
@@ -1,6 +1,6 @@
1
1
  .\" generated with nRonn/v0.11.1
2
2
  .\" https://github.com/n-ronn/nronn/tree/0.11.1
3
- .TH "BUNDLE\-INSTALL" "1" "December 2023" ""
3
+ .TH "BUNDLE\-INSTALL" "1" "March 2024" ""
4
4
  .SH "NAME"
5
5
  \fBbundle\-install\fR \- Install the dependencies specified in your Gemfile
6
6
  .SH "SYNOPSIS"
@@ -208,8 +208,8 @@ To explicitly update \fBactionpack\fR, including its dependencies which other ge
208
208
  \fBSummary\fR: In general, after making a change to the Gemfile(5) , you should first try to run \fBbundle install\fR, which will guarantee that no other gem in the Gemfile(5) is impacted by the change\. If that does not work, run bundle update(1) \fIbundle\-update\.1\.html\fR\.
209
209
  .SH "SEE ALSO"
210
210
  .IP "\(bu" 4
211
- Gem install docs \fIhttp://guides\.rubygems\.org/rubygems\-basics/#installing\-gems\fR
211
+ Gem install docs \fIhttps://guides\.rubygems\.org/rubygems\-basics/#installing\-gems\fR
212
212
  .IP "\(bu" 4
213
- Rubygems signing docs \fIhttp://guides\.rubygems\.org/security/\fR
213
+ Rubygems signing docs \fIhttps://guides\.rubygems\.org/security/\fR
214
214
  .IP "" 0
215
215