bundler 2.3.12 → 2.3.15

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +46 -0
  3. data/lib/bundler/build_metadata.rb +2 -2
  4. data/lib/bundler/cli/common.rb +1 -1
  5. data/lib/bundler/definition.rb +17 -13
  6. data/lib/bundler/dsl.rb +6 -8
  7. data/lib/bundler/endpoint_specification.rb +4 -1
  8. data/lib/bundler/errors.rb +12 -4
  9. data/lib/bundler/friendly_errors.rb +16 -2
  10. data/lib/bundler/gem_helpers.rb +1 -1
  11. data/lib/bundler/injector.rb +4 -0
  12. data/lib/bundler/inline.rb +1 -11
  13. data/lib/bundler/installer/gem_installer.rb +14 -1
  14. data/lib/bundler/installer.rb +2 -11
  15. data/lib/bundler/lazy_specification.rb +1 -1
  16. data/lib/bundler/man/bundle-add.1 +7 -3
  17. data/lib/bundler/man/bundle-add.1.ronn +5 -2
  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-doctor.1 +1 -1
  24. data/lib/bundler/man/bundle-exec.1 +1 -1
  25. data/lib/bundler/man/bundle-gem.1 +1 -1
  26. data/lib/bundler/man/bundle-info.1 +1 -1
  27. data/lib/bundler/man/bundle-init.1 +1 -1
  28. data/lib/bundler/man/bundle-inject.1 +1 -1
  29. data/lib/bundler/man/bundle-install.1 +1 -1
  30. data/lib/bundler/man/bundle-list.1 +1 -1
  31. data/lib/bundler/man/bundle-lock.1 +1 -1
  32. data/lib/bundler/man/bundle-open.1 +1 -1
  33. data/lib/bundler/man/bundle-outdated.1 +1 -1
  34. data/lib/bundler/man/bundle-platform.1 +1 -1
  35. data/lib/bundler/man/bundle-pristine.1 +1 -1
  36. data/lib/bundler/man/bundle-remove.1 +1 -1
  37. data/lib/bundler/man/bundle-show.1 +1 -1
  38. data/lib/bundler/man/bundle-update.1 +1 -1
  39. data/lib/bundler/man/bundle-viz.1 +1 -1
  40. data/lib/bundler/man/bundle.1 +1 -1
  41. data/lib/bundler/man/gemfile.5 +1 -1
  42. data/lib/bundler/plugin/installer/git.rb +0 -4
  43. data/lib/bundler/plugin/installer/rubygems.rb +0 -4
  44. data/lib/bundler/process_lock.rb +1 -1
  45. data/lib/bundler/resolver.rb +7 -8
  46. data/lib/bundler/rubygems_ext.rb +1 -1
  47. data/lib/bundler/rubygems_gem_installer.rb +3 -8
  48. data/lib/bundler/settings.rb +1 -1
  49. data/lib/bundler/shared_helpers.rb +5 -5
  50. data/lib/bundler/source/git.rb +2 -2
  51. data/lib/bundler/source/path.rb +1 -1
  52. data/lib/bundler/source/rubygems.rb +14 -11
  53. data/lib/bundler/source.rb +3 -4
  54. data/lib/bundler/spec_set.rb +5 -3
  55. data/lib/bundler/stub_specification.rb +5 -3
  56. data/lib/bundler/version.rb +1 -1
  57. data/lib/bundler.rb +12 -1
  58. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 489c8d7661dcb4d99b7990a44d02dc883d10e31adb0297fa09f52ff502424e63
4
- data.tar.gz: d050d525313844234ca93b7c879f7582ff2d0e0a334f33b706bc67039e8511b5
3
+ metadata.gz: 90ea0eb8e0cfa7a8f3c4cbbaaf462526decabe37e575a4d180e1565b8770ae9e
4
+ data.tar.gz: '050481f0d752f3e519b3d830f9f9f873b48d2e38879cc7a1ccb35ace0ee75c01'
5
5
  SHA512:
6
- metadata.gz: 853c3263abfbf6296e2256a5ea8df6860fe71591b25d3c5087839c9c0a0e5b7787b5696e621becb4c825f1429bc6fb1c07ca9b6b87f508910415ff23d2c05015
7
- data.tar.gz: e4fe33afda4a3c4ab8ea8b3e6ba458fc335cc76443d1062a674be0093fb87b25dd37c310e53d0c00dca3417c2e20c89c5f4e72b03000e897d4136758ccc2e210
6
+ metadata.gz: 5e1de206741c6d35bbfaa5fb41b9af2b15dc08050831e51c92b2e7a9038f040e5a9326ba1bb21350e320c7f1c3a98174eae752fba042ff3a6911886e6f5c8fc1
7
+ data.tar.gz: 8dbccee1de0304584cb0f7a34d14f55e3d1accc5d298d0f676c2d967150d739e7b9916ca4c4b0ed5d6a7ce53d7d586946ec560e97367044257c2907e8bba2308
data/CHANGELOG.md CHANGED
@@ -1,3 +1,49 @@
1
+ # 2.3.15 (June 1, 2022)
2
+
3
+ ## Enhancements:
4
+
5
+ - Show better error when previous installation fails to be removed [#5564](https://github.com/rubygems/rubygems/pull/5564)
6
+ - Show exception cause in bug report template [#5563](https://github.com/rubygems/rubygems/pull/5563)
7
+
8
+ ## Bug fixes:
9
+
10
+ - Fix `bundle remove` by invalidating cached `Bundle.definition` [#5443](https://github.com/rubygems/rubygems/pull/5443)
11
+ - Fix generated standalone script when it includes default gems [#5586](https://github.com/rubygems/rubygems/pull/5586)
12
+ - Skip duplicated dependency warning for gemspec dev deps [#5587](https://github.com/rubygems/rubygems/pull/5587)
13
+ - Give better conflict resolution advice [#5581](https://github.com/rubygems/rubygems/pull/5581)
14
+ - Fix crash when commenting out a mirror in configuration [#5576](https://github.com/rubygems/rubygems/pull/5576)
15
+ - Fix crash when installing gems with symlinks [#5570](https://github.com/rubygems/rubygems/pull/5570)
16
+ - Ignore `Errno::EROFS` errors when creating `bundler.lock` [#5580](https://github.com/rubygems/rubygems/pull/5580)
17
+ - Ignore `Errno::EPERM` errors when creating `bundler.lock` [#5579](https://github.com/rubygems/rubygems/pull/5579)
18
+ - Fix crash when printing resolution conflicts on metadata requirements [#5562](https://github.com/rubygems/rubygems/pull/5562)
19
+
20
+ # 2.3.14 (May 18, 2022)
21
+
22
+ ## Bug fixes:
23
+
24
+ - Fix confusing inline mode install output [#5530](https://github.com/rubygems/rubygems/pull/5530)
25
+ - Fix error message when locked version of a gem does not support running Ruby [#5525](https://github.com/rubygems/rubygems/pull/5525)
26
+
27
+ ## Performance:
28
+
29
+ - Improve `bundler/setup` performance again by not deduplicating intermediate results [#5533](https://github.com/rubygems/rubygems/pull/5533)
30
+
31
+ ## Documentation:
32
+
33
+ - Fix typo in documentation [#5514](https://github.com/rubygems/rubygems/pull/5514)
34
+ - Update man page for `require` option in `bundle add` command [#5513](https://github.com/rubygems/rubygems/pull/5513)
35
+
36
+ # 2.3.13 (May 4, 2022)
37
+
38
+ ## Bug fixes:
39
+
40
+ - Fix missing required rubygems version when using old APIs [#5496](https://github.com/rubygems/rubygems/pull/5496)
41
+ - Fix crash when gem used twice in Gemfile under different platforms [#5187](https://github.com/rubygems/rubygems/pull/5187)
42
+
43
+ ## Performance:
44
+
45
+ - Speed up `bundler/setup` time [#5503](https://github.com/rubygems/rubygems/pull/5503)
46
+
1
47
  # 2.3.12 (April 20, 2022)
2
48
 
3
49
  ## Enhancements:
@@ -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 = "2022-04-20".freeze
8
- @git_commit_sha = "75031e03f4".freeze
7
+ @built_at = "2022-06-01".freeze
8
+ @git_commit_sha = "e7e41afd92".freeze
9
9
  @release = true
10
10
  # end ivars
11
11
 
@@ -40,7 +40,7 @@ module Bundler
40
40
  end
41
41
 
42
42
  def self.verbalize_groups(groups)
43
- groups.map!{|g| "'#{g}'" }
43
+ groups.map! {|g| "'#{g}'" }
44
44
  group_list = [groups[0...-1].join(", "), groups[-1..-1]].
45
45
  reject {|s| s.to_s.empty? }.join(" and ")
46
46
  group_str = groups.size == 1 ? "group" : "groups"
@@ -87,10 +87,11 @@ module Bundler
87
87
  @platforms = @locked_platforms.dup
88
88
  @locked_bundler_version = @locked_gems.bundler_version
89
89
  @locked_ruby_version = @locked_gems.ruby_version
90
+ @originally_locked_specs = SpecSet.new(@locked_gems.specs)
90
91
 
91
92
  if unlock != true
92
93
  @locked_deps = @locked_gems.dependencies
93
- @locked_specs = SpecSet.new(@locked_gems.specs)
94
+ @locked_specs = @originally_locked_specs
94
95
  @locked_sources = @locked_gems.sources
95
96
  else
96
97
  @unlock = {}
@@ -255,14 +256,14 @@ module Bundler
255
256
  # @return [SpecSet] resolved dependencies
256
257
  def resolve
257
258
  @resolve ||= begin
258
- last_resolve = converge_locked_specs
259
259
  if Bundler.frozen_bundle?
260
260
  Bundler.ui.debug "Frozen, using resolution from the lockfile"
261
- last_resolve
261
+ @locked_specs
262
262
  elsif !unlocking? && nothing_changed?
263
263
  Bundler.ui.debug("Found no changes, using resolution from the lockfile")
264
- last_resolve
264
+ SpecSet.new(filter_specs(@locked_specs, @dependencies.select {|dep| @locked_specs[dep].any? }))
265
265
  else
266
+ last_resolve = converge_locked_specs
266
267
  # Run a resolve against the locally available gems
267
268
  Bundler.ui.debug("Found changes from the lockfile, re-resolving dependencies because #{change_reason}")
268
269
  expanded_dependencies = expand_dependencies(dependencies + metadata_dependencies, true)
@@ -464,6 +465,10 @@ module Bundler
464
465
 
465
466
  private
466
467
 
468
+ def filter_specs(specs, deps)
469
+ SpecSet.new(specs).for(expand_dependencies(deps, true), false, false)
470
+ end
471
+
467
472
  def materialize(dependencies)
468
473
  specs = resolve.materialize(dependencies)
469
474
  missing_specs = specs.missing_specs
@@ -679,17 +684,17 @@ module Bundler
679
684
  end
680
685
 
681
686
  def converge_specs(specs)
682
- deps = []
683
687
  converged = []
688
+
689
+ deps = @dependencies.select do |dep|
690
+ specs[dep].any? {|s| s.satisfies?(dep) && (!dep.source || s.source.include?(dep.source)) }
691
+ end
692
+
684
693
  specs.each do |s|
685
694
  # Replace the locked dependency's source with the equivalent source from the Gemfile
686
695
  dep = @dependencies.find {|d| s.satisfies?(d) }
687
696
 
688
- if dep && (!dep.source || s.source.include?(dep.source))
689
- deps << dep
690
- end
691
-
692
- s.source = (dep && dep.source) || sources.get(s.source) || sources.default_source unless Bundler.frozen_bundle?
697
+ s.source = (dep && dep.source) || sources.get(s.source) || sources.default_source
693
698
 
694
699
  next if @unlock[:sources].include?(s.source.name)
695
700
 
@@ -726,8 +731,7 @@ module Bundler
726
731
  end
727
732
  end
728
733
 
729
- resolve = SpecSet.new(converged)
730
- SpecSet.new(resolve.for(expand_dependencies(deps, true), false, false).reject{|s| @unlock[:gems].include?(s.name) })
734
+ SpecSet.new(filter_specs(converged, deps).reject {|s| @unlock[:gems].include?(s.name) })
731
735
  end
732
736
 
733
737
  def metadata_dependencies
@@ -804,7 +808,7 @@ module Bundler
804
808
 
805
809
  def additional_base_requirements_for_resolve
806
810
  return [] unless @locked_gems && unlocking? && !sources.expired_sources?(@locked_gems.sources)
807
- converge_specs(@locked_gems.specs).map do |locked_spec|
811
+ converge_specs(@originally_locked_specs).map do |locked_spec|
808
812
  name = locked_spec.name
809
813
  dep = Gem::Dependency.new(name, ">= #{locked_spec.version}")
810
814
  DepProxy.get_proxy(dep, locked_spec.platform)
data/lib/bundler/dsl.rb CHANGED
@@ -46,7 +46,7 @@ module Bundler
46
46
  @gemfile = expanded_gemfile_path
47
47
  @gemfiles << expanded_gemfile_path
48
48
  contents ||= Bundler.read_file(@gemfile.to_s)
49
- instance_eval(contents.dup.tap{|x| x.untaint if RUBY_VERSION < "2.7" }, gemfile.to_s, 1)
49
+ instance_eval(contents.dup.tap {|x| x.untaint if RUBY_VERSION < "2.7" }, gemfile.to_s, 1)
50
50
  rescue Exception => e # rubocop:disable Lint/RescueException
51
51
  message = "There was an error " \
52
52
  "#{e.is_a?(GemfileEvalError) ? "evaluating" : "parsing"} " \
@@ -124,19 +124,17 @@ module Bundler
124
124
  raise GemfileError, "You cannot specify the same gem twice with different version requirements.\n" \
125
125
  "You specified: #{current.name} (#{current.requirement}) and #{dep.name} (#{dep.requirement})" \
126
126
  "#{update_prompt}"
127
+ elsif current.source != dep.source
128
+ return if dep.type == :development
129
+ raise GemfileError, "You cannot specify the same gem twice coming from different sources.\n" \
130
+ "You specified that #{dep.name} (#{dep.requirement}) should come from " \
131
+ "#{current.source || "an unspecified source"} and #{dep.source}\n"
127
132
  else
128
133
  Bundler.ui.warn "Your Gemfile lists the gem #{current.name} (#{current.requirement}) more than once.\n" \
129
134
  "You should probably keep only one of them.\n" \
130
135
  "Remove any duplicate entries and specify the gem only once.\n" \
131
136
  "While it's not a problem now, it could cause errors if you change the version of one of them later."
132
137
  end
133
-
134
- if current.source != dep.source
135
- return if dep.type == :development
136
- raise GemfileError, "You cannot specify the same gem twice coming from different sources.\n" \
137
- "You specified that #{dep.name} (#{dep.requirement}) should come from " \
138
- "#{current.source || "an unspecified source"} and #{dep.source}\n"
139
- end
140
138
  end
141
139
  end
142
140
 
@@ -26,8 +26,11 @@ module Bundler
26
26
  @required_ruby_version ||= _remote_specification.required_ruby_version
27
27
  end
28
28
 
29
+ # A fallback is included because the original version of the specification
30
+ # API didn't include that field, so some marshalled specs in the index have it
31
+ # set to +nil+.
29
32
  def required_rubygems_version
30
- @required_rubygems_version ||= _remote_specification.required_rubygems_version
33
+ @required_rubygems_version ||= _remote_specification.required_rubygems_version || Gem::Requirement.default
31
34
  end
32
35
 
33
36
  def fetch_platform
@@ -79,10 +79,6 @@ module Bundler
79
79
  case @permission_type
80
80
  when :create
81
81
  "executable permissions for all parent directories and write permissions for `#{parent_folder}`"
82
- when :delete
83
- permissions = "executable permissions for all parent directories and write permissions for `#{parent_folder}`"
84
- permissions += ", and the same thing for all subdirectories inside #{@path}" if File.directory?(@path)
85
- permissions
86
82
  else
87
83
  "#{@permission_type} permissions for that path"
88
84
  end
@@ -172,4 +168,16 @@ module Bundler
172
168
 
173
169
  status_code(32)
174
170
  end
171
+
172
+ class DirectoryRemovalError < BundlerError
173
+ def initialize(orig_exception, msg)
174
+ full_message = "#{msg}.\n" \
175
+ "The underlying error was #{orig_exception.class}: #{orig_exception.message}, with backtrace:\n" \
176
+ " #{orig_exception.backtrace.join("\n ")}\n\n" \
177
+ "Bundler Error Backtrace:"
178
+ super(full_message)
179
+ end
180
+
181
+ status_code(36)
182
+ end
175
183
  end
@@ -65,8 +65,7 @@ module Bundler
65
65
  --- ERROR REPORT TEMPLATE -------------------------------------------------------
66
66
 
67
67
  ```
68
- #{e.class}: #{e.message}
69
- #{e.backtrace && e.backtrace.join("\n ").chomp}
68
+ #{exception_message(e)}
70
69
  ```
71
70
 
72
71
  #{Bundler::Env.report}
@@ -85,6 +84,21 @@ module Bundler
85
84
  EOS
86
85
  end
87
86
 
87
+ def exception_message(error)
88
+ message = serialized_exception_for(error)
89
+ cause = error.cause
90
+ return message unless cause
91
+
92
+ message + serialized_exception_for(cause)
93
+ end
94
+
95
+ def serialized_exception_for(e)
96
+ <<-EOS.gsub(/^ {8}/, "")
97
+ #{e.class}: #{e.message}
98
+ #{e.backtrace && e.backtrace.join("\n ").chomp}
99
+ EOS
100
+ end
101
+
88
102
  def issues_url(exception)
89
103
  message = exception.message.lines.first.tr(":", " ").chomp
90
104
  message = message.split("-").first if exception.is_a?(Errno)
@@ -48,7 +48,7 @@ module Bundler
48
48
  sorted_matching = matching.sort_by {|spec| platform_specificity_match(spec.platform, platform) }
49
49
  exemplary_spec = sorted_matching.first
50
50
 
51
- sorted_matching.take_while{|spec| same_specificity(platform, spec, exemplary_spec) && same_deps(spec, exemplary_spec) }
51
+ sorted_matching.take_while {|spec| same_specificity(platform, spec, exemplary_spec) && same_deps(spec, exemplary_spec) }
52
52
  end
53
53
  module_function :select_best_platform_match
54
54
 
@@ -72,6 +72,10 @@ module Bundler
72
72
 
73
73
  deps.each {|dep| Bundler.ui.confirm "#{SharedHelpers.pretty_dependency(dep, false)} was removed." }
74
74
  end
75
+
76
+ # Invalidate the cached Bundler.definition.
77
+ # This prevents e.g. `bundle remove ...` from using outdated information.
78
+ Bundler.reset_paths!
75
79
  end
76
80
 
77
81
  private
@@ -38,12 +38,7 @@ def gemfile(install = false, options = {}, &gemfile)
38
38
  raise ArgumentError, "Unknown options: #{opts.keys.join(", ")}" unless opts.empty?
39
39
 
40
40
  begin
41
- old_root = Bundler.method(:root)
42
- bundler_module = class << Bundler; self; end
43
- bundler_module.send(:remove_method, :root)
44
- def Bundler.root
45
- Bundler::SharedHelpers.pwd.expand_path
46
- end
41
+ Bundler.instance_variable_set(:@bundle_path, Pathname.new(Gem.dir))
47
42
  old_gemfile = ENV["BUNDLE_GEMFILE"]
48
43
  Bundler::SharedHelpers.set_env "BUNDLE_GEMFILE", "Gemfile"
49
44
 
@@ -71,11 +66,6 @@ def gemfile(install = false, options = {}, &gemfile)
71
66
  runtime.setup.require
72
67
  end
73
68
  ensure
74
- if bundler_module
75
- bundler_module.send(:remove_method, :root)
76
- bundler_module.send(:define_method, :root, old_root)
77
- end
78
-
79
69
  if old_gemfile
80
70
  ENV["BUNDLE_GEMFILE"] = old_gemfile
81
71
  else
@@ -51,7 +51,20 @@ module Bundler
51
51
  end
52
52
 
53
53
  def install
54
- spec.source.install(spec, :force => force, :ensure_builtin_gems_cached => standalone, :build_args => Array(spec_settings))
54
+ spec.source.install(
55
+ spec,
56
+ :force => force,
57
+ :ensure_builtin_gems_cached => standalone,
58
+ :build_args => Array(spec_settings),
59
+ :previous_spec => previous_spec,
60
+ )
61
+ end
62
+
63
+ def previous_spec
64
+ locked_gems = installer.definition.locked_gems
65
+ return unless locked_gems
66
+
67
+ locked_gems.specs.find {|s| s.name == spec.name }
55
68
  end
56
69
 
57
70
  def out_of_space_message
@@ -13,7 +13,7 @@ module Bundler
13
13
  Installer.ambiguous_gems = []
14
14
  end
15
15
 
16
- attr_reader :post_install_messages
16
+ attr_reader :post_install_messages, :definition
17
17
 
18
18
  # Begins the installation process for Bundler.
19
19
  # For more information see the #run method on this class.
@@ -66,7 +66,7 @@ module Bundler
66
66
  # require paths and save them in a `setup.rb` file. See `bundle standalone --help` for more
67
67
  # information.
68
68
  def run(options)
69
- create_bundle_path
69
+ Bundler.create_bundle_path
70
70
 
71
71
  ProcessLock.lock do
72
72
  if Bundler.frozen_bundle?
@@ -262,15 +262,6 @@ module Bundler
262
262
  end
263
263
  end
264
264
 
265
- def create_bundle_path
266
- SharedHelpers.filesystem_access(Bundler.bundle_path.to_s) do |p|
267
- Bundler.mkdir_p(p)
268
- end unless Bundler.bundle_path.exist?
269
- rescue Errno::EEXIST
270
- raise PathError, "Could not install to path `#{Bundler.bundle_path}` " \
271
- "because a file already exists at that path. Either remove or rename the file so the directory can be created."
272
- end
273
-
274
265
  # returns whether or not a re-resolve was needed
275
266
  def resolve_if_needed(options)
276
267
  if !@definition.unlocking? && !options["force"] && !Bundler.settings[:inline] && Bundler.default_lockfile.file?
@@ -94,7 +94,7 @@ module Bundler
94
94
  (spec.required_ruby_version.satisfied_by?(Gem.ruby_version) &&
95
95
  spec.required_rubygems_version.satisfied_by?(Gem.rubygems_version))
96
96
  end
97
- search = installable_candidates.last
97
+ search = installable_candidates.last || same_platform_candidates.last
98
98
  search.dependencies = dependencies if search && (search.is_a?(RemoteSpecification) || search.is_a?(EndpointSpecification))
99
99
  search
100
100
  end
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "BUNDLE\-ADD" "1" "March 2022" "" ""
4
+ .TH "BUNDLE\-ADD" "1" "May 2022" "" ""
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBbundle\-add\fR \- Add gem to the Gemfile and run bundle install
@@ -45,6 +45,10 @@ Specify the group(s) for the added gem\. Multiple groups should be separated by
45
45
  Specify the source for the added gem\.
46
46
  .
47
47
  .TP
48
+ \fB\-\-require\fR, \fB\-r\fR
49
+ Adds require path to gem\. Provide false, or a path as a string\.
50
+ .
51
+ .TP
48
52
  \fB\-\-git\fR
49
53
  Specify the git source for the added gem\.
50
54
  .
@@ -66,9 +70,9 @@ Adds the gem to the Gemfile but does not install it\.
66
70
  .
67
71
  .TP
68
72
  \fB\-\-optimistic\fR
69
- Adds optimistic declaration of version
73
+ Adds optimistic declaration of version\.
70
74
  .
71
75
  .TP
72
76
  \fB\-\-strict\fR
73
- Adds strict declaration of version
77
+ Adds strict declaration of version\.
74
78
 
@@ -30,6 +30,9 @@ bundle add rails --group "development, test"
30
30
  * `--source`, , `-s`:
31
31
  Specify the source for the added gem.
32
32
 
33
+ * `--require`, `-r`:
34
+ Adds require path to gem. Provide false, or a path as a string.
35
+
33
36
  * `--git`:
34
37
  Specify the git source for the added gem.
35
38
 
@@ -46,7 +49,7 @@ bundle add rails --group "development, test"
46
49
  Adds the gem to the Gemfile but does not install it.
47
50
 
48
51
  * `--optimistic`:
49
- Adds optimistic declaration of version
52
+ Adds optimistic declaration of version.
50
53
 
51
54
  * `--strict`:
52
- Adds strict declaration of version
55
+ Adds strict declaration of version.
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "BUNDLE\-BINSTUBS" "1" "March 2022" "" ""
4
+ .TH "BUNDLE\-BINSTUBS" "1" "May 2022" "" ""
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBbundle\-binstubs\fR \- Install the binstubs of the listed gems
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "BUNDLE\-CACHE" "1" "March 2022" "" ""
4
+ .TH "BUNDLE\-CACHE" "1" "May 2022" "" ""
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBbundle\-cache\fR \- Package your needed \fB\.gem\fR files into your application
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "BUNDLE\-CHECK" "1" "March 2022" "" ""
4
+ .TH "BUNDLE\-CHECK" "1" "May 2022" "" ""
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBbundle\-check\fR \- Verifies if dependencies are satisfied by installed gems
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "BUNDLE\-CLEAN" "1" "March 2022" "" ""
4
+ .TH "BUNDLE\-CLEAN" "1" "May 2022" "" ""
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBbundle\-clean\fR \- Cleans up unused gems in your bundler directory
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "BUNDLE\-CONFIG" "1" "March 2022" "" ""
4
+ .TH "BUNDLE\-CONFIG" "1" "May 2022" "" ""
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBbundle\-config\fR \- Set bundler configuration options
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "BUNDLE\-DOCTOR" "1" "March 2022" "" ""
4
+ .TH "BUNDLE\-DOCTOR" "1" "May 2022" "" ""
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBbundle\-doctor\fR \- Checks the bundle for common problems
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "BUNDLE\-EXEC" "1" "March 2022" "" ""
4
+ .TH "BUNDLE\-EXEC" "1" "May 2022" "" ""
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBbundle\-exec\fR \- Execute a command in the context of the bundle
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "BUNDLE\-GEM" "1" "March 2022" "" ""
4
+ .TH "BUNDLE\-GEM" "1" "May 2022" "" ""
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBbundle\-gem\fR \- Generate a project skeleton for creating a rubygem
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "BUNDLE\-INFO" "1" "March 2022" "" ""
4
+ .TH "BUNDLE\-INFO" "1" "May 2022" "" ""
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBbundle\-info\fR \- Show information for the given gem in your bundle
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "BUNDLE\-INIT" "1" "March 2022" "" ""
4
+ .TH "BUNDLE\-INIT" "1" "May 2022" "" ""
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBbundle\-init\fR \- Generates a Gemfile into the current working directory
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "BUNDLE\-INJECT" "1" "March 2022" "" ""
4
+ .TH "BUNDLE\-INJECT" "1" "May 2022" "" ""
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBbundle\-inject\fR \- Add named gem(s) with version requirements to Gemfile
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "BUNDLE\-INSTALL" "1" "March 2022" "" ""
4
+ .TH "BUNDLE\-INSTALL" "1" "May 2022" "" ""
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBbundle\-install\fR \- Install the dependencies specified in your Gemfile
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "BUNDLE\-LIST" "1" "March 2022" "" ""
4
+ .TH "BUNDLE\-LIST" "1" "May 2022" "" ""
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBbundle\-list\fR \- List all the gems in the bundle
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "BUNDLE\-LOCK" "1" "March 2022" "" ""
4
+ .TH "BUNDLE\-LOCK" "1" "May 2022" "" ""
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBbundle\-lock\fR \- Creates / Updates a lockfile without installing
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "BUNDLE\-OPEN" "1" "March 2022" "" ""
4
+ .TH "BUNDLE\-OPEN" "1" "May 2022" "" ""
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBbundle\-open\fR \- Opens the source directory for a gem in your bundle
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "BUNDLE\-OUTDATED" "1" "March 2022" "" ""
4
+ .TH "BUNDLE\-OUTDATED" "1" "May 2022" "" ""
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBbundle\-outdated\fR \- List installed gems with newer versions available
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "BUNDLE\-PLATFORM" "1" "March 2022" "" ""
4
+ .TH "BUNDLE\-PLATFORM" "1" "May 2022" "" ""
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBbundle\-platform\fR \- Displays platform compatibility information
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "BUNDLE\-PRISTINE" "1" "March 2022" "" ""
4
+ .TH "BUNDLE\-PRISTINE" "1" "May 2022" "" ""
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBbundle\-pristine\fR \- Restores installed gems to their pristine condition
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "BUNDLE\-REMOVE" "1" "March 2022" "" ""
4
+ .TH "BUNDLE\-REMOVE" "1" "May 2022" "" ""
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBbundle\-remove\fR \- Removes gems from the Gemfile
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "BUNDLE\-SHOW" "1" "March 2022" "" ""
4
+ .TH "BUNDLE\-SHOW" "1" "May 2022" "" ""
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBbundle\-show\fR \- Shows all the gems in your bundle, or the path to a gem
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "BUNDLE\-UPDATE" "1" "March 2022" "" ""
4
+ .TH "BUNDLE\-UPDATE" "1" "May 2022" "" ""
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBbundle\-update\fR \- Update your gems to the latest available versions
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "BUNDLE\-VIZ" "1" "March 2022" "" ""
4
+ .TH "BUNDLE\-VIZ" "1" "May 2022" "" ""
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBbundle\-viz\fR \- Generates a visual dependency graph for your Gemfile
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "BUNDLE" "1" "March 2022" "" ""
4
+ .TH "BUNDLE" "1" "May 2022" "" ""
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBbundle\fR \- Ruby Dependency Management
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "GEMFILE" "5" "March 2022" "" ""
4
+ .TH "GEMFILE" "5" "May 2022" "" ""
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBGemfile\fR \- A format for describing gem dependencies for Ruby programs
@@ -20,10 +20,6 @@ module Bundler
20
20
  end
21
21
  end
22
22
 
23
- def version_message(spec)
24
- "#{spec.name} #{spec.version}"
25
- end
26
-
27
23
  def root
28
24
  Plugin.root
29
25
  end
@@ -4,10 +4,6 @@ module Bundler
4
4
  module Plugin
5
5
  class Installer
6
6
  class Rubygems < Bundler::Source::Rubygems
7
- def version_message(spec)
8
- "#{spec.name} #{spec.version}"
9
- end
10
-
11
7
  private
12
8
 
13
9
  def requires_sudo?
@@ -12,7 +12,7 @@ module Bundler
12
12
  yield
13
13
  f.flock(File::LOCK_UN)
14
14
  end
15
- rescue Errno::EACCES, Errno::ENOLCK, Errno::ENOTSUP
15
+ rescue Errno::EACCES, Errno::ENOLCK, Errno::ENOTSUP, Errno::EPERM, Errno::EROFS
16
16
  # In the case the user does not have access to
17
17
  # create the lock file or is using NFS where
18
18
  # locks are not available we skip locking.
@@ -19,13 +19,15 @@ module Bundler
19
19
  # collection of gemspecs is returned. Otherwise, nil is returned.
20
20
  def self.resolve(requirements, source_requirements = {}, base = [], gem_version_promoter = GemVersionPromoter.new, additional_base_requirements = [], platforms = nil)
21
21
  base = SpecSet.new(base) unless base.is_a?(SpecSet)
22
- resolver = new(source_requirements, base, gem_version_promoter, additional_base_requirements, platforms)
22
+ metadata_requirements, regular_requirements = requirements.partition {|dep| dep.name.end_with?("\0") }
23
+ resolver = new(source_requirements, base, gem_version_promoter, additional_base_requirements, platforms, metadata_requirements)
23
24
  result = resolver.start(requirements)
24
- SpecSet.new(SpecSet.new(result).for(requirements.reject{|dep| dep.name.end_with?("\0") }))
25
+ SpecSet.new(SpecSet.new(result).for(regular_requirements))
25
26
  end
26
27
 
27
- def initialize(source_requirements, base, gem_version_promoter, additional_base_requirements, platforms)
28
+ def initialize(source_requirements, base, gem_version_promoter, additional_base_requirements, platforms, metadata_requirements)
28
29
  @source_requirements = source_requirements
30
+ @metadata_requirements = metadata_requirements
29
31
  @base = base
30
32
  @resolver = Molinillo::Resolver.new(self, self)
31
33
  @search_for = {}
@@ -344,8 +346,6 @@ module Bundler
344
346
  trees.sort_by! {|t| t.reverse.map(&:name) }
345
347
  end
346
348
 
347
- metadata_requirements = {}
348
-
349
349
  o << trees.map do |tree|
350
350
  t = "".dup
351
351
  depth = 2
@@ -354,7 +354,6 @@ module Bundler
354
354
  base_tree_name = base_tree.name
355
355
 
356
356
  if base_tree_name.end_with?("\0")
357
- metadata_requirements[base_tree_name] = base_tree
358
357
  t = nil
359
358
  else
360
359
  tree.each do |req|
@@ -393,10 +392,10 @@ module Bundler
393
392
  end
394
393
  end
395
394
  elsif name.end_with?("\0")
396
- o << %(\n Current #{name} version:\n #{SharedHelpers.pretty_dependency(metadata_requirements[name])}\n\n)
395
+ o << %(\n Current #{name} version:\n #{SharedHelpers.pretty_dependency(@metadata_requirements.find {|req| req.name == name })}\n\n)
397
396
  elsif conflict.locked_requirement
398
397
  o << "\n"
399
- o << %(Running `bundle update` will rebuild your snapshot from scratch, using only\n)
398
+ o << %(Deleting your #{name_for_locking_dependency_source} file and running `bundle install` will rebuild your snapshot from scratch, using only\n)
400
399
  o << %(the gems in your Gemfile, which may resolve the conflict.\n)
401
400
  elsif !conflict.existing
402
401
  o << "\n"
@@ -34,7 +34,7 @@ module Gem
34
34
 
35
35
  def full_gem_path
36
36
  if source.respond_to?(:root)
37
- Pathname.new(loaded_from).dirname.expand_path(source.root).to_s.tap{|x| x.untaint if RUBY_VERSION < "2.7" }
37
+ Pathname.new(loaded_from).dirname.expand_path(source.root).to_s.tap {|x| x.untaint if RUBY_VERSION < "2.7" }
38
38
  else
39
39
  rg_full_gem_path
40
40
  end
@@ -93,14 +93,9 @@ module Bundler
93
93
  private
94
94
 
95
95
  def strict_rm_rf(dir)
96
- # FileUtils.rm_rf should probably rise in case of permission issues like
97
- # `rm -rf` does. However, it fails to delete the folder silently due to
98
- # https://github.com/ruby/fileutils/issues/57. It should probably be fixed
99
- # inside `fileutils` but for now I`m checking whether the folder was
100
- # removed after it completes, and raising otherwise.
101
- FileUtils.rm_rf dir
102
-
103
- raise PermissionError.new(dir, :delete) if File.directory?(dir)
96
+ Bundler.rm_rf dir
97
+ rescue Errno::ENOTEMPTY => e
98
+ raise DirectoryRemovalError.new(e.cause, "Could not delete previous installation of `#{dir}`")
104
99
  end
105
100
 
106
101
  def validate_bundler_checksum(checksum)
@@ -487,7 +487,7 @@ module Bundler
487
487
  /ix.freeze
488
488
 
489
489
  def self.key_for(key)
490
- key = normalize_uri(key).to_s if key.is_a?(String) && /https?:/ =~ key
490
+ key = normalize_uri(key).to_s if key.is_a?(String) && key.start_with?("http", "mirror.http")
491
491
  key = key.to_s.gsub(".", "__").gsub("-", "___").upcase
492
492
  "BUNDLE_#{key}"
493
493
  end
@@ -13,13 +13,13 @@ module Bundler
13
13
  def root
14
14
  gemfile = find_gemfile
15
15
  raise GemfileNotFound, "Could not locate Gemfile" unless gemfile
16
- Pathname.new(gemfile).tap{|x| x.untaint if RUBY_VERSION < "2.7" }.expand_path.parent
16
+ Pathname.new(gemfile).tap {|x| x.untaint if RUBY_VERSION < "2.7" }.expand_path.parent
17
17
  end
18
18
 
19
19
  def default_gemfile
20
20
  gemfile = find_gemfile
21
21
  raise GemfileNotFound, "Could not locate Gemfile" unless gemfile
22
- Pathname.new(gemfile).tap{|x| x.untaint if RUBY_VERSION < "2.7" }.expand_path
22
+ Pathname.new(gemfile).tap {|x| x.untaint if RUBY_VERSION < "2.7" }.expand_path
23
23
  end
24
24
 
25
25
  def default_lockfile
@@ -28,7 +28,7 @@ module Bundler
28
28
  case gemfile.basename.to_s
29
29
  when "gems.rb" then Pathname.new(gemfile.sub(/.rb$/, ".locked"))
30
30
  else Pathname.new("#{gemfile}.lock")
31
- end.tap{|x| x.untaint if RUBY_VERSION < "2.7" }
31
+ end.tap {|x| x.untaint if RUBY_VERSION < "2.7" }
32
32
  end
33
33
 
34
34
  def default_bundle_dir
@@ -100,7 +100,7 @@ module Bundler
100
100
  #
101
101
  # @see {Bundler::PermissionError}
102
102
  def filesystem_access(path, action = :write, &block)
103
- yield(path.dup.tap{|x| x.untaint if RUBY_VERSION < "2.7" })
103
+ yield(path.dup.tap {|x| x.untaint if RUBY_VERSION < "2.7" })
104
104
  rescue Errno::EACCES
105
105
  raise PermissionError.new(path, action)
106
106
  rescue Errno::EAGAIN
@@ -236,7 +236,7 @@ module Bundler
236
236
 
237
237
  def search_up(*names)
238
238
  previous = nil
239
- current = File.expand_path(SharedHelpers.pwd).tap{|x| x.untaint if RUBY_VERSION < "2.7" }
239
+ current = File.expand_path(SharedHelpers.pwd).tap {|x| x.untaint if RUBY_VERSION < "2.7" }
240
240
 
241
241
  until !File.directory?(current) || current == previous
242
242
  if ENV["BUNDLER_SPEC_RUN"]
@@ -181,7 +181,7 @@ module Bundler
181
181
  def install(spec, options = {})
182
182
  force = options[:force]
183
183
 
184
- print_using_message "Using #{version_message(spec)} from #{self}"
184
+ print_using_message "Using #{version_message(spec, options[:previous_spec])} from #{self}"
185
185
 
186
186
  if (requires_checkout? && !@copied) || force
187
187
  Bundler.ui.debug " * Checking out revision: #{ref}"
@@ -336,7 +336,7 @@ module Bundler
336
336
 
337
337
  def load_gemspec(file)
338
338
  stub = Gem::StubSpecification.gemspec_stub(file, install_path.parent, install_path.parent)
339
- stub.full_gem_path = Pathname.new(file).dirname.expand_path(root).to_s.tap{|x| x.untaint if RUBY_VERSION < "2.7" }
339
+ stub.full_gem_path = Pathname.new(file).dirname.expand_path(root).to_s.tap {|x| x.untaint if RUBY_VERSION < "2.7" }
340
340
  StubSpecification.from_stub(stub)
341
341
  end
342
342
 
@@ -82,7 +82,7 @@ module Bundler
82
82
  end
83
83
 
84
84
  def install(spec, options = {})
85
- using_message = "Using #{version_message(spec)} from #{self}"
85
+ using_message = "Using #{version_message(spec, options[:previous_spec])} from #{self}"
86
86
  using_message += " and installing its executables" unless spec.executables.empty?
87
87
  print_using_message using_message
88
88
  generate_bin(spec, :disable_extensions => true)
@@ -135,9 +135,9 @@ module Bundler
135
135
  end
136
136
  end
137
137
 
138
- def install(spec, opts = {})
139
- force = opts[:force]
140
- ensure_builtin_gems_cached = opts[:ensure_builtin_gems_cached]
138
+ def install(spec, options = {})
139
+ force = options[:force]
140
+ ensure_builtin_gems_cached = options[:ensure_builtin_gems_cached]
141
141
 
142
142
  if ensure_builtin_gems_cached && spec.default_gem?
143
143
  if !cached_path(spec)
@@ -162,7 +162,7 @@ module Bundler
162
162
  uris.uniq!
163
163
  Installer.ambiguous_gems << [spec.name, *uris] if uris.length > 1
164
164
 
165
- path = fetch_gem(spec)
165
+ path = fetch_gem(spec, options[:previous_spec])
166
166
  begin
167
167
  s = Bundler.rubygems.spec_from_gem(path, Bundler.settings["trust-policy"])
168
168
  spec.__swap__(s)
@@ -173,7 +173,7 @@ module Bundler
173
173
  end
174
174
 
175
175
  unless Bundler.settings[:no_install]
176
- message = "Installing #{version_message(spec)}"
176
+ message = "Installing #{version_message(spec, options[:previous_spec])}"
177
177
  message += " with native extensions" if spec.extensions.any?
178
178
  Bundler.ui.confirm message
179
179
 
@@ -198,7 +198,7 @@ module Bundler
198
198
  :ignore_dependencies => true,
199
199
  :wrappers => true,
200
200
  :env_shebang => true,
201
- :build_args => opts[:build_args],
201
+ :build_args => options[:build_args],
202
202
  :bundler_expected_checksum => spec.respond_to?(:checksum) && spec.checksum,
203
203
  :bundler_extension_cache_path => extension_cache_path(spec)
204
204
  ).install
@@ -458,7 +458,7 @@ module Bundler
458
458
  end
459
459
  end
460
460
 
461
- def fetch_gem(spec)
461
+ def fetch_gem(spec, previous_spec = nil)
462
462
  return false unless spec.remote
463
463
 
464
464
  spec.fetch_platform
@@ -476,7 +476,7 @@ module Bundler
476
476
  SharedHelpers.filesystem_access(download_cache_path) do |p|
477
477
  FileUtils.mkdir_p(p)
478
478
  end
479
- download_gem(spec, download_cache_path)
479
+ download_gem(spec, download_cache_path, previous_spec)
480
480
 
481
481
  if requires_sudo?
482
482
  SharedHelpers.filesystem_access(cache_path) do |p|
@@ -499,7 +499,7 @@ module Bundler
499
499
  end
500
500
 
501
501
  def rubygems_dir
502
- Bundler.rubygems.gem_dir
502
+ Bundler.bundle_path
503
503
  end
504
504
 
505
505
  def default_cache_path_for(dir)
@@ -521,9 +521,12 @@ module Bundler
521
521
  # @param [String] download_cache_path
522
522
  # the local directory the .gem will end up in.
523
523
  #
524
- def download_gem(spec, download_cache_path)
524
+ # @param [Specification] previous_spec
525
+ # the spec previously locked
526
+ #
527
+ def download_gem(spec, download_cache_path, previous_spec = nil)
525
528
  uri = spec.remote.uri
526
- Bundler.ui.confirm("Fetching #{version_message(spec)}")
529
+ Bundler.ui.confirm("Fetching #{version_message(spec, previous_spec)}")
527
530
  Bundler.rubygems.download_gem(spec, uri, download_cache_path)
528
531
  end
529
532
 
@@ -15,13 +15,12 @@ module Bundler
15
15
  specs.unmet_dependency_names
16
16
  end
17
17
 
18
- def version_message(spec)
18
+ def version_message(spec, locked_spec = nil)
19
19
  message = "#{spec.name} #{spec.version}"
20
20
  message += " (#{spec.platform})" if spec.platform != Gem::Platform::RUBY && !spec.platform.nil?
21
21
 
22
- if Bundler.locked_gems
23
- locked_spec = Bundler.locked_gems.specs.find {|s| s.name == spec.name }
24
- locked_spec_version = locked_spec.version if locked_spec
22
+ if locked_spec
23
+ locked_spec_version = locked_spec.version
25
24
  if locked_spec_version && spec.version != locked_spec_version
26
25
  message += Bundler.ui.add_color(" (was #{locked_spec_version})", version_color(spec.version, locked_spec_version))
27
26
  end
@@ -18,13 +18,13 @@ module Bundler
18
18
 
19
19
  loop do
20
20
  break unless dep = deps.shift
21
- next if handled.any?{|d| d.name == dep.name && (match_current_platform || d.__platform == dep.__platform) } || dep.name == "bundler"
21
+ next if handled.any? {|d| d.name == dep.name && (match_current_platform || d.__platform == dep.__platform) } || dep.name == "bundler"
22
22
 
23
23
  handled << dep
24
24
 
25
25
  specs_for_dep = spec_for_dependency(dep, match_current_platform)
26
26
  if specs_for_dep.any?
27
- match_current_platform ? specs += specs_for_dep : specs |= specs_for_dep
27
+ specs.concat(specs_for_dep)
28
28
 
29
29
  specs_for_dep.first.dependencies.each do |d|
30
30
  next if d.type == :development
@@ -40,6 +40,8 @@ module Bundler
40
40
  specs << spec
41
41
  end
42
42
 
43
+ specs.uniq! unless match_current_platform
44
+
43
45
  check ? true : specs
44
46
  end
45
47
 
@@ -172,7 +174,7 @@ module Bundler
172
174
  def spec_for_dependency(dep, match_current_platform)
173
175
  specs_for_platforms = lookup[dep.name]
174
176
  if match_current_platform
175
- GemHelpers.select_best_platform_match(specs_for_platforms.select{|s| Gem::Platform.match_spec?(s) }, Bundler.local_platform)
177
+ GemHelpers.select_best_platform_match(specs_for_platforms.select {|s| Gem::Platform.match_spec?(s) }, Bundler.local_platform)
176
178
  else
177
179
  GemHelpers.select_best_platform_match(specs_for_platforms, dep.__platform)
178
180
  end
@@ -64,9 +64,11 @@ module Bundler
64
64
  end
65
65
 
66
66
  def full_gem_path
67
- # deleted gems can have their stubs return nil, so in that case grab the
68
- # expired path from the full spec
69
- stub.full_gem_path || method_missing(:full_gem_path)
67
+ stub.full_gem_path
68
+ end
69
+
70
+ def full_gem_path=(path)
71
+ stub.full_gem_path = path
70
72
  end
71
73
 
72
74
  def full_require_paths
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: false
2
2
 
3
3
  module Bundler
4
- VERSION = "2.3.12".freeze
4
+ VERSION = "2.3.15".freeze
5
5
 
6
6
  def self.bundler_major_version
7
7
  @bundler_major_version ||= VERSION.split(".").first.to_i
data/lib/bundler.rb CHANGED
@@ -19,7 +19,7 @@ require_relative "bundler/build_metadata"
19
19
  #
20
20
  # Since Ruby 2.6, Bundler is a part of Ruby's standard library.
21
21
  #
22
- # Bunder is used by creating _gemfiles_ listing all the project dependencies
22
+ # Bundler is used by creating _gemfiles_ listing all the project dependencies
23
23
  # and (optionally) their versions and then using
24
24
  #
25
25
  # require 'bundler/setup'
@@ -97,6 +97,17 @@ module Bundler
97
97
  @bundle_path ||= Pathname.new(configured_bundle_path.path).expand_path(root)
98
98
  end
99
99
 
100
+ def create_bundle_path
101
+ SharedHelpers.filesystem_access(bundle_path.to_s) do |p|
102
+ mkdir_p(p)
103
+ end unless bundle_path.exist?
104
+
105
+ @bundle_path = bundle_path.realpath
106
+ rescue Errno::EEXIST
107
+ raise PathError, "Could not install to path `#{bundle_path}` " \
108
+ "because a file already exists at that path. Either remove or rename the file so the directory can be created."
109
+ end
110
+
100
111
  def configured_bundle_path
101
112
  @configured_bundle_path ||= settings.path.tap(&:validate!)
102
113
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bundler
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.12
4
+ version: 2.3.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - André Arko
@@ -22,7 +22,7 @@ authors:
22
22
  autorequire:
23
23
  bindir: exe
24
24
  cert_chain: []
25
- date: 2022-04-20 00:00:00.000000000 Z
25
+ date: 2022-06-01 00:00:00.000000000 Z
26
26
  dependencies: []
27
27
  description: Bundler manages an application's dependencies through its entire life,
28
28
  across many machines, systematically and repeatably
@@ -369,7 +369,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
369
369
  - !ruby/object:Gem::Version
370
370
  version: 2.5.2
371
371
  requirements: []
372
- rubygems_version: 3.3.12
372
+ rubygems_version: 3.3.15
373
373
  signing_key:
374
374
  specification_version: 4
375
375
  summary: The best way to manage your application's dependencies