bundler 2.3.10 → 2.3.16

Sign up to get free protection for your applications and to get access to all the features.
Files changed (84) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +71 -0
  3. data/exe/bundler +1 -1
  4. data/lib/bundler/build_metadata.rb +3 -3
  5. data/lib/bundler/cli/cache.rb +1 -1
  6. data/lib/bundler/cli/common.rb +1 -1
  7. data/lib/bundler/cli/info.rb +1 -1
  8. data/lib/bundler/cli/init.rb +1 -1
  9. data/lib/bundler/cli/install.rb +0 -2
  10. data/lib/bundler/cli/show.rb +1 -1
  11. data/lib/bundler/cli.rb +3 -7
  12. data/lib/bundler/current_ruby.rb +1 -0
  13. data/lib/bundler/definition.rb +29 -46
  14. data/lib/bundler/dependency.rb +20 -0
  15. data/lib/bundler/dsl.rb +7 -11
  16. data/lib/bundler/endpoint_specification.rb +4 -1
  17. data/lib/bundler/errors.rb +14 -4
  18. data/lib/bundler/fetcher/base.rb +6 -8
  19. data/lib/bundler/fetcher.rb +4 -0
  20. data/lib/bundler/friendly_errors.rb +16 -2
  21. data/lib/bundler/gem_helpers.rb +1 -1
  22. data/lib/bundler/injector.rb +4 -0
  23. data/lib/bundler/inline.rb +1 -11
  24. data/lib/bundler/installer/gem_installer.rb +14 -1
  25. data/lib/bundler/installer.rb +4 -13
  26. data/lib/bundler/lazy_specification.rb +1 -1
  27. data/lib/bundler/man/bundle-add.1 +7 -3
  28. data/lib/bundler/man/bundle-add.1.ronn +5 -2
  29. data/lib/bundler/man/bundle-binstubs.1 +1 -1
  30. data/lib/bundler/man/bundle-cache.1 +1 -1
  31. data/lib/bundler/man/bundle-check.1 +1 -1
  32. data/lib/bundler/man/bundle-clean.1 +1 -1
  33. data/lib/bundler/man/bundle-config.1 +4 -4
  34. data/lib/bundler/man/bundle-config.1.ronn +8 -6
  35. data/lib/bundler/man/bundle-doctor.1 +1 -1
  36. data/lib/bundler/man/bundle-exec.1 +1 -1
  37. data/lib/bundler/man/bundle-gem.1 +1 -1
  38. data/lib/bundler/man/bundle-info.1 +1 -1
  39. data/lib/bundler/man/bundle-init.1 +1 -1
  40. data/lib/bundler/man/bundle-inject.1 +1 -1
  41. data/lib/bundler/man/bundle-install.1 +1 -1
  42. data/lib/bundler/man/bundle-list.1 +1 -1
  43. data/lib/bundler/man/bundle-lock.1 +1 -1
  44. data/lib/bundler/man/bundle-open.1 +1 -1
  45. data/lib/bundler/man/bundle-outdated.1 +1 -1
  46. data/lib/bundler/man/bundle-platform.1 +1 -1
  47. data/lib/bundler/man/bundle-pristine.1 +1 -1
  48. data/lib/bundler/man/bundle-remove.1 +1 -1
  49. data/lib/bundler/man/bundle-show.1 +1 -1
  50. data/lib/bundler/man/bundle-update.1 +1 -1
  51. data/lib/bundler/man/bundle-viz.1 +1 -1
  52. data/lib/bundler/man/bundle.1 +1 -1
  53. data/lib/bundler/man/gemfile.5 +1 -1
  54. data/lib/bundler/plugin/api/source.rb +3 -3
  55. data/lib/bundler/plugin/installer/git.rb +0 -4
  56. data/lib/bundler/plugin/installer/rubygems.rb +0 -4
  57. data/lib/bundler/process_lock.rb +1 -1
  58. data/lib/bundler/resolver/spec_group.rb +2 -2
  59. data/lib/bundler/resolver.rb +73 -43
  60. data/lib/bundler/ruby_version.rb +0 -13
  61. data/lib/bundler/rubygems_ext.rb +18 -1
  62. data/lib/bundler/rubygems_gem_installer.rb +11 -8
  63. data/lib/bundler/rubygems_integration.rb +3 -21
  64. data/lib/bundler/settings.rb +1 -1
  65. data/lib/bundler/shared_helpers.rb +9 -9
  66. data/lib/bundler/source/git.rb +7 -9
  67. data/lib/bundler/source/metadata.rb +2 -2
  68. data/lib/bundler/source/path.rb +1 -1
  69. data/lib/bundler/source/rubygems.rb +90 -86
  70. data/lib/bundler/source.rb +3 -4
  71. data/lib/bundler/spec_set.rb +5 -3
  72. data/lib/bundler/stub_specification.rb +5 -3
  73. data/lib/bundler/templates/Executable +2 -4
  74. data/lib/bundler/templates/Executable.bundler +1 -1
  75. data/lib/bundler/templates/Executable.standalone +2 -4
  76. data/lib/bundler/templates/newgem/github/workflows/main.yml.tt +1 -1
  77. data/lib/bundler/templates/newgem/newgem.gemspec.tt +1 -1
  78. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +1 -1
  79. data/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb +32 -26
  80. data/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb +1 -1
  81. data/lib/bundler/vendor/tsort/lib/tsort.rb +318 -319
  82. data/lib/bundler/version.rb +1 -1
  83. data/lib/bundler.rb +13 -2
  84. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d04e4256fa8e51a0169e749dac69ace323715bd6baf4f8d0b41030eecd096a45
4
- data.tar.gz: 58d03cf0bae41f3934eb6d2ced1b90d60b996ba0cb5a3400a8090218b9f2a978
3
+ metadata.gz: '0194bb060d38ce7786c704aca693890461b4866ee647d6931a8e3e8f738f4ad6'
4
+ data.tar.gz: d6e46c6028248ad29a24bfccd9df89facbcd57186e84be8499ec903f4989b88e
5
5
  SHA512:
6
- metadata.gz: 251af0c8ded951fa452b748f7bc179b575f970e07d6e6bb6668afa17ba2e60190652fb7b5e7f4da4530421467f809fbde015ff8c372922c119a0caf24aa9ac7c
7
- data.tar.gz: 77abe76f6b7a9acc862705adc601d09b3fc9f34a5b7f862952796ea45b89024a5b8fdda7cf4faf4dbf7934c77fc7d465906645be1dfc76eb89034ec89b8e0b44
6
+ metadata.gz: 9bbc74e0583c0117895f09cc1da2ae5dc9592b09b52f70f70c8efba2743bec7449230b9fc8d7210725c804bb761f98bd9a0ec8a8e417bfc2b0573154ffaacab7
7
+ data.tar.gz: a27eea8f0ebceb3d0e9e8b413d2c50da519c36e565e08c26f0d22f6298f75515f0d11094da6c510b74805ceae2e18e25cd61eacd40e328b565878f4ad2c66a41
data/CHANGELOG.md CHANGED
@@ -1,3 +1,74 @@
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
+
42
+ # 2.3.13 (May 4, 2022)
43
+
44
+ ## Bug fixes:
45
+
46
+ - Fix missing required rubygems version when using old APIs [#5496](https://github.com/rubygems/rubygems/pull/5496)
47
+ - Fix crash when gem used twice in Gemfile under different platforms [#5187](https://github.com/rubygems/rubygems/pull/5187)
48
+
49
+ ## Performance:
50
+
51
+ - Speed up `bundler/setup` time [#5503](https://github.com/rubygems/rubygems/pull/5503)
52
+
53
+ # 2.3.12 (April 20, 2022)
54
+
55
+ ## Enhancements:
56
+
57
+ - Improve Ruby version resolution conflicts [#5474](https://github.com/rubygems/rubygems/pull/5474)
58
+ - Stop considering `RUBY_PATCHLEVEL` for resolution [#5472](https://github.com/rubygems/rubygems/pull/5472)
59
+ - Add modern rubies as valid platform values in Gemfile DSL [#5469](https://github.com/rubygems/rubygems/pull/5469)
60
+
61
+ # 2.3.11 (April 7, 2022)
62
+
63
+ ## Enhancements:
64
+
65
+ - Bump actions/checkout to 3 in bundler gem template [#5445](https://github.com/rubygems/rubygems/pull/5445)
66
+ - Prefer `__dir__` to `__FILE__` [#5444](https://github.com/rubygems/rubygems/pull/5444)
67
+
68
+ ## Documentation:
69
+
70
+ - Update bundler documentation to reflect bundle config scope changes [#5441](https://github.com/rubygems/rubygems/pull/5441)
71
+
1
72
  # 2.3.10 (March 23, 2022)
2
73
 
3
74
  ## Enhancements:
data/exe/bundler CHANGED
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env ruby
2
2
  # frozen_string_literal: true
3
3
 
4
- load File.expand_path("../bundle", __FILE__)
4
+ load File.expand_path("bundle", __dir__)
@@ -4,8 +4,8 @@ module Bundler
4
4
  # Represents metadata from when the Bundler gem was built.
5
5
  module BuildMetadata
6
6
  # begin ivars
7
- @built_at = "2022-03-23".freeze
8
- @git_commit_sha = "4bbb70e7de".freeze
7
+ @built_at = "2022-06-15".freeze
8
+ @git_commit_sha = "324ee6e542".freeze
9
9
  @release = true
10
10
  # end ivars
11
11
 
@@ -29,7 +29,7 @@ module Bundler
29
29
 
30
30
  # If Bundler has been installed without its .git directory and without a
31
31
  # commit instance variable then we can't determine its commits SHA.
32
- git_dir = File.join(File.expand_path("../../../..", __FILE__), ".git")
32
+ git_dir = File.expand_path("../../../.git", __dir__)
33
33
  if File.directory?(git_dir)
34
34
  return @git_commit_sha = Dir.chdir(git_dir) { `git rev-parse --short HEAD`.strip.freeze }
35
35
  end
@@ -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"
@@ -47,7 +47,7 @@ module Bundler
47
47
  def print_gem_path(spec)
48
48
  name = spec.name
49
49
  if name == "bundler"
50
- path = File.expand_path("../../../..", __FILE__)
50
+ path = File.expand_path("../../..", __dir__)
51
51
  else
52
52
  path = spec.full_gem_path
53
53
  if spec.deleted_gem?
@@ -32,7 +32,7 @@ module Bundler
32
32
  file << spec.to_gemfile
33
33
  end
34
34
  else
35
- FileUtils.cp(File.expand_path("../../templates/#{gemfile}", __FILE__), gemfile)
35
+ FileUtils.cp(File.expand_path("../templates/#{gemfile}", __dir__), gemfile)
36
36
  end
37
37
 
38
38
  puts "Writing new #{gemfile} to #{SharedHelpers.pwd}/#{gemfile}"
@@ -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]
@@ -18,7 +18,7 @@ module Bundler
18
18
 
19
19
  if gem_name
20
20
  if gem_name == "bundler"
21
- path = File.expand_path("../../../..", __FILE__)
21
+ path = File.expand_path("../../..", __dir__)
22
22
  else
23
23
  spec = Bundler::CLI::Common.select_spec(gem_name, :regex_match)
24
24
  return unless spec
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"
@@ -610,7 +606,7 @@ module Bundler
610
606
  private :gem
611
607
 
612
608
  def self.source_root
613
- File.expand_path(File.join(File.dirname(__FILE__), "templates"))
609
+ File.expand_path("templates", __dir__)
614
610
  end
615
611
 
616
612
  desc "clean [OPTIONS]", "Cleans up unused gems in your bundler directory", :hide => true
@@ -21,6 +21,7 @@ module Bundler
21
21
  2.6
22
22
  2.7
23
23
  3.0
24
+ 3.1
24
25
  ].freeze
25
26
 
26
27
  KNOWN_MAJOR_VERSIONS = KNOWN_MINOR_VERSIONS.map {|v| v.split(".", 2).first }.uniq.freeze
@@ -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 = {}
@@ -254,20 +255,18 @@ module Bundler
254
255
  #
255
256
  # @return [SpecSet] resolved dependencies
256
257
  def resolve
257
- @resolve ||= begin
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
258
265
  last_resolve = converge_locked_specs
259
- if Bundler.frozen_bundle?
260
- Bundler.ui.debug "Frozen, using resolution from the lockfile"
261
- last_resolve
262
- elsif !unlocking? && nothing_changed?
263
- Bundler.ui.debug("Found no changes, using resolution from the lockfile")
264
- last_resolve
265
- else
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)
270
- end
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)
271
270
  end
272
271
  end
273
272
 
@@ -464,6 +463,10 @@ module Bundler
464
463
 
465
464
  private
466
465
 
466
+ def filter_specs(specs, deps)
467
+ SpecSet.new(specs).for(expand_dependencies(deps, true), false, false)
468
+ end
469
+
467
470
  def materialize(dependencies)
468
471
  specs = resolve.materialize(dependencies)
469
472
  missing_specs = specs.missing_specs
@@ -679,17 +682,17 @@ module Bundler
679
682
  end
680
683
 
681
684
  def converge_specs(specs)
682
- deps = []
683
685
  converged = []
686
+
687
+ deps = @dependencies.select do |dep|
688
+ specs[dep].any? {|s| s.satisfies?(dep) && (!dep.source || s.source.include?(dep.source)) }
689
+ end
690
+
684
691
  specs.each do |s|
685
692
  # Replace the locked dependency's source with the equivalent source from the Gemfile
686
693
  dep = @dependencies.find {|d| s.satisfies?(d) }
687
694
 
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?
695
+ s.source = (dep && dep.source) || sources.get(s.source) || sources.default_source
693
696
 
694
697
  next if @unlock[:sources].include?(s.source.name)
695
698
 
@@ -726,34 +729,14 @@ module Bundler
726
729
  end
727
730
  end
728
731
 
729
- resolve = SpecSet.new(converged)
730
- SpecSet.new(resolve.for(expand_dependencies(deps, true), false, false).reject{|s| @unlock[:gems].include?(s.name) })
732
+ SpecSet.new(filter_specs(converged, deps).reject {|s| @unlock[:gems].include?(s.name) })
731
733
  end
732
734
 
733
735
  def metadata_dependencies
734
- @metadata_dependencies ||= begin
735
- ruby_versions = ruby_version_requirements(@ruby_version)
736
- [
737
- Dependency.new("Ruby\0", ruby_versions),
738
- Dependency.new("RubyGems\0", Gem::VERSION),
739
- ]
740
- end
741
- end
742
-
743
- def ruby_version_requirements(ruby_version)
744
- return [] unless ruby_version
745
- if ruby_version.patchlevel
746
- [ruby_version.to_gem_version_with_patchlevel]
747
- else
748
- ruby_version.versions.map do |version|
749
- requirement = Gem::Requirement.new(version)
750
- if requirement.exact?
751
- "~> #{version}.0"
752
- else
753
- requirement
754
- end
755
- end
756
- end
736
+ @metadata_dependencies ||= [
737
+ Dependency.new("Ruby\0", RubyVersion.system.gem_version),
738
+ Dependency.new("RubyGems\0", Gem::VERSION),
739
+ ]
757
740
  end
758
741
 
759
742
  def expand_dependencies(dependencies, remote = false)
@@ -821,7 +804,7 @@ module Bundler
821
804
 
822
805
  def additional_base_requirements_for_resolve
823
806
  return [] unless @locked_gems && unlocking? && !sources.expired_sources?(@locked_gems.sources)
824
- converge_specs(@locked_gems.specs).map do |locked_spec|
807
+ converge_specs(@originally_locked_specs).map do |locked_spec|
825
808
  name = locked_spec.name
826
809
  dep = Gem::Dependency.new(name, ">= #{locked_spec.version}")
827
810
  DepProxy.get_proxy(dep, locked_spec.platform)
@@ -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,
@@ -20,6 +21,9 @@ module Bundler
20
21
  :ruby_24 => Gem::Platform::RUBY,
21
22
  :ruby_25 => Gem::Platform::RUBY,
22
23
  :ruby_26 => Gem::Platform::RUBY,
24
+ :ruby_27 => Gem::Platform::RUBY,
25
+ :ruby_30 => Gem::Platform::RUBY,
26
+ :ruby_31 => Gem::Platform::RUBY,
23
27
  :mri => Gem::Platform::RUBY,
24
28
  :mri_18 => Gem::Platform::RUBY,
25
29
  :mri_19 => Gem::Platform::RUBY,
@@ -30,6 +34,9 @@ module Bundler
30
34
  :mri_24 => Gem::Platform::RUBY,
31
35
  :mri_25 => Gem::Platform::RUBY,
32
36
  :mri_26 => Gem::Platform::RUBY,
37
+ :mri_27 => Gem::Platform::RUBY,
38
+ :mri_30 => Gem::Platform::RUBY,
39
+ :mri_31 => Gem::Platform::RUBY,
33
40
  :rbx => Gem::Platform::RUBY,
34
41
  :truffleruby => Gem::Platform::RUBY,
35
42
  :jruby => Gem::Platform::JAVA,
@@ -45,6 +52,9 @@ module Bundler
45
52
  :mswin_24 => Gem::Platform::MSWIN,
46
53
  :mswin_25 => Gem::Platform::MSWIN,
47
54
  :mswin_26 => Gem::Platform::MSWIN,
55
+ :mswin_27 => Gem::Platform::MSWIN,
56
+ :mswin_30 => Gem::Platform::MSWIN,
57
+ :mswin_31 => Gem::Platform::MSWIN,
48
58
  :mswin64 => Gem::Platform::MSWIN64,
49
59
  :mswin64_19 => Gem::Platform::MSWIN64,
50
60
  :mswin64_20 => Gem::Platform::MSWIN64,
@@ -54,6 +64,9 @@ module Bundler
54
64
  :mswin64_24 => Gem::Platform::MSWIN64,
55
65
  :mswin64_25 => Gem::Platform::MSWIN64,
56
66
  :mswin64_26 => Gem::Platform::MSWIN64,
67
+ :mswin64_27 => Gem::Platform::MSWIN64,
68
+ :mswin64_30 => Gem::Platform::MSWIN64,
69
+ :mswin64_31 => Gem::Platform::MSWIN64,
57
70
  :mingw => Gem::Platform::MINGW,
58
71
  :mingw_18 => Gem::Platform::MINGW,
59
72
  :mingw_19 => Gem::Platform::MINGW,
@@ -64,6 +77,9 @@ module Bundler
64
77
  :mingw_24 => Gem::Platform::MINGW,
65
78
  :mingw_25 => Gem::Platform::MINGW,
66
79
  :mingw_26 => Gem::Platform::MINGW,
80
+ :mingw_27 => Gem::Platform::MINGW,
81
+ :mingw_30 => Gem::Platform::MINGW,
82
+ :mingw_31 => Gem::Platform::MINGW,
67
83
  :x64_mingw => Gem::Platform::X64_MINGW,
68
84
  :x64_mingw_20 => Gem::Platform::X64_MINGW,
69
85
  :x64_mingw_21 => Gem::Platform::X64_MINGW,
@@ -72,7 +88,11 @@ module Bundler
72
88
  :x64_mingw_24 => Gem::Platform::X64_MINGW,
73
89
  :x64_mingw_25 => Gem::Platform::X64_MINGW,
74
90
  :x64_mingw_26 => Gem::Platform::X64_MINGW,
91
+ :x64_mingw_27 => Gem::Platform::X64_MINGW,
92
+ :x64_mingw_30 => Gem::Platform::X64_MINGW,
93
+ :x64_mingw_31 => Gem::Platform::X64_MINGW,
75
94
  }.freeze
95
+ # rubocop:enable Naming/VariableNumber
76
96
 
77
97
  def initialize(name, version, options = {}, &blk)
78
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
@@ -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
@@ -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