bundler 2.7.2 → 4.0.0.beta1

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 (135) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +990 -917
  3. data/README.md +4 -4
  4. data/bundler.gemspec +3 -3
  5. data/lib/bundler/build_metadata.rb +2 -2
  6. data/lib/bundler/capistrano.rb +1 -19
  7. data/lib/bundler/cli/cache.rb +1 -11
  8. data/lib/bundler/cli/common.rb +20 -3
  9. data/lib/bundler/cli/config.rb +1 -2
  10. data/lib/bundler/cli/console.rb +5 -0
  11. data/lib/bundler/cli/exec.rb +29 -4
  12. data/lib/bundler/cli/gem.rb +19 -33
  13. data/lib/bundler/cli/install.rb +7 -82
  14. data/lib/bundler/cli/issue.rb +2 -2
  15. data/lib/bundler/cli/list.rb +33 -2
  16. data/lib/bundler/cli/plugin.rb +5 -1
  17. data/lib/bundler/cli/show.rb +1 -1
  18. data/lib/bundler/cli/update.rb +3 -3
  19. data/lib/bundler/cli.rb +75 -83
  20. data/lib/bundler/compact_index_client.rb +0 -1
  21. data/lib/bundler/current_ruby.rb +3 -15
  22. data/lib/bundler/definition.rb +45 -35
  23. data/lib/bundler/deployment.rb +1 -64
  24. data/lib/bundler/digest.rb +1 -1
  25. data/lib/bundler/dsl.rb +13 -35
  26. data/lib/bundler/endpoint_specification.rb +0 -22
  27. data/lib/bundler/errors.rb +1 -5
  28. data/lib/bundler/feature_flag.rb +0 -33
  29. data/lib/bundler/fetcher/compact_index.rb +1 -1
  30. data/lib/bundler/friendly_errors.rb +2 -2
  31. data/lib/bundler/index.rb +0 -7
  32. data/lib/bundler/inline.rb +1 -1
  33. data/lib/bundler/installer/gem_installer.rb +0 -11
  34. data/lib/bundler/installer.rb +0 -6
  35. data/lib/bundler/lockfile_generator.rb +1 -1
  36. data/lib/bundler/lockfile_parser.rb +2 -12
  37. data/lib/bundler/man/bundle-add.1 +1 -1
  38. data/lib/bundler/man/bundle-binstubs.1 +3 -6
  39. data/lib/bundler/man/bundle-binstubs.1.ronn +4 -6
  40. data/lib/bundler/man/bundle-cache.1 +2 -14
  41. data/lib/bundler/man/bundle-cache.1.ronn +1 -14
  42. data/lib/bundler/man/bundle-check.1 +2 -5
  43. data/lib/bundler/man/bundle-check.1.ronn +0 -5
  44. data/lib/bundler/man/bundle-clean.1 +1 -1
  45. data/lib/bundler/man/bundle-config.1 +6 -33
  46. data/lib/bundler/man/bundle-config.1.ronn +20 -55
  47. data/lib/bundler/man/bundle-console.1 +1 -1
  48. data/lib/bundler/man/bundle-doctor.1 +1 -1
  49. data/lib/bundler/man/bundle-env.1 +1 -1
  50. data/lib/bundler/man/bundle-exec.1 +2 -5
  51. data/lib/bundler/man/bundle-exec.1.ronn +1 -5
  52. data/lib/bundler/man/bundle-fund.1 +1 -1
  53. data/lib/bundler/man/bundle-gem.1 +3 -6
  54. data/lib/bundler/man/bundle-gem.1.ronn +2 -5
  55. data/lib/bundler/man/bundle-help.1 +1 -1
  56. data/lib/bundler/man/bundle-info.1 +1 -1
  57. data/lib/bundler/man/bundle-init.1 +1 -1
  58. data/lib/bundler/man/bundle-install.1 +8 -59
  59. data/lib/bundler/man/bundle-install.1.ronn +12 -107
  60. data/lib/bundler/man/bundle-issue.1 +1 -1
  61. data/lib/bundler/man/bundle-licenses.1 +1 -1
  62. data/lib/bundler/man/bundle-list.1 +6 -1
  63. data/lib/bundler/man/bundle-list.1.ronn +5 -0
  64. data/lib/bundler/man/bundle-lock.1 +1 -1
  65. data/lib/bundler/man/bundle-open.1 +1 -1
  66. data/lib/bundler/man/bundle-outdated.1 +1 -1
  67. data/lib/bundler/man/bundle-platform.1 +1 -1
  68. data/lib/bundler/man/bundle-plugin.1 +2 -9
  69. data/lib/bundler/man/bundle-plugin.1.ronn +0 -8
  70. data/lib/bundler/man/bundle-pristine.1 +1 -1
  71. data/lib/bundler/man/bundle-remove.1 +2 -8
  72. data/lib/bundler/man/bundle-remove.1.ronn +1 -8
  73. data/lib/bundler/man/bundle-show.1 +2 -5
  74. data/lib/bundler/man/bundle-show.1.ronn +0 -4
  75. data/lib/bundler/man/bundle-update.1 +1 -1
  76. data/lib/bundler/man/bundle-version.1 +1 -1
  77. data/lib/bundler/man/bundle.1 +1 -10
  78. data/lib/bundler/man/bundle.1.ronn +0 -9
  79. data/lib/bundler/man/gemfile.5 +1 -1
  80. data/lib/bundler/man/index.txt +0 -2
  81. data/lib/bundler/materialization.rb +1 -1
  82. data/lib/bundler/plugin/installer.rb +0 -10
  83. data/lib/bundler/plugin/source_list.rb +1 -1
  84. data/lib/bundler/plugin.rb +1 -1
  85. data/lib/bundler/resolver.rb +1 -1
  86. data/lib/bundler/ruby_dsl.rb +2 -0
  87. data/lib/bundler/ruby_version.rb +1 -3
  88. data/lib/bundler/rubygems_ext.rb +1 -1
  89. data/lib/bundler/rubygems_gem_installer.rb +1 -1
  90. data/lib/bundler/rubygems_integration.rb +1 -5
  91. data/lib/bundler/self_manager.rb +1 -1
  92. data/lib/bundler/settings.rb +7 -26
  93. data/lib/bundler/shared_helpers.rb +8 -20
  94. data/lib/bundler/source/git/git_proxy.rb +3 -11
  95. data/lib/bundler/source/git.rb +2 -3
  96. data/lib/bundler/source/path.rb +3 -7
  97. data/lib/bundler/source/rubygems.rb +11 -17
  98. data/lib/bundler/source.rb +1 -1
  99. data/lib/bundler/source_list.rb +4 -45
  100. data/lib/bundler/source_map.rb +2 -5
  101. data/lib/bundler/spec_set.rb +6 -15
  102. data/lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt +7 -129
  103. data/lib/bundler/templates/newgem/circleci/config.yml.tt +12 -0
  104. data/lib/bundler/templates/newgem/ext/newgem/Cargo.toml.tt +1 -1
  105. data/lib/bundler/templates/newgem/ext/newgem/extconf-go.rb.tt +11 -0
  106. data/lib/bundler/templates/newgem/ext/newgem/go.mod.tt +5 -0
  107. data/lib/bundler/templates/newgem/ext/newgem/newgem-go.c.tt +2 -0
  108. data/lib/bundler/templates/newgem/ext/newgem/newgem.go.tt +31 -0
  109. data/lib/bundler/templates/newgem/github/workflows/main.yml.tt +6 -0
  110. data/lib/bundler/templates/newgem/gitlab-ci.yml.tt +9 -0
  111. data/lib/bundler/templates/newgem/newgem.gemspec.tt +4 -1
  112. data/lib/bundler/vendor/connection_pool/lib/connection_pool/timed_stack.rb +26 -23
  113. data/lib/bundler/vendor/connection_pool/lib/connection_pool/version.rb +1 -1
  114. data/lib/bundler/vendor/connection_pool/lib/connection_pool.rb +50 -6
  115. data/lib/bundler/vendor/fileutils/lib/fileutils.rb +57 -52
  116. data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +5 -2
  117. data/lib/bundler/vendor/thor/lib/thor/runner.rb +1 -1
  118. data/lib/bundler/vendor/uri/lib/uri/common.rb +57 -15
  119. data/lib/bundler/vendor/uri/lib/uri/file.rb +1 -1
  120. data/lib/bundler/vendor/uri/lib/uri/generic.rb +34 -21
  121. data/lib/bundler/vendor/uri/lib/uri/http.rb +12 -0
  122. data/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb +9 -8
  123. data/lib/bundler/vendor/uri/lib/uri/version.rb +2 -2
  124. data/lib/bundler/version.rb +1 -1
  125. data/lib/bundler/vlad.rb +1 -14
  126. data/lib/bundler.rb +6 -28
  127. metadata +9 -13
  128. data/lib/bundler/cli/inject.rb +0 -60
  129. data/lib/bundler/cli/viz.rb +0 -31
  130. data/lib/bundler/graph.rb +0 -152
  131. data/lib/bundler/man/bundle-inject.1 +0 -31
  132. data/lib/bundler/man/bundle-inject.1.ronn +0 -32
  133. data/lib/bundler/man/bundle-viz.1 +0 -30
  134. data/lib/bundler/man/bundle-viz.1.ronn +0 -36
  135. data/lib/bundler/similarity_detector.rb +0 -63
data/README.md CHANGED
@@ -31,7 +31,7 @@ See [bundler.io](https://bundler.io) for the full documentation.
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
36
  ## Other questions
37
37
 
@@ -41,7 +41,7 @@ To get in touch with the Bundler core team and other Bundler users, please join
41
41
 
42
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
 
@@ -51,8 +51,8 @@ RubyGems is managed by [Ruby Central](https://rubycentral.org), a non-profit org
51
51
 
52
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
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,10 +23,10 @@ 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
32
  s.required_ruby_version = ">= 3.2.0"
@@ -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 = "2025-09-09".freeze
8
- @git_commit_sha = "b463ced1459".freeze
7
+ @built_at = "2025-11-20".freeze
8
+ @git_commit_sha = "9be811c01a".freeze
9
9
  # end ivars
10
10
 
11
11
  # A hash representation of the build metadata.
@@ -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"
@@ -10,16 +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
- custom_path = Bundler.settings[:path] if options[:path]
20
-
21
17
  Bundler.settings.temporary(cache_all_platforms: options["all-platforms"]) do
22
- Bundler.load.cache(custom_path)
18
+ Bundler.load.cache
23
19
  end
24
20
  end
25
21
 
@@ -32,11 +28,5 @@ module Bundler
32
28
  options["no-cache"] = true
33
29
  Bundler::CLI::Install.new(options).run
34
30
  end
35
-
36
- def setup_cache_all
37
- all = options.fetch(:all, Bundler.feature_flag.cache_all? || nil)
38
-
39
- Bundler.settings.set_command_option_if_given :cache_all, all
40
- end
41
31
  end
42
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
 
@@ -134,5 +137,19 @@ module Bundler
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] has been removed. Use `bundle #{new_args.join(" ")}` instead."
30
- SharedHelpers.major_deprecation 4, 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",
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "pathname"
4
-
5
3
  module Bundler
6
4
  class CLI
7
5
  Bundler.require_thor_actions
@@ -15,6 +13,8 @@ module Bundler
15
13
  "test-unit" => "3.0",
16
14
  }.freeze
17
15
 
16
+ DEFAULT_GITHUB_USERNAME = "[USERNAME]"
17
+
18
18
  attr_reader :options, :gem_name, :thor, :name, :target, :extension
19
19
 
20
20
  def initialize(options, gem_name, thor)
@@ -26,7 +26,7 @@ module Bundler
26
26
  thor.destination_root = nil
27
27
 
28
28
  @name = @gem_name
29
- @target = SharedHelpers.pwd.join(gem_name)
29
+ @target = Pathname.new(SharedHelpers.pwd).join(gem_name)
30
30
 
31
31
  @extension = options[:ext]
32
32
 
@@ -74,7 +74,7 @@ module Bundler
74
74
  bundle: options[:bundle],
75
75
  bundler_version: bundler_dependency_version,
76
76
  git: use_git,
77
- github_username: github_username.empty? ? "[USERNAME]" : github_username,
77
+ github_username: github_username.empty? ? DEFAULT_GITHUB_USERNAME : github_username,
78
78
  required_ruby_version: required_ruby_version,
79
79
  rust_builder_required_rubygems_version: rust_builder_required_rubygems_version,
80
80
  minitest_constant_name: minitest_constant_name,
@@ -178,12 +178,8 @@ module Bundler
178
178
 
179
179
  if ask_and_set(:coc, "Do you want to include a code of conduct in gems you generate?",
180
180
  "Codes of conduct can increase contributions to your project by contributors who " \
181
- "prefer collaborative, safe spaces. You can read more about the code of conduct at " \
182
- "contributor-covenant.org. Having a code of conduct means agreeing to the responsibility " \
183
- "of enforcing it, so be sure that you are prepared to do that. Be sure that your email " \
184
- "address is specified as a contact in the generated code of conduct so that people know " \
185
- "who to contact in case of a violation. For suggestions about " \
186
- "how to enforce codes of conduct, see https://bit.ly/coc-enforcement.")
181
+ "prefer safe, respectful, productive, and collaborative spaces. \n" \
182
+ "See https://github.com/ruby/rubygems/blob/master/CODE_OF_CONDUCT.md")
187
183
  config[:coc] = true
188
184
  Bundler.ui.info "Code of conduct enabled in config"
189
185
  templates.merge!("CODE_OF_CONDUCT.md.tt" => "CODE_OF_CONDUCT.md")
@@ -237,6 +233,18 @@ module Bundler
237
233
  )
238
234
  end
239
235
 
236
+ if extension == "go"
237
+ templates.merge!(
238
+ "ext/newgem/go.mod.tt" => "ext/#{name}/go.mod",
239
+ "ext/newgem/extconf-go.rb.tt" => "ext/#{name}/extconf.rb",
240
+ "ext/newgem/newgem.h.tt" => "ext/#{name}/#{underscored_name}.h",
241
+ "ext/newgem/newgem.go.tt" => "ext/#{name}/#{underscored_name}.go",
242
+ "ext/newgem/newgem-go.c.tt" => "ext/#{name}/#{underscored_name}.c",
243
+ )
244
+
245
+ config[:go_module_username] = config[:github_username] == DEFAULT_GITHUB_USERNAME ? "username" : config[:github_username]
246
+ end
247
+
240
248
  if target.exist? && !target.directory?
241
249
  Bundler.ui.error "Couldn't create a new gem named `#{gem_name}` because there's an existing file named `#{gem_name}`."
242
250
  exit Bundler::BundlerError.all_errors[Bundler::GenericSystemCallError]
@@ -282,7 +290,7 @@ module Bundler
282
290
  private
283
291
 
284
292
  def resolve_name(name)
285
- SharedHelpers.pwd.join(name).basename.to_s
293
+ Pathname.new(SharedHelpers.pwd).join(name).basename.to_s
286
294
  end
287
295
 
288
296
  def ask_and_set(key, prompt, explanation)
@@ -382,7 +390,6 @@ module Bundler
382
390
  def ask_and_set_linter
383
391
  return if skip?(:linter)
384
392
  linter_template = options[:linter] || Bundler.settings["gem.linter"]
385
- linter_template = deprecated_rubocop_option if linter_template.nil?
386
393
 
387
394
  if linter_template.to_s.empty?
388
395
  Bundler.ui.info "\nDo you want to add a code linter and formatter to your gem? " \
@@ -415,27 +422,6 @@ module Bundler
415
422
  linter_template
416
423
  end
417
424
 
418
- def deprecated_rubocop_option
419
- if !options[:rubocop].nil?
420
- if options[:rubocop]
421
- Bundler::SharedHelpers.major_deprecation 2,
422
- "--rubocop is deprecated, use --linter=rubocop",
423
- removed_message: "--rubocop has been removed, use --linter=rubocop"
424
- "rubocop"
425
- else
426
- Bundler::SharedHelpers.major_deprecation 2,
427
- "--no-rubocop is deprecated, use --linter",
428
- removed_message: "--no-rubocop has been removed, use --linter"
429
- false
430
- end
431
- elsif !Bundler.settings["gem.rubocop"].nil?
432
- Bundler::SharedHelpers.major_deprecation 2,
433
- "config gem.rubocop is deprecated; we've updated your config to use gem.linter instead",
434
- removed_message: "config gem.rubocop has been removed; we've updated your config to use gem.linter instead"
435
- Bundler.settings["gem.rubocop"] ? "rubocop" : false
436
- end
437
- end
438
-
439
425
  def bundler_dependency_version
440
426
  v = Gem::Version.new(Bundler::VERSION)
441
427
  req = v.segments[0..1]
@@ -20,49 +20,25 @@ module Bundler
20
20
 
21
21
  Bundler::SharedHelpers.set_env "RB_USER_INSTALL", "1" if Gem.freebsd_platform?
22
22
 
23
- # Disable color in deployment mode
24
- Bundler.ui.shell = Thor::Shell::Basic.new if options[:deployment]
25
-
26
23
  if target_rbconfig_path = options[:"target-rbconfig"]
27
24
  Bundler.rubygems.set_target_rbconfig(target_rbconfig_path)
28
25
  end
29
26
 
30
- check_for_options_conflicts
31
-
32
27
  check_trust_policy
33
28
 
34
- if options[:deployment] || options[:frozen] || Bundler.frozen_bundle?
35
- unless Bundler.default_lockfile.exist?
36
- flag = "--deployment flag" if options[:deployment]
37
- flag ||= "--frozen flag" if options[:frozen]
38
- flag ||= "deployment setting" if Bundler.settings[:deployment]
39
- flag ||= "frozen setting" if Bundler.settings[:frozen]
40
- raise ProductionError, "The #{flag} requires a lockfile. Please make " \
41
- "sure you have checked your #{SharedHelpers.relative_lockfile_path} into version control " \
42
- "before deploying."
43
- end
44
-
45
- Bundler.settings.set_command_option :deployment, true if options[:deployment]
46
- Bundler.settings.set_command_option :frozen, true if options[:frozen]
47
- end
48
-
49
- # When install is called with --no-deployment, disable deployment mode
50
- if options[:deployment] == false
51
- Bundler.settings.set_command_option :frozen, nil
52
- options[:system] = true
29
+ if Bundler.frozen_bundle? && !Bundler.default_lockfile.exist?
30
+ flag = "deployment setting" if Bundler.settings[:deployment]
31
+ flag = "frozen setting" if Bundler.settings[:frozen]
32
+ raise ProductionError, "The #{flag} requires a lockfile. Please make " \
33
+ "sure you have checked your #{SharedHelpers.relative_lockfile_path} into version control " \
34
+ "before deploying."
53
35
  end
54
36
 
55
37
  normalize_settings
56
38
 
57
39
  Bundler::Fetcher.disable_endpoint = options["full-index"]
58
40
 
59
- if options["binstubs"]
60
- Bundler::SharedHelpers.major_deprecation 2,
61
- "The --binstubs option will be removed in favor of `bundle binstubs --all`",
62
- removed_message: "The --binstubs option have been removed in favor of `bundle binstubs --all`"
63
- end
64
-
65
- Plugin.gemfile_install(Bundler.default_gemfile) if Bundler.feature_flag.plugins?
41
+ Plugin.gemfile_install(Bundler.default_gemfile) if Bundler.settings[:plugins]
66
42
 
67
43
  # For install we want to enable strict validation
68
44
  # (rather than some optimizations we perform at app runtime).
@@ -87,8 +63,6 @@ module Bundler
87
63
 
88
64
  Bundler::CLI::Common.output_post_install_messages installer.post_install_messages
89
65
 
90
- warn_ambiguous_gems
91
-
92
66
  if CLI::Common.clean_after_install?
93
67
  require_relative "clean"
94
68
  Bundler::CLI::Clean.new(options).run
@@ -118,22 +92,6 @@ module Bundler
118
92
  "#{count} #{count == 1 ? "gem" : "gems"} now installed"
119
93
  end
120
94
 
121
- def check_for_group_conflicts_in_cli_options
122
- conflicting_groups = Array(options[:without]) & Array(options[:with])
123
- return if conflicting_groups.empty?
124
- raise InvalidOption, "You can't list a group in both with and without." \
125
- " The offending groups are: #{conflicting_groups.join(", ")}."
126
- end
127
-
128
- def check_for_options_conflicts
129
- if (options[:path] || options[:deployment]) && options[:system]
130
- error_message = String.new
131
- error_message << "You have specified both --path as well as --system. Please choose only one option.\n" if options[:path]
132
- error_message << "You have specified both --deployment as well as --system. Please choose only one option.\n" if options[:deployment]
133
- raise InvalidOption.new(error_message)
134
- end
135
- end
136
-
137
95
  def check_trust_policy
138
96
  trust_policy = options["trust-policy"]
139
97
  unless Bundler.rubygems.security_policies.keys.unshift(nil).include?(trust_policy)
@@ -143,28 +101,11 @@ module Bundler
143
101
  Bundler.settings.set_command_option_if_given :"trust-policy", trust_policy
144
102
  end
145
103
 
146
- def normalize_groups
147
- check_for_group_conflicts_in_cli_options
148
-
149
- # need to nil them out first to get around validation for backwards compatibility
150
- Bundler.settings.set_command_option :without, nil
151
- Bundler.settings.set_command_option :with, nil
152
- Bundler.settings.set_command_option :without, options[:without]
153
- Bundler.settings.set_command_option :with, options[:with]
154
- end
155
-
156
104
  def normalize_settings
157
- Bundler.settings.set_command_option :path, nil if options[:system]
158
- Bundler.settings.set_command_option_if_given :path, options[:path]
159
-
160
105
  if options["standalone"] && Bundler.settings[:path].nil? && !options["local"]
161
106
  Bundler.settings.set_command_option :path, "bundle"
162
107
  end
163
108
 
164
- bin_option = options["binstubs"]
165
- bin_option = nil if bin_option&.empty?
166
- Bundler.settings.set_command_option :bin, bin_option if options["binstubs"]
167
-
168
109
  Bundler.settings.set_command_option_if_given :shebang, options["shebang"]
169
110
 
170
111
  Bundler.settings.set_command_option_if_given :jobs, options["jobs"]
@@ -175,23 +116,7 @@ module Bundler
175
116
 
176
117
  Bundler.settings.set_command_option_if_given :clean, options["clean"]
177
118
 
178
- normalize_groups if options[:without] || options[:with]
179
-
180
119
  options[:force] = options[:redownload] if options[:redownload]
181
120
  end
182
-
183
- def warn_ambiguous_gems
184
- # TODO: remove this when we drop Bundler 1.x support
185
- Installer.ambiguous_gems.to_a.each do |name, installed_from_uri, *also_found_in_uris|
186
- Bundler.ui.warn "Warning: the gem '#{name}' was found in multiple sources."
187
- Bundler.ui.warn "Installed from: #{installed_from_uri}"
188
- Bundler.ui.warn "Also found in:"
189
- also_found_in_uris.each {|uri| Bundler.ui.warn " * #{uri}" }
190
- Bundler.ui.warn "You should add a source requirement to restrict this gem to your preferred source."
191
- Bundler.ui.warn "For example:"
192
- Bundler.ui.warn " gem '#{name}', :source => '#{installed_from_uri}'"
193
- Bundler.ui.warn "Then uninstall the gem '#{name}' (or delete all bundled gems) and then install again."
194
- end
195
- end
196
121
  end
197
122
  end
@@ -10,7 +10,7 @@ module Bundler
10
10
  be sure to check out these resources:
11
11
 
12
12
  1. Check out our troubleshooting guide for quick fixes to common issues:
13
- https://github.com/rubygems/rubygems/blob/master/doc/bundler/TROUBLESHOOTING.md
13
+ https://github.com/ruby/rubygems/blob/master/doc/bundler/TROUBLESHOOTING.md
14
14
 
15
15
  2. Instructions for common Bundler uses can be found on the documentation
16
16
  site: https://bundler.io/
@@ -22,7 +22,7 @@ module Bundler
22
22
  still aren't working the way you expect them to, please let us know so
23
23
  that we can diagnose and help fix the problem you're having, by filling
24
24
  in the new issue form located at
25
- https://github.com/rubygems/rubygems/issues/new?labels=Bundler&template=bundler-related-issue.md,
25
+ https://github.com/ruby/rubygems/issues/new?labels=Bundler&template=bundler-related-issue.md,
26
26
  and copy and pasting the information below.
27
27
 
28
28
  EOS
@@ -1,11 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "json"
4
+
3
5
  module Bundler
4
6
  class CLI::List
5
7
  def initialize(options)
6
8
  @options = options
7
9
  @without_group = options["without-group"].map(&:to_sym)
8
10
  @only_group = options["only-group"].map(&:to_sym)
11
+ @format = options["format"]
9
12
  end
10
13
 
11
14
  def run
@@ -25,6 +28,36 @@ module Bundler
25
28
  end
26
29
  end.reject {|s| s.name == "bundler" }.sort_by(&:name)
27
30
 
31
+ case @format
32
+ when "json"
33
+ print_json(specs: specs)
34
+ when nil
35
+ print_human(specs: specs)
36
+ else
37
+ raise InvalidOption, "Unknown option`--format=#{@format}`. Supported formats: `json`"
38
+ end
39
+ end
40
+
41
+ private
42
+
43
+ def print_json(specs:)
44
+ gems = if @options["name-only"]
45
+ specs.map {|s| { name: s.name } }
46
+ else
47
+ specs.map do |s|
48
+ {
49
+ name: s.name,
50
+ version: s.version.to_s,
51
+ git_version: s.git_version&.strip,
52
+ }.tap do |h|
53
+ h[:path] = s.full_gem_path if @options["paths"]
54
+ end
55
+ end
56
+ end
57
+ Bundler.ui.info({ gems: gems }.to_json)
58
+ end
59
+
60
+ def print_human(specs:)
28
61
  return Bundler.ui.info "No gems in the Gemfile" if specs.empty?
29
62
 
30
63
  return specs.each {|s| Bundler.ui.info s.name } if @options["name-only"]
@@ -37,8 +70,6 @@ module Bundler
37
70
  Bundler.ui.info "Use `bundle info` to print more detailed information about a gem"
38
71
  end
39
72
 
40
- private
41
-
42
73
  def verify_group_exists(groups)
43
74
  (@without_group + @only_group).each do |group|
44
75
  raise InvalidOption, "`#{group}` group could not be found." unless groups.include?(group)
@@ -10,11 +10,15 @@ module Bundler
10
10
  method_option "source", type: :string, default: nil, banner: "URL of the RubyGems source to fetch the plugin from"
11
11
  method_option "version", type: :string, default: nil, banner: "The version of the plugin to fetch"
12
12
  method_option "git", type: :string, default: nil, banner: "URL of the git repo to fetch from"
13
- method_option "local_git", type: :string, default: nil, banner: "Path of the local git repo to fetch from (deprecated)"
13
+ method_option "local_git", type: :string, default: nil, banner: "Path of the local git repo to fetch from (removed)"
14
14
  method_option "branch", type: :string, default: nil, banner: "The git branch to checkout"
15
15
  method_option "ref", type: :string, default: nil, banner: "The git revision to check out"
16
16
  method_option "path", type: :string, default: nil, banner: "Path of a local gem to directly use"
17
17
  def install(*plugins)
18
+ if options.key?(:local_git)
19
+ raise InvalidOption, "--local_git has been removed, use --git"
20
+ end
21
+
18
22
  Bundler::Plugin.install(plugins, options)
19
23
  end
20
24
 
@@ -6,7 +6,7 @@ module Bundler
6
6
  def initialize(options, gem_name)
7
7
  @options = options
8
8
  @gem_name = gem_name
9
- @verbose = options[:verbose] || options[:outdated]
9
+ @verbose = options[:verbose]
10
10
  @latest_specs = fetch_latest_specs if @verbose
11
11
  end
12
12
 
@@ -15,7 +15,7 @@ module Bundler
15
15
 
16
16
  Bundler.self_manager.update_bundler_and_restart_with_it_if_needed(update_bundler) if update_bundler
17
17
 
18
- Plugin.gemfile_install(Bundler.default_gemfile) if Bundler.feature_flag.plugins?
18
+ Plugin.gemfile_install(Bundler.default_gemfile) if Bundler.settings[:plugins]
19
19
 
20
20
  sources = Array(options[:source])
21
21
  groups = Array(options[:group]).map(&:to_sym)
@@ -23,10 +23,10 @@ module Bundler
23
23
  full_update = gems.empty? && sources.empty? && groups.empty? && !options[:ruby] && !update_bundler
24
24
 
25
25
  if full_update && !options[:all]
26
- if Bundler.feature_flag.update_requires_all_flag?
26
+ if Bundler.settings[:update_requires_all_flag]
27
27
  raise InvalidOption, "To update everything, pass the `--all` flag."
28
28
  end
29
- SharedHelpers.major_deprecation 4, "Pass --all to `bundle update` to update everything"
29
+ SharedHelpers.feature_deprecated! "Pass --all to `bundle update` to update everything"
30
30
  elsif !full_update && options[:all]
31
31
  raise InvalidOption, "Cannot specify --all along with specific options."
32
32
  end