rubygems-update 3.3.13 → 3.3.16

Sign up to get free protection for your applications and to get access to all the features.
Files changed (124) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +37 -0
  3. data/Manifest.txt +5 -2
  4. data/bundler/CHANGELOG.md +41 -0
  5. data/bundler/lib/bundler/build_metadata.rb +2 -2
  6. data/bundler/lib/bundler/cli/cache.rb +1 -1
  7. data/bundler/lib/bundler/cli/common.rb +1 -1
  8. data/bundler/lib/bundler/cli/install.rb +0 -2
  9. data/bundler/lib/bundler/cli.rb +2 -6
  10. data/bundler/lib/bundler/definition.rb +17 -21
  11. data/bundler/lib/bundler/dependency.rb +2 -0
  12. data/bundler/lib/bundler/dsl.rb +7 -11
  13. data/bundler/lib/bundler/errors.rb +14 -4
  14. data/bundler/lib/bundler/fetcher/base.rb +6 -8
  15. data/bundler/lib/bundler/fetcher.rb +4 -0
  16. data/bundler/lib/bundler/friendly_errors.rb +16 -2
  17. data/bundler/lib/bundler/gem_helpers.rb +1 -1
  18. data/bundler/lib/bundler/injector.rb +4 -0
  19. data/bundler/lib/bundler/inline.rb +1 -11
  20. data/bundler/lib/bundler/installer/gem_installer.rb +14 -1
  21. data/bundler/lib/bundler/installer.rb +2 -11
  22. data/bundler/lib/bundler/lazy_specification.rb +1 -1
  23. data/bundler/lib/bundler/man/bundle-add.1 +7 -3
  24. data/bundler/lib/bundler/man/bundle-add.1.ronn +5 -2
  25. data/bundler/lib/bundler/man/bundle-binstubs.1 +1 -1
  26. data/bundler/lib/bundler/man/bundle-cache.1 +1 -1
  27. data/bundler/lib/bundler/man/bundle-check.1 +1 -1
  28. data/bundler/lib/bundler/man/bundle-clean.1 +1 -1
  29. data/bundler/lib/bundler/man/bundle-config.1 +1 -1
  30. data/bundler/lib/bundler/man/bundle-doctor.1 +1 -1
  31. data/bundler/lib/bundler/man/bundle-exec.1 +1 -1
  32. data/bundler/lib/bundler/man/bundle-gem.1 +1 -1
  33. data/bundler/lib/bundler/man/bundle-info.1 +1 -1
  34. data/bundler/lib/bundler/man/bundle-init.1 +1 -1
  35. data/bundler/lib/bundler/man/bundle-inject.1 +1 -1
  36. data/bundler/lib/bundler/man/bundle-install.1 +1 -1
  37. data/bundler/lib/bundler/man/bundle-list.1 +1 -1
  38. data/bundler/lib/bundler/man/bundle-lock.1 +1 -1
  39. data/bundler/lib/bundler/man/bundle-open.1 +1 -1
  40. data/bundler/lib/bundler/man/bundle-outdated.1 +1 -1
  41. data/bundler/lib/bundler/man/bundle-platform.1 +1 -1
  42. data/bundler/lib/bundler/man/bundle-pristine.1 +1 -1
  43. data/bundler/lib/bundler/man/bundle-remove.1 +1 -1
  44. data/bundler/lib/bundler/man/bundle-show.1 +1 -1
  45. data/bundler/lib/bundler/man/bundle-update.1 +1 -1
  46. data/bundler/lib/bundler/man/bundle-viz.1 +1 -1
  47. data/bundler/lib/bundler/man/bundle.1 +1 -1
  48. data/bundler/lib/bundler/man/gemfile.5 +1 -1
  49. data/bundler/lib/bundler/plugin/api/source.rb +3 -3
  50. data/bundler/lib/bundler/plugin/installer/git.rb +0 -4
  51. data/bundler/lib/bundler/plugin/installer/rubygems.rb +0 -4
  52. data/bundler/lib/bundler/process_lock.rb +1 -1
  53. data/bundler/lib/bundler/resolver.rb +17 -20
  54. data/bundler/lib/bundler/rubygems_ext.rb +1 -1
  55. data/bundler/lib/bundler/rubygems_gem_installer.rb +11 -8
  56. data/bundler/lib/bundler/rubygems_integration.rb +3 -21
  57. data/bundler/lib/bundler/settings.rb +1 -1
  58. data/bundler/lib/bundler/shared_helpers.rb +5 -5
  59. data/bundler/lib/bundler/source/git.rb +7 -9
  60. data/bundler/lib/bundler/source/path.rb +1 -1
  61. data/bundler/lib/bundler/source/rubygems.rb +90 -86
  62. data/bundler/lib/bundler/source.rb +3 -4
  63. data/bundler/lib/bundler/spec_set.rb +5 -3
  64. data/bundler/lib/bundler/stub_specification.rb +5 -3
  65. data/bundler/lib/bundler/version.rb +1 -1
  66. data/bundler/lib/bundler.rb +12 -1
  67. data/lib/rubygems/command_manager.rb +6 -1
  68. data/lib/rubygems/commands/install_command.rb +1 -1
  69. data/lib/rubygems/commands/pristine_command.rb +1 -1
  70. data/lib/rubygems/commands/setup_command.rb +1 -1
  71. data/lib/rubygems/commands/sources_command.rb +1 -1
  72. data/lib/rubygems/commands/specification_command.rb +1 -1
  73. data/lib/rubygems/commands/update_command.rb +4 -5
  74. data/lib/rubygems/core_ext/kernel_require.rb +1 -1
  75. data/lib/rubygems/errors.rb +1 -1
  76. data/lib/rubygems/ext/builder.rb +3 -3
  77. data/lib/rubygems/ext/cargo_builder/link_flag_converter.rb +23 -0
  78. data/lib/rubygems/ext/cargo_builder.rb +87 -64
  79. data/lib/rubygems/gemcutter_utilities.rb +1 -1
  80. data/lib/rubygems/installer.rb +2 -2
  81. data/lib/rubygems/local_remote_options.rb +1 -1
  82. data/lib/rubygems/query_utils.rb +1 -1
  83. data/lib/rubygems/request.rb +1 -1
  84. data/lib/rubygems/source/git.rb +2 -2
  85. data/lib/rubygems/source.rb +2 -9
  86. data/lib/rubygems/source_list.rb +1 -5
  87. data/lib/rubygems/spec_fetcher.rb +2 -2
  88. data/lib/rubygems/specification.rb +34 -8
  89. data/lib/rubygems/specification_policy.rb +1 -1
  90. data/lib/rubygems/uri.rb +41 -26
  91. data/lib/rubygems/util.rb +1 -1
  92. data/lib/rubygems.rb +2 -3
  93. data/rubygems-update.gemspec +1 -1
  94. data/test/rubygems/data/excon-0.7.7.gemspec.rz +0 -0
  95. data/test/rubygems/data/pry-0.4.7.gemspec.rz +0 -0
  96. data/test/rubygems/helper.rb +3 -3
  97. data/test/rubygems/package/tar_test_case.rb +1 -1
  98. data/test/rubygems/test_gem.rb +2 -2
  99. data/test/rubygems/test_gem_command_manager.rb +7 -1
  100. data/test/rubygems/test_gem_commands_contents_command.rb +1 -1
  101. data/test/rubygems/test_gem_commands_install_command.rb +2 -2
  102. data/test/rubygems/test_gem_commands_sources_command.rb +50 -0
  103. data/test/rubygems/test_gem_commands_update_command.rb +31 -0
  104. data/test/rubygems/test_gem_config_file.rb +3 -3
  105. data/test/rubygems/test_gem_ext_cargo_builder/custom_name/Cargo.lock +86 -74
  106. data/test/rubygems/test_gem_ext_cargo_builder/custom_name/Cargo.toml +1 -2
  107. data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/Cargo.lock +86 -74
  108. data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/Cargo.toml +1 -2
  109. data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/build.rb +2 -2
  110. data/test/rubygems/test_gem_ext_cargo_builder.rb +50 -19
  111. data/test/rubygems/test_gem_ext_cargo_builder_link_flag_converter.rb +33 -0
  112. data/test/rubygems/test_gem_ext_cargo_builder_unit.rb +75 -0
  113. data/test/rubygems/test_gem_gemcutter_utilities.rb +1 -1
  114. data/test/rubygems/test_gem_package.rb +1 -1
  115. data/test/rubygems/test_gem_remote_fetcher.rb +15 -15
  116. data/test/rubygems/test_gem_request_set_lockfile_parser.rb +1 -1
  117. data/test/rubygems/test_gem_resolver.rb +1 -1
  118. data/test/rubygems/test_gem_resolver_installer_set.rb +1 -1
  119. data/test/rubygems/test_gem_specification.rb +21 -13
  120. data/test/rubygems/test_require.rb +12 -12
  121. data/test/rubygems/test_rubygems.rb +4 -4
  122. metadata +8 -5
  123. data/lib/rubygems/psych_additions.rb +0 -10
  124. data/test/rubygems/data/null-type.gemspec.rz +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9b84404a23be4d5c0d8b792e3be778b73d70e395391e7a29fb6e5202ccd7e932
4
- data.tar.gz: cd324cb048ea993af5062c3be237860bceb0d8bc47fa0995b389dcc4894d388b
3
+ metadata.gz: f28d959e6c80a1a48380837de462a5d37b8c74ab83db7ddb52c33e923088a819
4
+ data.tar.gz: 8492c0f957c64cc02e779d7f23b2c925f5be4d79451ae52e39105c6a52bbcfd0
5
5
  SHA512:
6
- metadata.gz: 266f47a145a701aa9ca021b4e7d4ad78df5ecc4d65fcf08b987da9928da87c20c7ae756beb2b462e0a3eb652cdbeb1cae70625449506281e264e8718db8be772
7
- data.tar.gz: 770da1dba85ffa21b03002fbf0dd0227ce3bbe59d5e263dea4483e6fc752831c87d24b5dc0f59a8d255347403fbdb3d9852ae1378839d17cde9fb4d4a4d9ac6c
6
+ metadata.gz: c61d093abdc997d0c015c3323de9404e35e309454fe7541cce731f5a9ed6a46bc9f59aed0cefffad780a2f889e2decd43350562af66cc6ae07a8bc443bdb0c56
7
+ data.tar.gz: 55306fc3437106fb9f97379219449b50c875f22a80309c675202e8fbde767bf2066b3395a0cae88e7b065d90e0eb1b452340b753eefba1f33b410f6ff14e9666
data/CHANGELOG.md CHANGED
@@ -1,3 +1,40 @@
1
+ # 3.3.16 / 2022-06-15
2
+
3
+ ## Enhancements:
4
+
5
+ * Auto-fix and warn gem packages including a gemspec with `require_paths`
6
+ as an array of arrays. Pull request #5615 by deivid-rodriguez
7
+ * Misc cargo builder improvements. Pull request #5459 by ianks
8
+ * Installs bundler 2.3.16 as a default gem.
9
+
10
+ ## Bug fixes:
11
+
12
+ * Fix incorrect password redaction when there's an error in `gem source
13
+ -a`. Pull request #5623 by deivid-rodriguez
14
+ * Fix another regression when loading old marshaled specs. Pull request
15
+ #5610 by deivid-rodriguez
16
+
17
+ # 3.3.15 / 2022-06-01
18
+
19
+ ## Enhancements:
20
+
21
+ * Support the change of did_you_mean about `Exception#detailed_message`.
22
+ Pull request #5560 by mame
23
+ * Installs bundler 2.3.15 as a default gem.
24
+
25
+ ## Bug fixes:
26
+
27
+ * Fix loading old marshaled specs including `YAML::PrivateType` constant.
28
+ Pull request #5415 by deivid-rodriguez
29
+ * Fix rubygems update when non default `--install-dir` is configured. Pull
30
+ request #5566 by deivid-rodriguez
31
+
32
+ # 3.3.14 / 2022-05-18
33
+
34
+ ## Enhancements:
35
+
36
+ * Installs bundler 2.3.14 as a default gem.
37
+
1
38
  # 3.3.13 / 2022-05-04
2
39
 
3
40
  ## Enhancements:
data/Manifest.txt CHANGED
@@ -383,6 +383,7 @@ lib/rubygems/ext.rb
383
383
  lib/rubygems/ext/build_error.rb
384
384
  lib/rubygems/ext/builder.rb
385
385
  lib/rubygems/ext/cargo_builder.rb
386
+ lib/rubygems/ext/cargo_builder/link_flag_converter.rb
386
387
  lib/rubygems/ext/cmake_builder.rb
387
388
  lib/rubygems/ext/configure_builder.rb
388
389
  lib/rubygems/ext/ext_conf_builder.rb
@@ -424,7 +425,6 @@ lib/rubygems/package/tar_writer.rb
424
425
  lib/rubygems/package_task.rb
425
426
  lib/rubygems/path_support.rb
426
427
  lib/rubygems/platform.rb
427
- lib/rubygems/psych_additions.rb
428
428
  lib/rubygems/psych_tree.rb
429
429
  lib/rubygems/query_utils.rb
430
430
  lib/rubygems/rdoc.rb
@@ -538,11 +538,12 @@ test/rubygems/child_cert.pem
538
538
  test/rubygems/child_cert_32.pem
539
539
  test/rubygems/child_key.pem
540
540
  test/rubygems/client.pem
541
+ test/rubygems/data/excon-0.7.7.gemspec.rz
541
542
  test/rubygems/data/gem-private_key.pem
542
543
  test/rubygems/data/gem-public_cert.pem
543
544
  test/rubygems/data/null-required-ruby-version.gemspec.rz
544
545
  test/rubygems/data/null-required-rubygems-version.gemspec.rz
545
- test/rubygems/data/null-type.gemspec.rz
546
+ test/rubygems/data/pry-0.4.7.gemspec.rz
546
547
  test/rubygems/encrypted_private_key.pem
547
548
  test/rubygems/expired_cert.pem
548
549
  test/rubygems/fake_certlib/openssl.rb
@@ -649,6 +650,8 @@ test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/Cargo.toml
649
650
  test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/build.rb
650
651
  test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/rust_ruby_example.gemspec
651
652
  test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/src/lib.rs
653
+ test/rubygems/test_gem_ext_cargo_builder_link_flag_converter.rb
654
+ test/rubygems/test_gem_ext_cargo_builder_unit.rb
652
655
  test/rubygems/test_gem_ext_cmake_builder.rb
653
656
  test/rubygems/test_gem_ext_configure_builder.rb
654
657
  test/rubygems/test_gem_ext_ext_conf_builder.rb
data/bundler/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]
@@ -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
@@ -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