bundler 2.7.1 → 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 (144) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +1001 -902
  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/checksum.rb +6 -0
  8. data/lib/bundler/cli/cache.rb +1 -12
  9. data/lib/bundler/cli/common.rb +21 -4
  10. data/lib/bundler/cli/config.rb +1 -2
  11. data/lib/bundler/cli/console.rb +5 -0
  12. data/lib/bundler/cli/exec.rb +29 -4
  13. data/lib/bundler/cli/gem.rb +19 -33
  14. data/lib/bundler/cli/install.rb +7 -84
  15. data/lib/bundler/cli/issue.rb +2 -2
  16. data/lib/bundler/cli/list.rb +33 -2
  17. data/lib/bundler/cli/lock.rb +5 -5
  18. data/lib/bundler/cli/plugin.rb +5 -1
  19. data/lib/bundler/cli/show.rb +3 -7
  20. data/lib/bundler/cli/update.rb +3 -3
  21. data/lib/bundler/cli.rb +97 -95
  22. data/lib/bundler/compact_index_client.rb +0 -1
  23. data/lib/bundler/current_ruby.rb +3 -15
  24. data/lib/bundler/definition.rb +122 -95
  25. data/lib/bundler/deployment.rb +1 -64
  26. data/lib/bundler/digest.rb +1 -1
  27. data/lib/bundler/dsl.rb +14 -36
  28. data/lib/bundler/endpoint_specification.rb +0 -22
  29. data/lib/bundler/errors.rb +1 -5
  30. data/lib/bundler/feature_flag.rb +0 -33
  31. data/lib/bundler/fetcher/compact_index.rb +1 -1
  32. data/lib/bundler/friendly_errors.rb +2 -2
  33. data/lib/bundler/index.rb +0 -7
  34. data/lib/bundler/inline.rb +1 -1
  35. data/lib/bundler/installer/gem_installer.rb +0 -11
  36. data/lib/bundler/installer.rb +0 -6
  37. data/lib/bundler/lockfile_generator.rb +1 -1
  38. data/lib/bundler/lockfile_parser.rb +2 -12
  39. data/lib/bundler/man/bundle-add.1 +1 -1
  40. data/lib/bundler/man/bundle-binstubs.1 +3 -6
  41. data/lib/bundler/man/bundle-binstubs.1.ronn +4 -6
  42. data/lib/bundler/man/bundle-cache.1 +2 -14
  43. data/lib/bundler/man/bundle-cache.1.ronn +1 -14
  44. data/lib/bundler/man/bundle-check.1 +2 -5
  45. data/lib/bundler/man/bundle-check.1.ronn +0 -5
  46. data/lib/bundler/man/bundle-clean.1 +1 -1
  47. data/lib/bundler/man/bundle-config.1 +36 -46
  48. data/lib/bundler/man/bundle-config.1.ronn +69 -75
  49. data/lib/bundler/man/bundle-console.1 +1 -1
  50. data/lib/bundler/man/bundle-doctor.1 +4 -4
  51. data/lib/bundler/man/bundle-doctor.1.ronn +4 -4
  52. data/lib/bundler/man/bundle-env.1 +1 -1
  53. data/lib/bundler/man/bundle-exec.1 +2 -5
  54. data/lib/bundler/man/bundle-exec.1.ronn +1 -5
  55. data/lib/bundler/man/bundle-fund.1 +1 -1
  56. data/lib/bundler/man/bundle-gem.1 +3 -6
  57. data/lib/bundler/man/bundle-gem.1.ronn +2 -5
  58. data/lib/bundler/man/bundle-help.1 +1 -1
  59. data/lib/bundler/man/bundle-info.1 +1 -1
  60. data/lib/bundler/man/bundle-init.1 +1 -1
  61. data/lib/bundler/man/bundle-install.1 +8 -59
  62. data/lib/bundler/man/bundle-install.1.ronn +12 -107
  63. data/lib/bundler/man/bundle-issue.1 +1 -1
  64. data/lib/bundler/man/bundle-licenses.1 +1 -1
  65. data/lib/bundler/man/bundle-list.1 +6 -1
  66. data/lib/bundler/man/bundle-list.1.ronn +5 -0
  67. data/lib/bundler/man/bundle-lock.1 +1 -1
  68. data/lib/bundler/man/bundle-open.1 +1 -1
  69. data/lib/bundler/man/bundle-outdated.1 +1 -1
  70. data/lib/bundler/man/bundle-platform.1 +1 -1
  71. data/lib/bundler/man/bundle-plugin.1 +33 -15
  72. data/lib/bundler/man/bundle-plugin.1.ronn +36 -15
  73. data/lib/bundler/man/bundle-pristine.1 +1 -1
  74. data/lib/bundler/man/bundle-remove.1 +2 -8
  75. data/lib/bundler/man/bundle-remove.1.ronn +1 -8
  76. data/lib/bundler/man/bundle-show.1 +2 -5
  77. data/lib/bundler/man/bundle-show.1.ronn +0 -4
  78. data/lib/bundler/man/bundle-update.1 +1 -1
  79. data/lib/bundler/man/bundle-version.1 +1 -1
  80. data/lib/bundler/man/bundle.1 +1 -10
  81. data/lib/bundler/man/bundle.1.ronn +0 -9
  82. data/lib/bundler/man/gemfile.5 +1 -1
  83. data/lib/bundler/man/index.txt +0 -2
  84. data/lib/bundler/materialization.rb +1 -1
  85. data/lib/bundler/plugin/installer.rb +0 -10
  86. data/lib/bundler/plugin/source_list.rb +1 -1
  87. data/lib/bundler/plugin.rb +1 -1
  88. data/lib/bundler/resolver/package.rb +1 -0
  89. data/lib/bundler/resolver.rb +1 -1
  90. data/lib/bundler/ruby_dsl.rb +2 -0
  91. data/lib/bundler/ruby_version.rb +1 -3
  92. data/lib/bundler/rubygems_ext.rb +1 -1
  93. data/lib/bundler/rubygems_gem_installer.rb +1 -1
  94. data/lib/bundler/rubygems_integration.rb +1 -5
  95. data/lib/bundler/self_manager.rb +1 -1
  96. data/lib/bundler/settings.rb +8 -27
  97. data/lib/bundler/shared_helpers.rb +8 -20
  98. data/lib/bundler/source/gemspec.rb +4 -0
  99. data/lib/bundler/source/git/git_proxy.rb +3 -11
  100. data/lib/bundler/source/git.rb +2 -3
  101. data/lib/bundler/source/path.rb +5 -7
  102. data/lib/bundler/source/rubygems.rb +11 -17
  103. data/lib/bundler/source.rb +1 -1
  104. data/lib/bundler/source_list.rb +4 -45
  105. data/lib/bundler/source_map.rb +2 -5
  106. data/lib/bundler/spec_set.rb +6 -15
  107. data/lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt +7 -129
  108. data/lib/bundler/templates/newgem/circleci/config.yml.tt +12 -0
  109. data/lib/bundler/templates/newgem/ext/newgem/Cargo.toml.tt +1 -1
  110. data/lib/bundler/templates/newgem/ext/newgem/extconf-go.rb.tt +11 -0
  111. data/lib/bundler/templates/newgem/ext/newgem/go.mod.tt +5 -0
  112. data/lib/bundler/templates/newgem/ext/newgem/newgem-go.c.tt +2 -0
  113. data/lib/bundler/templates/newgem/ext/newgem/newgem.go.tt +31 -0
  114. data/lib/bundler/templates/newgem/github/workflows/main.yml.tt +6 -0
  115. data/lib/bundler/templates/newgem/gitlab-ci.yml.tt +9 -0
  116. data/lib/bundler/templates/newgem/newgem.gemspec.tt +7 -4
  117. data/lib/bundler/vendor/connection_pool/lib/connection_pool/timed_stack.rb +26 -23
  118. data/lib/bundler/vendor/connection_pool/lib/connection_pool/version.rb +1 -1
  119. data/lib/bundler/vendor/connection_pool/lib/connection_pool.rb +50 -6
  120. data/lib/bundler/vendor/fileutils/lib/fileutils.rb +57 -52
  121. data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +5 -2
  122. data/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +42 -6
  123. data/lib/bundler/vendor/thor/lib/thor/parser/options.rb +1 -1
  124. data/lib/bundler/vendor/thor/lib/thor/runner.rb +2 -2
  125. data/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +3 -7
  126. data/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
  127. data/lib/bundler/vendor/uri/lib/uri/common.rb +57 -15
  128. data/lib/bundler/vendor/uri/lib/uri/file.rb +1 -1
  129. data/lib/bundler/vendor/uri/lib/uri/generic.rb +34 -21
  130. data/lib/bundler/vendor/uri/lib/uri/http.rb +12 -0
  131. data/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb +9 -8
  132. data/lib/bundler/vendor/uri/lib/uri/version.rb +2 -2
  133. data/lib/bundler/version.rb +1 -1
  134. data/lib/bundler/vlad.rb +1 -14
  135. data/lib/bundler.rb +6 -28
  136. metadata +9 -13
  137. data/lib/bundler/cli/inject.rb +0 -60
  138. data/lib/bundler/cli/viz.rb +0 -31
  139. data/lib/bundler/graph.rb +0 -152
  140. data/lib/bundler/man/bundle-inject.1 +0 -31
  141. data/lib/bundler/man/bundle-inject.1.ronn +0 -32
  142. data/lib/bundler/man/bundle-viz.1 +0 -30
  143. data/lib/bundler/man/bundle-viz.1.ronn +0 -36
  144. 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-07-21".freeze
8
- @git_commit_sha = "bd22001d8c7".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"
@@ -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
@@ -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.bundler_4_mode? && 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] 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,51 +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
- options[:local] = true if Bundler.app_cache.exist?
46
-
47
- Bundler.settings.set_command_option :deployment, true if options[:deployment]
48
- Bundler.settings.set_command_option :frozen, true if options[:frozen]
49
- end
50
-
51
- # When install is called with --no-deployment, disable deployment mode
52
- if options[:deployment] == false
53
- Bundler.settings.set_command_option :frozen, nil
54
- 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."
55
35
  end
56
36
 
57
37
  normalize_settings
58
38
 
59
39
  Bundler::Fetcher.disable_endpoint = options["full-index"]
60
40
 
61
- if options["binstubs"]
62
- Bundler::SharedHelpers.major_deprecation 2,
63
- "The --binstubs option will be removed in favor of `bundle binstubs --all`",
64
- removed_message: "The --binstubs option have been removed in favor of `bundle binstubs --all`"
65
- end
66
-
67
- Plugin.gemfile_install(Bundler.default_gemfile) if Bundler.feature_flag.plugins?
41
+ Plugin.gemfile_install(Bundler.default_gemfile) if Bundler.settings[:plugins]
68
42
 
69
43
  # For install we want to enable strict validation
70
44
  # (rather than some optimizations we perform at app runtime).
@@ -89,8 +63,6 @@ module Bundler
89
63
 
90
64
  Bundler::CLI::Common.output_post_install_messages installer.post_install_messages
91
65
 
92
- warn_ambiguous_gems
93
-
94
66
  if CLI::Common.clean_after_install?
95
67
  require_relative "clean"
96
68
  Bundler::CLI::Clean.new(options).run
@@ -120,22 +92,6 @@ module Bundler
120
92
  "#{count} #{count == 1 ? "gem" : "gems"} now installed"
121
93
  end
122
94
 
123
- def check_for_group_conflicts_in_cli_options
124
- conflicting_groups = Array(options[:without]) & Array(options[:with])
125
- return if conflicting_groups.empty?
126
- raise InvalidOption, "You can't list a group in both with and without." \
127
- " The offending groups are: #{conflicting_groups.join(", ")}."
128
- end
129
-
130
- def check_for_options_conflicts
131
- if (options[:path] || options[:deployment]) && options[:system]
132
- error_message = String.new
133
- error_message << "You have specified both --path as well as --system. Please choose only one option.\n" if options[:path]
134
- error_message << "You have specified both --deployment as well as --system. Please choose only one option.\n" if options[:deployment]
135
- raise InvalidOption.new(error_message)
136
- end
137
- end
138
-
139
95
  def check_trust_policy
140
96
  trust_policy = options["trust-policy"]
141
97
  unless Bundler.rubygems.security_policies.keys.unshift(nil).include?(trust_policy)
@@ -145,28 +101,11 @@ module Bundler
145
101
  Bundler.settings.set_command_option_if_given :"trust-policy", trust_policy
146
102
  end
147
103
 
148
- def normalize_groups
149
- check_for_group_conflicts_in_cli_options
150
-
151
- # need to nil them out first to get around validation for backwards compatibility
152
- Bundler.settings.set_command_option :without, nil
153
- Bundler.settings.set_command_option :with, nil
154
- Bundler.settings.set_command_option :without, options[:without]
155
- Bundler.settings.set_command_option :with, options[:with]
156
- end
157
-
158
104
  def normalize_settings
159
- Bundler.settings.set_command_option :path, nil if options[:system]
160
- Bundler.settings.set_command_option_if_given :path, options[:path]
161
-
162
105
  if options["standalone"] && Bundler.settings[:path].nil? && !options["local"]
163
106
  Bundler.settings.set_command_option :path, "bundle"
164
107
  end
165
108
 
166
- bin_option = options["binstubs"]
167
- bin_option = nil if bin_option&.empty?
168
- Bundler.settings.set_command_option :bin, bin_option if options["binstubs"]
169
-
170
109
  Bundler.settings.set_command_option_if_given :shebang, options["shebang"]
171
110
 
172
111
  Bundler.settings.set_command_option_if_given :jobs, options["jobs"]
@@ -177,23 +116,7 @@ module Bundler
177
116
 
178
117
  Bundler.settings.set_command_option_if_given :clean, options["clean"]
179
118
 
180
- normalize_groups if options[:without] || options[:with]
181
-
182
119
  options[:force] = options[:redownload] if options[:redownload]
183
120
  end
184
-
185
- def warn_ambiguous_gems
186
- # TODO: remove this when we drop Bundler 1.x support
187
- Installer.ambiguous_gems.to_a.each do |name, installed_from_uri, *also_found_in_uris|
188
- Bundler.ui.warn "Warning: the gem '#{name}' was found in multiple sources."
189
- Bundler.ui.warn "Installed from: #{installed_from_uri}"
190
- Bundler.ui.warn "Also found in:"
191
- also_found_in_uris.each {|uri| Bundler.ui.warn " * #{uri}" }
192
- Bundler.ui.warn "You should add a source requirement to restrict this gem to your preferred source."
193
- Bundler.ui.warn "For example:"
194
- Bundler.ui.warn " gem '#{name}', :source => '#{installed_from_uri}'"
195
- Bundler.ui.warn "Then uninstall the gem '#{name}' (or delete all bundled gems) and then install again."
196
- end
197
- end
198
121
  end
199
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)
@@ -35,11 +35,8 @@ module Bundler
35
35
  update = { bundler: bundler }
36
36
  end
37
37
 
38
- file = options[:lockfile]
39
- file = file ? Pathname.new(file).expand_path : Bundler.default_lockfile
40
-
41
38
  Bundler.settings.temporary(frozen: false) do
42
- definition = Bundler.definition(update, file)
39
+ definition = Bundler.definition(update, Bundler.default_lockfile)
43
40
  definition.add_checksums if options["add-checksums"]
44
41
 
45
42
  Bundler::CLI::Common.configure_gem_version_promoter(definition, options) if options[:update]
@@ -71,8 +68,11 @@ module Bundler
71
68
  if print
72
69
  puts definition.to_lock
73
70
  else
71
+ file = options[:lockfile]
72
+ file = file ? Pathname.new(file).expand_path : Bundler.default_lockfile
73
+
74
74
  puts "Writing lockfile to #{file}"
75
- definition.lock
75
+ definition.write_lock(file, false)
76
76
  end
77
77
  end
78
78
 
@@ -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
 
@@ -57,12 +57,8 @@ module Bundler
57
57
 
58
58
  def fetch_latest_specs
59
59
  definition = Bundler.definition(true)
60
- if options[:outdated]
61
- Bundler.ui.info "Fetching remote specs for outdated check...\n\n"
62
- Bundler.ui.silence { definition.remotely! }
63
- else
64
- definition.with_cache!
65
- end
60
+ Bundler.ui.info "Fetching remote specs for outdated check...\n\n"
61
+ Bundler.ui.silence { definition.remotely! }
66
62
  Bundler.reset!
67
63
  definition.specs
68
64
  end