bundler 2.3.13 → 2.3.16

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +41 -0
  3. data/lib/bundler/build_metadata.rb +2 -2
  4. data/lib/bundler/cli/cache.rb +1 -1
  5. data/lib/bundler/cli/common.rb +1 -1
  6. data/lib/bundler/cli/install.rb +0 -2
  7. data/lib/bundler/cli.rb +2 -6
  8. data/lib/bundler/definition.rb +17 -21
  9. data/lib/bundler/dependency.rb +2 -0
  10. data/lib/bundler/dsl.rb +7 -11
  11. data/lib/bundler/errors.rb +14 -4
  12. data/lib/bundler/fetcher/base.rb +6 -8
  13. data/lib/bundler/fetcher.rb +4 -0
  14. data/lib/bundler/friendly_errors.rb +16 -2
  15. data/lib/bundler/gem_helpers.rb +1 -1
  16. data/lib/bundler/injector.rb +4 -0
  17. data/lib/bundler/inline.rb +1 -11
  18. data/lib/bundler/installer/gem_installer.rb +14 -1
  19. data/lib/bundler/installer.rb +2 -11
  20. data/lib/bundler/lazy_specification.rb +1 -1
  21. data/lib/bundler/man/bundle-add.1 +7 -3
  22. data/lib/bundler/man/bundle-add.1.ronn +5 -2
  23. data/lib/bundler/man/bundle-binstubs.1 +1 -1
  24. data/lib/bundler/man/bundle-cache.1 +1 -1
  25. data/lib/bundler/man/bundle-check.1 +1 -1
  26. data/lib/bundler/man/bundle-clean.1 +1 -1
  27. data/lib/bundler/man/bundle-config.1 +1 -1
  28. data/lib/bundler/man/bundle-doctor.1 +1 -1
  29. data/lib/bundler/man/bundle-exec.1 +1 -1
  30. data/lib/bundler/man/bundle-gem.1 +1 -1
  31. data/lib/bundler/man/bundle-info.1 +1 -1
  32. data/lib/bundler/man/bundle-init.1 +1 -1
  33. data/lib/bundler/man/bundle-inject.1 +1 -1
  34. data/lib/bundler/man/bundle-install.1 +1 -1
  35. data/lib/bundler/man/bundle-list.1 +1 -1
  36. data/lib/bundler/man/bundle-lock.1 +1 -1
  37. data/lib/bundler/man/bundle-open.1 +1 -1
  38. data/lib/bundler/man/bundle-outdated.1 +1 -1
  39. data/lib/bundler/man/bundle-platform.1 +1 -1
  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-viz.1 +1 -1
  45. data/lib/bundler/man/bundle.1 +1 -1
  46. data/lib/bundler/man/gemfile.5 +1 -1
  47. data/lib/bundler/plugin/api/source.rb +3 -3
  48. data/lib/bundler/plugin/installer/git.rb +0 -4
  49. data/lib/bundler/plugin/installer/rubygems.rb +0 -4
  50. data/lib/bundler/process_lock.rb +1 -1
  51. data/lib/bundler/resolver.rb +17 -20
  52. data/lib/bundler/rubygems_ext.rb +1 -1
  53. data/lib/bundler/rubygems_gem_installer.rb +11 -8
  54. data/lib/bundler/rubygems_integration.rb +3 -21
  55. data/lib/bundler/settings.rb +1 -1
  56. data/lib/bundler/shared_helpers.rb +5 -5
  57. data/lib/bundler/source/git.rb +7 -9
  58. data/lib/bundler/source/path.rb +1 -1
  59. data/lib/bundler/source/rubygems.rb +90 -86
  60. data/lib/bundler/source.rb +3 -4
  61. data/lib/bundler/spec_set.rb +5 -3
  62. data/lib/bundler/stub_specification.rb +5 -3
  63. data/lib/bundler/version.rb +1 -1
  64. data/lib/bundler.rb +12 -1
  65. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bcf48063fd68ff2303185f1bb117dcb52395cfdbc622d9a41dfc658115b196eb
4
- data.tar.gz: 28a397130a9eb30ec877e7563cecccf29e8a1d849096028a6c49eb7ddd48ebd6
3
+ metadata.gz: '0194bb060d38ce7786c704aca693890461b4866ee647d6931a8e3e8f738f4ad6'
4
+ data.tar.gz: d6e46c6028248ad29a24bfccd9df89facbcd57186e84be8499ec903f4989b88e
5
5
  SHA512:
6
- metadata.gz: 8e1ef096a5444ba67c2b3d89ad91f6e26df973c18793c41b96ff2797ca15be596df5e6bd0c78a9e17d9078d30f5e348bcc17cde5d76bb1ce2534f3247716538f
7
- data.tar.gz: 2ab4b43b9863888cb4515a5305b1fcbcb5eb4fa5e4f9aaa27c8202ad0de0a210dbf3304318728514436513060e950a8bfbad0c849f6ae73ac61eac120b36d644
6
+ metadata.gz: 9bbc74e0583c0117895f09cc1da2ae5dc9592b09b52f70f70c8efba2743bec7449230b9fc8d7210725c804bb761f98bd9a0ec8a8e417bfc2b0573154ffaacab7
7
+ data.tar.gz: a27eea8f0ebceb3d0e9e8b413d2c50da519c36e565e08c26f0d22f6298f75515f0d11094da6c510b74805ceae2e18e25cd61eacd40e328b565878f4ad2c66a41
data/CHANGELOG.md CHANGED
@@ -1,3 +1,44 @@
1
+ # 2.3.16 (June 15, 2022)
2
+
3
+ ## Performance:
4
+
5
+ - Improve performance of installing gems from gem server sources [#5614](https://github.com/rubygems/rubygems/pull/5614)
6
+
7
+ # 2.3.15 (June 1, 2022)
8
+
9
+ ## Enhancements:
10
+
11
+ - Show better error when previous installation fails to be removed [#5564](https://github.com/rubygems/rubygems/pull/5564)
12
+ - Show exception cause in bug report template [#5563](https://github.com/rubygems/rubygems/pull/5563)
13
+
14
+ ## Bug fixes:
15
+
16
+ - Fix `bundle remove` by invalidating cached `Bundle.definition` [#5443](https://github.com/rubygems/rubygems/pull/5443)
17
+ - Fix generated standalone script when it includes default gems [#5586](https://github.com/rubygems/rubygems/pull/5586)
18
+ - Skip duplicated dependency warning for gemspec dev deps [#5587](https://github.com/rubygems/rubygems/pull/5587)
19
+ - Give better conflict resolution advice [#5581](https://github.com/rubygems/rubygems/pull/5581)
20
+ - Fix crash when commenting out a mirror in configuration [#5576](https://github.com/rubygems/rubygems/pull/5576)
21
+ - Fix crash when installing gems with symlinks [#5570](https://github.com/rubygems/rubygems/pull/5570)
22
+ - Ignore `Errno::EROFS` errors when creating `bundler.lock` [#5580](https://github.com/rubygems/rubygems/pull/5580)
23
+ - Ignore `Errno::EPERM` errors when creating `bundler.lock` [#5579](https://github.com/rubygems/rubygems/pull/5579)
24
+ - Fix crash when printing resolution conflicts on metadata requirements [#5562](https://github.com/rubygems/rubygems/pull/5562)
25
+
26
+ # 2.3.14 (May 18, 2022)
27
+
28
+ ## Bug fixes:
29
+
30
+ - Fix confusing inline mode install output [#5530](https://github.com/rubygems/rubygems/pull/5530)
31
+ - Fix error message when locked version of a gem does not support running Ruby [#5525](https://github.com/rubygems/rubygems/pull/5525)
32
+
33
+ ## Performance:
34
+
35
+ - Improve `bundler/setup` performance again by not deduplicating intermediate results [#5533](https://github.com/rubygems/rubygems/pull/5533)
36
+
37
+ ## Documentation:
38
+
39
+ - Fix typo in documentation [#5514](https://github.com/rubygems/rubygems/pull/5514)
40
+ - Update man page for `require` option in `bundle add` command [#5513](https://github.com/rubygems/rubygems/pull/5513)
41
+
1
42
  # 2.3.13 (May 4, 2022)
2
43
 
3
44
  ## 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 = "2022-05-04".freeze
8
- @git_commit_sha = "b20be5a433".freeze
7
+ @built_at = "2022-06-15".freeze
8
+ @git_commit_sha = "324ee6e542".freeze
9
9
  @release = true
10
10
  # end ivars
11
11
 
@@ -14,7 +14,7 @@ module Bundler
14
14
  Bundler.settings.set_command_option_if_given :cache_path, options["cache-path"]
15
15
 
16
16
  setup_cache_all
17
- install
17
+ install unless Bundler.settings[:no_install]
18
18
 
19
19
  # TODO: move cache contents here now that all bundles are locked
20
20
  custom_path = Bundler.settings[:path] if options[:path]
@@ -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"
@@ -161,8 +161,6 @@ module Bundler
161
161
 
162
162
  Bundler.settings.set_command_option_if_given :no_prune, options["no-prune"]
163
163
 
164
- Bundler.settings.set_command_option_if_given :no_install, options["no-install"]
165
-
166
164
  Bundler.settings.set_command_option_if_given :clean, options["clean"]
167
165
 
168
166
  normalize_groups if options[:without] || options[:with]
data/lib/bundler/cli.rb CHANGED
@@ -251,9 +251,7 @@ module Bundler
251
251
  remembered_negative_flag_deprecation("no-deployment")
252
252
 
253
253
  require_relative "cli/install"
254
- Bundler.settings.temporary(:no_install => false) do
255
- Install.new(options.dup).run
256
- end
254
+ Install.new(options.dup).run
257
255
  end
258
256
 
259
257
  map aliases_for("install")
@@ -299,9 +297,7 @@ module Bundler
299
297
  def update(*gems)
300
298
  SharedHelpers.major_deprecation(2, "The `--force` option has been renamed to `--redownload`") if ARGV.include?("--force")
301
299
  require_relative "cli/update"
302
- Bundler.settings.temporary(:no_install => false) do
303
- Update.new(options, gems).run
304
- end
300
+ Update.new(options, gems).run
305
301
  end
306
302
 
307
303
  desc "show GEM [OPTIONS]", "Shows all gems that are part of the bundle, or the path to a given gem"
@@ -255,20 +255,18 @@ module Bundler
255
255
  #
256
256
  # @return [SpecSet] resolved dependencies
257
257
  def resolve
258
- @resolve ||= begin
259
- if Bundler.frozen_bundle?
260
- Bundler.ui.debug "Frozen, using resolution from the lockfile"
261
- @locked_specs
262
- elsif !unlocking? && nothing_changed?
263
- Bundler.ui.debug("Found no changes, using resolution from the lockfile")
264
- SpecSet.new(filter_specs(@locked_specs, @dependencies.select{|dep| @locked_specs[dep].any? }))
265
- else
266
- last_resolve = converge_locked_specs
267
- # Run a resolve against the locally available gems
268
- Bundler.ui.debug("Found changes from the lockfile, re-resolving dependencies because #{change_reason}")
269
- expanded_dependencies = expand_dependencies(dependencies + metadata_dependencies, true)
270
- Resolver.resolve(expanded_dependencies, source_requirements, last_resolve, gem_version_promoter, additional_base_requirements_for_resolve, platforms)
271
- end
258
+ @resolve ||= if Bundler.frozen_bundle?
259
+ Bundler.ui.debug "Frozen, using resolution from the lockfile"
260
+ @locked_specs
261
+ elsif !unlocking? && nothing_changed?
262
+ Bundler.ui.debug("Found no changes, using resolution from the lockfile")
263
+ SpecSet.new(filter_specs(@locked_specs, @dependencies.select {|dep| @locked_specs[dep].any? }))
264
+ else
265
+ last_resolve = converge_locked_specs
266
+ # Run a resolve against the locally available gems
267
+ Bundler.ui.debug("Found changes from the lockfile, re-resolving dependencies because #{change_reason}")
268
+ expanded_dependencies = expand_dependencies(dependencies + metadata_dependencies, true)
269
+ Resolver.resolve(expanded_dependencies, source_requirements, last_resolve, gem_version_promoter, additional_base_requirements_for_resolve, platforms)
272
270
  end
273
271
  end
274
272
 
@@ -731,16 +729,14 @@ module Bundler
731
729
  end
732
730
  end
733
731
 
734
- SpecSet.new(filter_specs(converged, deps).reject{|s| @unlock[:gems].include?(s.name) })
732
+ SpecSet.new(filter_specs(converged, deps).reject {|s| @unlock[:gems].include?(s.name) })
735
733
  end
736
734
 
737
735
  def metadata_dependencies
738
- @metadata_dependencies ||= begin
739
- [
740
- Dependency.new("Ruby\0", RubyVersion.system.gem_version),
741
- Dependency.new("RubyGems\0", Gem::VERSION),
742
- ]
743
- end
736
+ @metadata_dependencies ||= [
737
+ Dependency.new("Ruby\0", RubyVersion.system.gem_version),
738
+ Dependency.new("RubyGems\0", Gem::VERSION),
739
+ ]
744
740
  end
745
741
 
746
742
  def expand_dependencies(dependencies, remote = false)
@@ -9,6 +9,7 @@ module Bundler
9
9
  attr_reader :autorequire
10
10
  attr_reader :groups, :platforms, :gemfile, :git, :github, :branch, :ref
11
11
 
12
+ # rubocop:disable Naming/VariableNumber
12
13
  PLATFORM_MAP = {
13
14
  :ruby => Gem::Platform::RUBY,
14
15
  :ruby_18 => Gem::Platform::RUBY,
@@ -91,6 +92,7 @@ module Bundler
91
92
  :x64_mingw_30 => Gem::Platform::X64_MINGW,
92
93
  :x64_mingw_31 => Gem::Platform::X64_MINGW,
93
94
  }.freeze
95
+ # rubocop:enable Naming/VariableNumber
94
96
 
95
97
  def initialize(name, version, options = {}, &blk)
96
98
  type = options["type"] || :runtime
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
 
@@ -513,9 +511,7 @@ module Bundler
513
511
  # be raised.
514
512
  #
515
513
  def contents
516
- @contents ||= begin
517
- dsl_path && File.exist?(dsl_path) && File.read(dsl_path)
518
- end
514
+ @contents ||= dsl_path && File.exist?(dsl_path) && File.read(dsl_path)
519
515
  end
520
516
 
521
517
  # The message of the exception reports the content of podspec for the
@@ -41,12 +41,14 @@ module Bundler
41
41
  class GemspecError < BundlerError; status_code(14); end
42
42
  class InvalidOption < BundlerError; status_code(15); end
43
43
  class ProductionError < BundlerError; status_code(16); end
44
+
44
45
  class HTTPError < BundlerError
45
46
  status_code(17)
46
47
  def filter_uri(uri)
47
48
  URICredentialsFilter.credential_filtered_uri(uri)
48
49
  end
49
50
  end
51
+
50
52
  class RubyVersionMismatch < BundlerError; status_code(18); end
51
53
  class SecurityError < BundlerError; status_code(19); end
52
54
  class LockfileError < BundlerError; status_code(20); end
@@ -79,10 +81,6 @@ module Bundler
79
81
  case @permission_type
80
82
  when :create
81
83
  "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
84
  else
87
85
  "#{@permission_type} permissions for that path"
88
86
  end
@@ -172,4 +170,16 @@ module Bundler
172
170
 
173
171
  status_code(32)
174
172
  end
173
+
174
+ class DirectoryRemovalError < BundlerError
175
+ def initialize(orig_exception, msg)
176
+ full_message = "#{msg}.\n" \
177
+ "The underlying error was #{orig_exception.class}: #{orig_exception.message}, with backtrace:\n" \
178
+ " #{orig_exception.backtrace.join("\n ")}\n\n" \
179
+ "Bundler Error Backtrace:"
180
+ super(full_message)
181
+ end
182
+
183
+ status_code(36)
184
+ end
175
185
  end
@@ -19,14 +19,12 @@ module Bundler
19
19
  end
20
20
 
21
21
  def fetch_uri
22
- @fetch_uri ||= begin
23
- if remote_uri.host == "rubygems.org"
24
- uri = remote_uri.dup
25
- uri.host = "index.rubygems.org"
26
- uri
27
- else
28
- remote_uri
29
- end
22
+ @fetch_uri ||= if remote_uri.host == "rubygems.org"
23
+ uri = remote_uri.dup
24
+ uri.host = "index.rubygems.org"
25
+ uri
26
+ else
27
+ remote_uri
30
28
  end
31
29
  end
32
30
 
@@ -20,6 +20,7 @@ module Bundler
20
20
  class TooManyRequestsError < HTTPError; end
21
21
  # This error is raised if the API returns a 413 (only printed in verbose)
22
22
  class FallbackError < HTTPError; end
23
+
23
24
  # This is the error raised if OpenSSL fails the cert verification
24
25
  class CertificateFailureError < HTTPError
25
26
  def initialize(remote_uri)
@@ -33,6 +34,7 @@ module Bundler
33
34
  " sources and change 'https' to 'http'."
34
35
  end
35
36
  end
37
+
36
38
  # This is the error raised when a source is HTTPS and OpenSSL didn't load
37
39
  class SSLError < HTTPError
38
40
  def initialize(msg = nil)
@@ -42,6 +44,7 @@ module Bundler
42
44
  "using RVM are available at rvm.io/packages/openssl."
43
45
  end
44
46
  end
47
+
45
48
  # This error is raised if HTTP authentication is required, but not provided.
46
49
  class AuthenticationRequiredError < HTTPError
47
50
  def initialize(remote_uri)
@@ -52,6 +55,7 @@ module Bundler
52
55
  "or by storing the credentials in the `#{Settings.key_for(remote_uri)}` environment variable"
53
56
  end
54
57
  end
58
+
55
59
  # This error is raised if HTTP authentication is provided, but incorrect.
56
60
  class BadAuthenticationError < HTTPError
57
61
  def initialize(remote_uri)
@@ -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