bundler 2.6.9 → 4.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (190) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +2212 -1879
  3. data/README.md +11 -11
  4. data/bundler.gemspec +5 -5
  5. data/lib/bundler/build_metadata.rb +10 -11
  6. data/lib/bundler/capistrano.rb +1 -19
  7. data/lib/bundler/checksum.rb +6 -0
  8. data/lib/bundler/cli/add.rb +10 -0
  9. data/lib/bundler/cli/cache.rb +1 -12
  10. data/lib/bundler/cli/common.rb +21 -4
  11. data/lib/bundler/cli/config.rb +1 -2
  12. data/lib/bundler/cli/console.rb +5 -0
  13. data/lib/bundler/cli/exec.rb +29 -4
  14. data/lib/bundler/cli/gem.rb +89 -63
  15. data/lib/bundler/cli/install.rb +15 -90
  16. data/lib/bundler/cli/issue.rb +2 -2
  17. data/lib/bundler/cli/list.rb +33 -2
  18. data/lib/bundler/cli/lock.rb +5 -5
  19. data/lib/bundler/cli/outdated.rb +1 -1
  20. data/lib/bundler/cli/plugin.rb +5 -1
  21. data/lib/bundler/cli/pristine.rb +5 -1
  22. data/lib/bundler/cli/show.rb +3 -7
  23. data/lib/bundler/cli/update.rb +5 -5
  24. data/lib/bundler/cli.rb +162 -127
  25. data/lib/bundler/compact_index_client.rb +1 -6
  26. data/lib/bundler/current_ruby.rb +17 -5
  27. data/lib/bundler/definition.rb +199 -117
  28. data/lib/bundler/dependency.rb +1 -1
  29. data/lib/bundler/deployment.rb +1 -64
  30. data/lib/bundler/digest.rb +1 -1
  31. data/lib/bundler/dsl.rb +48 -48
  32. data/lib/bundler/environment_preserver.rb +1 -0
  33. data/lib/bundler/errors.rb +1 -5
  34. data/lib/bundler/feature_flag.rb +5 -35
  35. data/lib/bundler/fetcher/compact_index.rb +1 -1
  36. data/lib/bundler/fetcher/dependency.rb +9 -2
  37. data/lib/bundler/fetcher/downloader.rb +33 -8
  38. data/lib/bundler/fetcher/gem_remote_fetcher.rb +6 -0
  39. data/lib/bundler/fetcher.rb +49 -19
  40. data/lib/bundler/friendly_errors.rb +4 -3
  41. data/lib/bundler/index.rb +7 -9
  42. data/lib/bundler/injector.rb +1 -2
  43. data/lib/bundler/inline.rb +9 -1
  44. data/lib/bundler/installer/gem_installer.rb +14 -11
  45. data/lib/bundler/installer/parallel_installer.rb +63 -17
  46. data/lib/bundler/installer.rb +6 -19
  47. data/lib/bundler/lazy_specification.rb +47 -20
  48. data/lib/bundler/lockfile_generator.rb +1 -1
  49. data/lib/bundler/lockfile_parser.rb +11 -5
  50. data/lib/bundler/man/bundle-add.1 +1 -1
  51. data/lib/bundler/man/bundle-binstubs.1 +3 -6
  52. data/lib/bundler/man/bundle-binstubs.1.ronn +4 -6
  53. data/lib/bundler/man/bundle-cache.1 +2 -14
  54. data/lib/bundler/man/bundle-cache.1.ronn +1 -14
  55. data/lib/bundler/man/bundle-check.1 +2 -5
  56. data/lib/bundler/man/bundle-check.1.ronn +0 -5
  57. data/lib/bundler/man/bundle-clean.1 +1 -1
  58. data/lib/bundler/man/bundle-config.1 +206 -148
  59. data/lib/bundler/man/bundle-config.1.ronn +135 -118
  60. data/lib/bundler/man/bundle-console.1 +1 -1
  61. data/lib/bundler/man/bundle-doctor.1 +43 -4
  62. data/lib/bundler/man/bundle-doctor.1.ronn +48 -4
  63. data/lib/bundler/man/bundle-env.1 +1 -1
  64. data/lib/bundler/man/bundle-exec.1 +2 -5
  65. data/lib/bundler/man/bundle-exec.1.ronn +1 -5
  66. data/lib/bundler/man/bundle-fund.1 +1 -1
  67. data/lib/bundler/man/bundle-gem.1 +64 -44
  68. data/lib/bundler/man/bundle-gem.1.ronn +10 -9
  69. data/lib/bundler/man/bundle-help.1 +1 -1
  70. data/lib/bundler/man/bundle-info.1 +1 -1
  71. data/lib/bundler/man/bundle-init.1 +1 -1
  72. data/lib/bundler/man/bundle-install.1 +16 -59
  73. data/lib/bundler/man/bundle-install.1.ronn +27 -108
  74. data/lib/bundler/man/bundle-issue.1 +1 -1
  75. data/lib/bundler/man/bundle-licenses.1 +1 -1
  76. data/lib/bundler/man/bundle-list.1 +6 -1
  77. data/lib/bundler/man/bundle-list.1.ronn +5 -0
  78. data/lib/bundler/man/bundle-lock.1 +1 -1
  79. data/lib/bundler/man/bundle-open.1 +1 -1
  80. data/lib/bundler/man/bundle-outdated.1 +1 -1
  81. data/lib/bundler/man/bundle-platform.1 +1 -1
  82. data/lib/bundler/man/bundle-plugin.1 +33 -15
  83. data/lib/bundler/man/bundle-plugin.1.ronn +36 -15
  84. data/lib/bundler/man/bundle-pristine.1 +1 -1
  85. data/lib/bundler/man/bundle-remove.1 +2 -8
  86. data/lib/bundler/man/bundle-remove.1.ronn +1 -8
  87. data/lib/bundler/man/bundle-show.1 +2 -5
  88. data/lib/bundler/man/bundle-show.1.ronn +0 -4
  89. data/lib/bundler/man/bundle-update.1 +5 -5
  90. data/lib/bundler/man/bundle-update.1.ronn +4 -4
  91. data/lib/bundler/man/bundle-version.1 +1 -1
  92. data/lib/bundler/man/bundle.1 +1 -10
  93. data/lib/bundler/man/bundle.1.ronn +0 -9
  94. data/lib/bundler/man/gemfile.5 +32 -1
  95. data/lib/bundler/man/gemfile.5.ronn +28 -0
  96. data/lib/bundler/man/index.txt +0 -2
  97. data/lib/bundler/match_platform.rb +31 -12
  98. data/lib/bundler/materialization.rb +3 -3
  99. data/lib/bundler/plugin/api/source.rb +8 -0
  100. data/lib/bundler/plugin/index.rb +6 -0
  101. data/lib/bundler/plugin/installer.rb +2 -11
  102. data/lib/bundler/plugin/source_list.rb +1 -1
  103. data/lib/bundler/plugin.rb +7 -4
  104. data/lib/bundler/resolver/package.rb +2 -1
  105. data/lib/bundler/resolver/strategy.rb +6 -3
  106. data/lib/bundler/resolver.rb +20 -4
  107. data/lib/bundler/retry.rb +30 -4
  108. data/lib/bundler/ruby_dsl.rb +17 -12
  109. data/lib/bundler/ruby_version.rb +1 -3
  110. data/lib/bundler/rubygems_ext.rb +117 -121
  111. data/lib/bundler/rubygems_gem_installer.rb +5 -4
  112. data/lib/bundler/rubygems_integration.rb +13 -12
  113. data/lib/bundler/runtime.rb +14 -3
  114. data/lib/bundler/self_manager.rb +34 -43
  115. data/lib/bundler/settings/validator.rb +5 -21
  116. data/lib/bundler/settings.rb +17 -32
  117. data/lib/bundler/shared_helpers.rb +12 -18
  118. data/lib/bundler/source/gemspec.rb +4 -0
  119. data/lib/bundler/source/git/git_proxy.rb +55 -29
  120. data/lib/bundler/source/git.rb +2 -3
  121. data/lib/bundler/source/path.rb +12 -7
  122. data/lib/bundler/source/rubygems.rb +59 -43
  123. data/lib/bundler/source/rubygems_aggregate.rb +4 -1
  124. data/lib/bundler/source.rb +3 -1
  125. data/lib/bundler/source_list.rb +5 -50
  126. data/lib/bundler/source_map.rb +8 -7
  127. data/lib/bundler/spec_set.rb +9 -14
  128. data/lib/bundler/stub_specification.rb +1 -0
  129. data/lib/bundler/templates/Executable +0 -11
  130. data/lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt +7 -129
  131. data/lib/bundler/templates/newgem/Cargo.toml.tt +6 -0
  132. data/lib/bundler/templates/newgem/Rakefile.tt +5 -0
  133. data/lib/bundler/templates/newgem/circleci/config.yml.tt +12 -0
  134. data/lib/bundler/templates/newgem/ext/newgem/Cargo.toml.tt +8 -1
  135. data/lib/bundler/templates/newgem/ext/newgem/build.rs.tt +5 -0
  136. data/lib/bundler/templates/newgem/ext/newgem/extconf-go.rb.tt +11 -0
  137. data/lib/bundler/templates/newgem/ext/newgem/go.mod.tt +5 -0
  138. data/lib/bundler/templates/newgem/ext/newgem/newgem-go.c.tt +2 -0
  139. data/lib/bundler/templates/newgem/ext/newgem/newgem.go.tt +31 -0
  140. data/lib/bundler/templates/newgem/ext/newgem/src/lib.rs.tt +13 -2
  141. data/lib/bundler/templates/newgem/github/workflows/build-gems.yml.tt +69 -0
  142. data/lib/bundler/templates/newgem/github/workflows/main.yml.tt +12 -1
  143. data/lib/bundler/templates/newgem/gitlab-ci.yml.tt +9 -0
  144. data/lib/bundler/templates/newgem/lib/newgem.rb.tt +1 -1
  145. data/lib/bundler/templates/newgem/newgem.gemspec.tt +10 -10
  146. data/lib/bundler/templates/newgem/spec/newgem_spec.rb.tt +8 -0
  147. data/lib/bundler/templates/newgem/test/minitest/test_newgem.rb.tt +6 -0
  148. data/lib/bundler/ui/shell.rb +12 -8
  149. data/lib/bundler/vendor/connection_pool/lib/connection_pool/timed_stack.rb +26 -23
  150. data/lib/bundler/vendor/connection_pool/lib/connection_pool/version.rb +1 -1
  151. data/lib/bundler/vendor/connection_pool/lib/connection_pool.rb +50 -6
  152. data/lib/bundler/vendor/fileutils/lib/fileutils.rb +57 -52
  153. data/lib/bundler/vendor/net-http-persistent/README.rdoc +1 -1
  154. data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/timed_stack_multi.rb +2 -1
  155. data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +84 -42
  156. data/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +42 -6
  157. data/lib/bundler/vendor/thor/lib/thor/parser/options.rb +1 -1
  158. data/lib/bundler/vendor/thor/lib/thor/runner.rb +2 -2
  159. data/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +3 -7
  160. data/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
  161. data/lib/bundler/vendor/thor/lib/thor.rb +1 -1
  162. data/lib/bundler/vendor/uri/lib/uri/common.rb +57 -15
  163. data/lib/bundler/vendor/uri/lib/uri/file.rb +1 -1
  164. data/lib/bundler/vendor/uri/lib/uri/generic.rb +34 -21
  165. data/lib/bundler/vendor/uri/lib/uri/http.rb +12 -0
  166. data/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb +9 -8
  167. data/lib/bundler/vendor/uri/lib/uri/version.rb +2 -2
  168. data/lib/bundler/version.rb +10 -2
  169. data/lib/bundler/vlad.rb +1 -14
  170. data/lib/bundler/worker.rb +12 -4
  171. data/lib/bundler.rb +20 -40
  172. metadata +13 -25
  173. data/lib/bundler/cli/inject.rb +0 -60
  174. data/lib/bundler/cli/viz.rb +0 -31
  175. data/lib/bundler/gem_helpers.rb +0 -144
  176. data/lib/bundler/graph.rb +0 -152
  177. data/lib/bundler/man/bundle-inject.1 +0 -31
  178. data/lib/bundler/man/bundle-inject.1.ronn +0 -32
  179. data/lib/bundler/man/bundle-viz.1 +0 -30
  180. data/lib/bundler/man/bundle-viz.1.ronn +0 -36
  181. data/lib/bundler/similarity_detector.rb +0 -63
  182. data/lib/bundler/templates/Executable.bundler +0 -109
  183. data/lib/bundler/vendor/connection_pool/.document +0 -1
  184. data/lib/bundler/vendor/fileutils/.document +0 -1
  185. data/lib/bundler/vendor/net-http-persistent/.document +0 -1
  186. data/lib/bundler/vendor/pub_grub/.document +0 -1
  187. data/lib/bundler/vendor/securerandom/.document +0 -1
  188. data/lib/bundler/vendor/thor/.document +0 -1
  189. data/lib/bundler/vendor/tsort/.document +0 -1
  190. data/lib/bundler/vendor/uri/.document +0 -1
data/README.md CHANGED
@@ -6,7 +6,7 @@ Bundler makes sure Ruby applications run the same code on every machine.
6
6
 
7
7
  It does this by managing the gems that the application depends on. Given a list of gems, it can automatically download and install those gems, as well as any other gems needed by the gems that are listed. Before installing gems, it checks the versions of every gem to make sure that they are compatible, and can all be loaded at the same time. After the gems have been installed, Bundler can help you update some or all of them when new versions become available. Finally, it records the exact versions that have been installed, so that others can install the exact same gems.
8
8
 
9
- ### Installation and usage
9
+ ## Installation and usage
10
10
 
11
11
  To install (or update to the latest version):
12
12
 
@@ -27,32 +27,32 @@ bundle exec rspec
27
27
 
28
28
  See [bundler.io](https://bundler.io) for the full documentation.
29
29
 
30
- ### Troubleshooting
30
+ ## Troubleshooting
31
31
 
32
32
  For help with common problems, see [TROUBLESHOOTING](../doc/bundler/TROUBLESHOOTING.md).
33
33
 
34
- Still stuck? Try [filing an issue](https://github.com/rubygems/rubygems/issues/new?labels=Bundler&template=bundler-related-issue.md).
34
+ Still stuck? Try [filing an issue](https://github.com/ruby/rubygems/issues/new?labels=Bundler&template=bundler-related-issue.md).
35
35
 
36
- ### Other questions
36
+ ## Other questions
37
37
 
38
38
  To see what has changed in recent versions of Bundler, see the [CHANGELOG](CHANGELOG.md).
39
39
 
40
40
  To get in touch with the Bundler core team and other Bundler users, please join [the Bundler slack](https://join.slack.com/t/bundler/shared_invite/zt-1rrsuuv3m-OmXKWQf8K6iSla4~F1DBjQ).
41
41
 
42
- ### Contributing
42
+ ## Contributing
43
43
 
44
- If you'd like to contribute to Bundler, that's awesome, and we <3 you. We've put together [the Bundler contributor guide](https://github.com/rubygems/rubygems/blob/master/doc/bundler/contributing/README.md) with all of the information you need to get started.
44
+ If you'd like to contribute to Bundler, that's awesome, and we <3 you. We've put together [the Bundler contributor guide](https://github.com/ruby/rubygems/blob/master/doc/bundler/contributing/README.md) with all of the information you need to get started.
45
45
 
46
46
  If you'd like to request a substantial change to Bundler or its documentation, refer to the [Bundler RFC process](https://github.com/rubygems/rfcs) for more information.
47
47
 
48
- ### Supporting
48
+ ## Supporting
49
49
 
50
50
  RubyGems is managed by [Ruby Central](https://rubycentral.org), a non-profit organization that supports the Ruby community through projects like this one, as well as [RubyConf](https://rubyconf.org), [RailsConf](https://railsconf.org), and [RubyGems.org](https://rubygems.org). You can support Ruby Central by attending or [sponsoring](sponsors@rubycentral.org) a conference, or by [joining as a supporting member](https://rubycentral.org/#/portal/signup).
51
51
 
52
- ### Code of Conduct
52
+ ## Code of Conduct
53
53
 
54
- Everyone interacting in the Bundler project's codebases, issue trackers, chat rooms, and mailing lists is expected to follow the [Bundler code of conduct](https://github.com/rubygems/rubygems/blob/master/CODE_OF_CONDUCT.md).
54
+ Everyone interacting in the Bundler project's codebases, issue trackers, chat rooms, and mailing lists is expected to follow the [Bundler code of conduct](https://github.com/ruby/rubygems/blob/master/CODE_OF_CONDUCT.md).
55
55
 
56
- ### License
56
+ ## License
57
57
 
58
- Bundler is available under an [MIT License](https://github.com/rubygems/rubygems/blob/master/bundler/LICENSE.md).
58
+ Bundler is available under an [MIT License](https://github.com/ruby/rubygems/blob/master/bundler/LICENSE.md).
data/bundler.gemspec CHANGED
@@ -23,16 +23,16 @@ Gem::Specification.new do |s|
23
23
  s.description = "Bundler manages an application's dependencies through its entire life, across many machines, systematically and repeatably"
24
24
 
25
25
  s.metadata = {
26
- "bug_tracker_uri" => "https://github.com/rubygems/rubygems/issues?q=is%3Aopen+is%3Aissue+label%3ABundler",
27
- "changelog_uri" => "https://github.com/rubygems/rubygems/blob/master/bundler/CHANGELOG.md",
26
+ "bug_tracker_uri" => "https://github.com/ruby/rubygems/issues?q=is%3Aopen+is%3Aissue+label%3ABundler",
27
+ "changelog_uri" => "https://github.com/ruby/rubygems/blob/master/bundler/CHANGELOG.md",
28
28
  "homepage_uri" => "https://bundler.io/",
29
- "source_code_uri" => "https://github.com/rubygems/rubygems/tree/master/bundler",
29
+ "source_code_uri" => "https://github.com/ruby/rubygems/tree/master/bundler",
30
30
  }
31
31
 
32
- s.required_ruby_version = ">= 3.1.0"
32
+ s.required_ruby_version = ">= 3.2.0"
33
33
 
34
34
  # It should match the RubyGems version shipped with `required_ruby_version` above
35
- s.required_rubygems_version = ">= 3.3.3"
35
+ s.required_rubygems_version = ">= 3.4.1"
36
36
 
37
37
  s.files = Dir.glob("lib/bundler{.rb,/**/*}", File::FNM_DOTMATCH).reject {|f| File.directory?(f) }
38
38
 
@@ -4,23 +4,27 @@ module Bundler
4
4
  # Represents metadata from when the Bundler gem was built.
5
5
  module BuildMetadata
6
6
  # begin ivars
7
- @built_at = "1980-01-02".freeze
8
- @git_commit_sha = "8a2a14d63da".freeze
9
- @release = true
7
+ @built_at = nil
8
+ @git_commit_sha = "1c1d885018".freeze
10
9
  # end ivars
11
10
 
12
11
  # A hash representation of the build metadata.
13
12
  def self.to_h
14
13
  {
15
- "Built At" => built_at,
14
+ "Timestamp" => timestamp,
16
15
  "Git SHA" => git_commit_sha,
17
- "Released Version" => release?,
18
16
  }
19
17
  end
20
18
 
19
+ # A timestamp representing the date the bundler gem was built, or the
20
+ # current time if never built
21
+ def self.timestamp
22
+ @timestamp ||= @built_at || Time.now.utc.strftime("%Y-%m-%d").freeze
23
+ end
24
+
21
25
  # A string representing the date the bundler gem was built.
22
26
  def self.built_at
23
- @built_at ||= Time.now.utc.strftime("%Y-%m-%d").freeze
27
+ @built_at
24
28
  end
25
29
 
26
30
  # The SHA for the git commit the bundler gem was built from.
@@ -36,10 +40,5 @@ module Bundler
36
40
 
37
41
  @git_commit_sha ||= "unknown"
38
42
  end
39
-
40
- # Whether this is an official release build of Bundler.
41
- def self.release?
42
- @release
43
- end
44
43
  end
45
44
  end
@@ -1,22 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative "shared_helpers"
4
- Bundler::SharedHelpers.major_deprecation 2,
5
- "The Bundler task for Capistrano. Please use https://github.com/capistrano/bundler"
6
-
7
- # Capistrano task for Bundler.
8
- #
9
- # Add "require 'bundler/capistrano'" in your Capistrano deploy.rb, and
10
- # Bundler will be activated after each new deployment.
11
- require_relative "deployment"
12
- require "capistrano/version"
13
-
14
- if defined?(Capistrano::Version) && Gem::Version.new(Capistrano::Version).release >= Gem::Version.new("3.0")
15
- raise "For Capistrano 3.x integration, please use https://github.com/capistrano/bundler"
16
- end
17
-
18
- Capistrano::Configuration.instance(:must_exist).load do
19
- before "deploy:finalize_update", "bundle:install"
20
- Bundler::Deployment.define_task(self, :task, except: { no_release: true })
21
- set :rake, lambda { "#{fetch(:bundle_cmd, "bundle")} exec rake" }
22
- end
4
+ Bundler::SharedHelpers.feature_removed! "The Bundler task for Capistrano. Please use https://github.com/capistrano/bundler"
@@ -205,6 +205,12 @@ module Bundler
205
205
  @store[spec.lock_name].nil?
206
206
  end
207
207
 
208
+ def empty?(spec)
209
+ return false unless spec.source.is_a?(Bundler::Source::Rubygems)
210
+
211
+ @store[spec.lock_name].empty?
212
+ end
213
+
208
214
  def register(spec, checksum)
209
215
  register_checksum(spec.lock_name, checksum)
210
216
  end
@@ -36,6 +36,16 @@ module Bundler
36
36
  end
37
37
 
38
38
  def validate_options!
39
+ raise InvalidOption, "You cannot specify `--git` and `--github` at the same time." if options["git"] && options["github"]
40
+
41
+ unless options["git"] || options["github"]
42
+ raise InvalidOption, "You cannot specify `--branch` unless `--git` or `--github` is specified." if options["branch"]
43
+
44
+ raise InvalidOption, "You cannot specify `--ref` unless `--git` or `--github` is specified." if options["ref"]
45
+ end
46
+
47
+ raise InvalidOption, "You cannot specify `--branch` and `--ref` at the same time." if options["branch"] && options["ref"]
48
+
39
49
  raise InvalidOption, "You cannot specify `--strict` and `--optimistic` at the same time." if options[:strict] && options[:optimistic]
40
50
 
41
51
  # raise error when no gems are specified
@@ -10,17 +10,12 @@ module Bundler
10
10
 
11
11
  def run
12
12
  Bundler.ui.level = "warn" if options[:quiet]
13
- Bundler.settings.set_command_option_if_given :path, options[:path]
14
13
  Bundler.settings.set_command_option_if_given :cache_path, options["cache-path"]
15
14
 
16
- setup_cache_all
17
15
  install
18
16
 
19
- # TODO: move cache contents here now that all bundles are locked
20
- custom_path = Bundler.settings[:path] if options[:path]
21
-
22
17
  Bundler.settings.temporary(cache_all_platforms: options["all-platforms"]) do
23
- Bundler.load.cache(custom_path)
18
+ Bundler.load.cache
24
19
  end
25
20
  end
26
21
 
@@ -33,11 +28,5 @@ module Bundler
33
28
  options["no-cache"] = true
34
29
  Bundler::CLI::Install.new(options).run
35
30
  end
36
-
37
- def setup_cache_all
38
- all = options.fetch(:all, Bundler.feature_flag.cache_all? || nil)
39
-
40
- Bundler.settings.set_command_option_if_given :cache_all, all
41
- end
42
31
  end
43
32
  end
@@ -94,11 +94,14 @@ module Bundler
94
94
  end
95
95
 
96
96
  def self.gem_not_found_message(missing_gem_name, alternatives)
97
- require_relative "../similarity_detector"
98
97
  message = "Could not find gem '#{missing_gem_name}'."
99
98
  alternate_names = alternatives.map {|a| a.respond_to?(:name) ? a.name : a }
100
- suggestions = SimilarityDetector.new(alternate_names).similar_word_list(missing_gem_name)
101
- message += "\nDid you mean #{suggestions}?" if suggestions
99
+ if alternate_names.include?(missing_gem_name.downcase)
100
+ message += "\nDid you mean '#{missing_gem_name.downcase}'?"
101
+ elsif defined?(DidYouMean::SpellChecker)
102
+ suggestions = DidYouMean::SpellChecker.new(dictionary: alternate_names).correct(missing_gem_name)
103
+ message += "\nDid you mean #{word_list(suggestions)}?" unless suggestions.empty?
104
+ end
102
105
  message
103
106
  end
104
107
 
@@ -130,9 +133,23 @@ module Bundler
130
133
  def self.clean_after_install?
131
134
  clean = Bundler.settings[:clean]
132
135
  return clean unless clean.nil?
133
- clean ||= Bundler.feature_flag.auto_clean_without_path? && Bundler.settings[:path].nil?
136
+ clean ||= Bundler.feature_flag.bundler_5_mode? && Bundler.settings[:path].nil?
134
137
  clean &&= !Bundler.use_system_gems?
135
138
  clean
136
139
  end
140
+
141
+ def self.word_list(words)
142
+ if words.empty?
143
+ return ""
144
+ end
145
+
146
+ words = words.map {|word| "'#{word}'" }
147
+
148
+ if words.length == 1
149
+ return words[0]
150
+ end
151
+
152
+ [words[0..-2].join(", "), words[-1]].join(" or ")
153
+ end
137
154
  end
138
155
  end
@@ -26,8 +26,7 @@ module Bundler
26
26
  end
27
27
 
28
28
  message = "Using the `config` command without a subcommand [list, get, set, unset] is deprecated and will be removed in the future. Use `bundle #{new_args.join(" ")}` instead."
29
- removed_message = "Using the `config` command without a subcommand [list, get, set, unset] is has been removed. Use `bundle #{new_args.join(" ")}` instead."
30
- SharedHelpers.major_deprecation 3, message, removed_message: removed_message
29
+ SharedHelpers.feature_deprecated! message
31
30
 
32
31
  Base.new(options, name, value, self).run
33
32
  end
@@ -21,6 +21,11 @@ module Bundler
21
21
  get_constant(name)
22
22
  rescue LoadError
23
23
  if name == "irb"
24
+ if defined?(Gem::BUNDLED_GEMS) && Gem::BUNDLED_GEMS.respond_to?(:force_activate)
25
+ Gem::BUNDLED_GEMS.force_activate "irb"
26
+ require name
27
+ return get_constant(name)
28
+ end
24
29
  Bundler.ui.error "#{name} is not available"
25
30
  exit 1
26
31
  else
@@ -19,11 +19,13 @@ module Bundler
19
19
  validate_cmd!
20
20
  SharedHelpers.set_bundle_environment
21
21
  if bin_path = Bundler.which(cmd)
22
- if !Bundler.settings[:disable_exec_load] && ruby_shebang?(bin_path)
23
- return kernel_load(bin_path, *args)
22
+ if !Bundler.settings[:disable_exec_load] && directly_loadable?(bin_path)
23
+ bin_path.delete_suffix!(".bat") if Gem.win_platform?
24
+ kernel_load(bin_path, *args)
25
+ else
26
+ bin_path = "./" + bin_path unless File.absolute_path?(bin_path)
27
+ kernel_exec(bin_path, *args)
24
28
  end
25
- bin_path = "./" + bin_path unless File.absolute_path?(bin_path)
26
- kernel_exec(bin_path, *args)
27
29
  else
28
30
  # exec using the given command
29
31
  kernel_exec(cmd, *args)
@@ -69,6 +71,29 @@ module Bundler
69
71
  "#{file} #{args.join(" ")}".strip
70
72
  end
71
73
 
74
+ def directly_loadable?(file)
75
+ if Gem.win_platform?
76
+ script_wrapper?(file)
77
+ else
78
+ ruby_shebang?(file)
79
+ end
80
+ end
81
+
82
+ def script_wrapper?(file)
83
+ script_file = file.delete_suffix(".bat")
84
+ return false unless File.exist?(script_file)
85
+
86
+ if File.zero?(script_file)
87
+ Bundler.ui.warn "#{script_file} is empty"
88
+ return false
89
+ end
90
+
91
+ header = File.open(file, "r") {|f| f.read(32) }
92
+ ruby_exe = "#{RbConfig::CONFIG["RUBY_INSTALL_NAME"]}#{RbConfig::CONFIG["EXEEXT"]}"
93
+ ruby_exe = "ruby.exe" if ruby_exe.empty?
94
+ header.include?(ruby_exe)
95
+ end
96
+
72
97
  def ruby_shebang?(file)
73
98
  possibilities = [
74
99
  "#!/usr/bin/env ruby\n",