bundler 2.4.21 → 2.5.0

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 (183) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +74 -0
  3. data/README.md +1 -2
  4. data/bundler.gemspec +4 -2
  5. data/exe/bundle +1 -10
  6. data/lib/bundler/build_metadata.rb +3 -3
  7. data/lib/bundler/capistrano.rb +1 -1
  8. data/lib/bundler/checksum.rb +245 -0
  9. data/lib/bundler/ci_detector.rb +75 -0
  10. data/lib/bundler/cli/add.rb +3 -3
  11. data/lib/bundler/cli/binstubs.rb +4 -4
  12. data/lib/bundler/cli/cache.rb +1 -1
  13. data/lib/bundler/cli/check.rb +1 -1
  14. data/lib/bundler/cli/common.rb +9 -1
  15. data/lib/bundler/cli/config.rb +8 -7
  16. data/lib/bundler/cli/console.rb +3 -2
  17. data/lib/bundler/cli/doctor.rb +2 -2
  18. data/lib/bundler/cli/exec.rb +1 -1
  19. data/lib/bundler/cli/gem.rb +31 -23
  20. data/lib/bundler/cli/info.rb +2 -13
  21. data/lib/bundler/cli/install.rb +5 -4
  22. data/lib/bundler/cli/issue.rb +1 -1
  23. data/lib/bundler/cli/lock.rb +4 -4
  24. data/lib/bundler/cli/open.rb +1 -1
  25. data/lib/bundler/cli/outdated.rb +6 -6
  26. data/lib/bundler/cli/plugin.rb +7 -14
  27. data/lib/bundler/cli/pristine.rb +38 -30
  28. data/lib/bundler/cli/show.rb +2 -2
  29. data/lib/bundler/cli/update.rb +5 -5
  30. data/lib/bundler/cli.rb +215 -263
  31. data/lib/bundler/compact_index_client/cache.rb +29 -9
  32. data/lib/bundler/compact_index_client/cache_file.rb +153 -0
  33. data/lib/bundler/compact_index_client/gem_parser.rb +7 -3
  34. data/lib/bundler/compact_index_client/updater.rb +79 -81
  35. data/lib/bundler/compact_index_client.rb +14 -7
  36. data/lib/bundler/constants.rb +1 -1
  37. data/lib/bundler/current_ruby.rb +5 -21
  38. data/lib/bundler/definition.rb +43 -16
  39. data/lib/bundler/dependency.rb +16 -12
  40. data/lib/bundler/digest.rb +2 -2
  41. data/lib/bundler/dsl.rb +43 -25
  42. data/lib/bundler/endpoint_specification.rb +6 -2
  43. data/lib/bundler/env.rb +1 -3
  44. data/lib/bundler/errors.rb +58 -0
  45. data/lib/bundler/fetcher/base.rb +3 -1
  46. data/lib/bundler/fetcher/compact_index.rb +4 -4
  47. data/lib/bundler/fetcher/downloader.rb +13 -11
  48. data/lib/bundler/fetcher/gem_remote_fetcher.rb +16 -0
  49. data/lib/bundler/fetcher/index.rb +1 -1
  50. data/lib/bundler/fetcher.rb +28 -25
  51. data/lib/bundler/friendly_errors.rb +5 -5
  52. data/lib/bundler/gem_helper.rb +1 -1
  53. data/lib/bundler/gem_helpers.rb +12 -2
  54. data/lib/bundler/graph.rb +9 -9
  55. data/lib/bundler/index.rb +1 -2
  56. data/lib/bundler/injector.rb +1 -1
  57. data/lib/bundler/inline.rb +3 -3
  58. data/lib/bundler/installer/gem_installer.rb +10 -10
  59. data/lib/bundler/installer/parallel_installer.rb +16 -8
  60. data/lib/bundler/installer/standalone.rb +2 -3
  61. data/lib/bundler/installer.rb +9 -9
  62. data/lib/bundler/lazy_specification.rb +28 -17
  63. data/lib/bundler/lockfile_generator.rb +9 -0
  64. data/lib/bundler/lockfile_parser.rb +81 -10
  65. data/lib/bundler/man/bundle-add.1 +3 -26
  66. data/lib/bundler/man/bundle-binstubs.1 +4 -16
  67. data/lib/bundler/man/bundle-cache.1 +3 -24
  68. data/lib/bundler/man/bundle-check.1 +3 -12
  69. data/lib/bundler/man/bundle-clean.1 +3 -10
  70. data/lib/bundler/man/bundle-config.1 +20 -211
  71. data/lib/bundler/man/bundle-config.1.ronn +6 -0
  72. data/lib/bundler/man/bundle-console.1 +4 -22
  73. data/lib/bundler/man/bundle-doctor.1 +4 -18
  74. data/lib/bundler/man/bundle-exec.1 +12 -73
  75. data/lib/bundler/man/bundle-gem.1 +13 -49
  76. data/lib/bundler/man/bundle-help.1 +3 -7
  77. data/lib/bundler/man/bundle-info.1 +3 -9
  78. data/lib/bundler/man/bundle-init.1 +3 -12
  79. data/lib/bundler/man/bundle-inject.1 +6 -19
  80. data/lib/bundler/man/bundle-install.1 +27 -125
  81. data/lib/bundler/man/bundle-install.1.ronn +1 -0
  82. data/lib/bundler/man/bundle-list.1 +4 -19
  83. data/lib/bundler/man/bundle-lock.1 +5 -29
  84. data/lib/bundler/man/bundle-open.1 +7 -27
  85. data/lib/bundler/man/bundle-outdated.1 +3 -55
  86. data/lib/bundler/man/bundle-outdated.1.ronn +1 -0
  87. data/lib/bundler/man/bundle-platform.1 +5 -27
  88. data/lib/bundler/man/bundle-plugin.1 +3 -29
  89. data/lib/bundler/man/bundle-pristine.1 +5 -16
  90. data/lib/bundler/man/bundle-remove.1 +4 -14
  91. data/lib/bundler/man/bundle-show.1 +3 -10
  92. data/lib/bundler/man/bundle-update.1 +18 -137
  93. data/lib/bundler/man/bundle-version.1 +3 -16
  94. data/lib/bundler/man/bundle-viz.1 +4 -16
  95. data/lib/bundler/man/bundle.1 +5 -44
  96. data/lib/bundler/man/gemfile.5 +24 -301
  97. data/lib/bundler/man/gemfile.5.ronn +4 -0
  98. data/lib/bundler/match_metadata.rb +4 -0
  99. data/lib/bundler/match_platform.rb +1 -1
  100. data/lib/bundler/plugin/api/source.rb +3 -2
  101. data/lib/bundler/plugin/index.rb +8 -0
  102. data/lib/bundler/plugin/installer.rb +1 -1
  103. data/lib/bundler/plugin.rb +12 -5
  104. data/lib/bundler/resolver/base.rb +1 -1
  105. data/lib/bundler/resolver/incompatibility.rb +1 -1
  106. data/lib/bundler/resolver/spec_group.rb +1 -4
  107. data/lib/bundler/resolver.rb +16 -16
  108. data/lib/bundler/ruby_dsl.rb +20 -12
  109. data/lib/bundler/ruby_version.rb +1 -1
  110. data/lib/bundler/rubygems_ext.rb +27 -54
  111. data/lib/bundler/rubygems_gem_installer.rb +23 -58
  112. data/lib/bundler/rubygems_integration.rb +25 -94
  113. data/lib/bundler/runtime.rb +2 -2
  114. data/lib/bundler/self_manager.rb +23 -7
  115. data/lib/bundler/settings.rb +27 -7
  116. data/lib/bundler/setup.rb +4 -1
  117. data/lib/bundler/shared_helpers.rb +35 -13
  118. data/lib/bundler/source/git/git_proxy.rb +22 -14
  119. data/lib/bundler/source/git.rb +4 -3
  120. data/lib/bundler/source/metadata.rb +16 -16
  121. data/lib/bundler/source/path.rb +7 -6
  122. data/lib/bundler/source/rubygems.rb +21 -14
  123. data/lib/bundler/source.rb +2 -0
  124. data/lib/bundler/spec_set.rb +43 -12
  125. data/lib/bundler/stub_specification.rb +1 -0
  126. data/lib/bundler/templates/Executable.bundler +1 -1
  127. data/lib/bundler/templates/newgem/README.md.tt +3 -3
  128. data/lib/bundler/templates/newgem/Rakefile.tt +2 -6
  129. data/lib/bundler/templates/newgem/ext/newgem/Cargo.toml.tt +1 -1
  130. data/lib/bundler/templates/newgem/newgem.gemspec.tt +1 -1
  131. data/lib/bundler/templates/newgem/standard.yml.tt +1 -1
  132. data/lib/bundler/ui/shell.rb +2 -2
  133. data/lib/bundler/vendor/connection_pool/lib/connection_pool/version.rb +1 -1
  134. data/lib/bundler/vendor/connection_pool/lib/connection_pool.rb +53 -6
  135. data/lib/bundler/vendor/fileutils/lib/fileutils.rb +8 -20
  136. data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/connection.rb +4 -3
  137. data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/pool.rb +23 -11
  138. data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/timed_stack_multi.rb +1 -1
  139. data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +36 -36
  140. data/lib/bundler/vendor/thor/lib/thor/actions/create_file.rb +3 -2
  141. data/lib/bundler/vendor/thor/lib/thor/actions/directory.rb +1 -1
  142. data/lib/bundler/vendor/thor/lib/thor/actions/empty_directory.rb +1 -1
  143. data/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +8 -10
  144. data/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb +15 -4
  145. data/lib/bundler/vendor/thor/lib/thor/actions.rb +15 -15
  146. data/lib/bundler/vendor/thor/lib/thor/base.rb +140 -14
  147. data/lib/bundler/vendor/thor/lib/thor/command.rb +13 -4
  148. data/lib/bundler/vendor/thor/lib/thor/core_ext/hash_with_indifferent_access.rb +4 -0
  149. data/lib/bundler/vendor/thor/lib/thor/error.rb +16 -25
  150. data/lib/bundler/vendor/thor/lib/thor/group.rb +1 -1
  151. data/lib/bundler/vendor/thor/lib/thor/invocation.rb +1 -1
  152. data/lib/bundler/vendor/thor/lib/thor/nested_context.rb +2 -2
  153. data/lib/bundler/vendor/thor/lib/thor/parser/argument.rb +20 -1
  154. data/lib/bundler/vendor/thor/lib/thor/parser/arguments.rb +33 -17
  155. data/lib/bundler/vendor/thor/lib/thor/parser/option.rb +27 -8
  156. data/lib/bundler/vendor/thor/lib/thor/parser/options.rb +44 -6
  157. data/lib/bundler/vendor/thor/lib/thor/rake_compat.rb +2 -2
  158. data/lib/bundler/vendor/thor/lib/thor/runner.rb +40 -30
  159. data/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +26 -150
  160. data/lib/bundler/vendor/thor/lib/thor/shell/color.rb +4 -46
  161. data/lib/bundler/vendor/thor/lib/thor/shell/column_printer.rb +29 -0
  162. data/lib/bundler/vendor/thor/lib/thor/shell/html.rb +3 -45
  163. data/lib/bundler/vendor/thor/lib/thor/shell/lcs_diff.rb +49 -0
  164. data/lib/bundler/vendor/thor/lib/thor/shell/table_printer.rb +134 -0
  165. data/lib/bundler/vendor/thor/lib/thor/shell/terminal.rb +42 -0
  166. data/lib/bundler/vendor/thor/lib/thor/shell/wrapped_printer.rb +38 -0
  167. data/lib/bundler/vendor/thor/lib/thor/shell.rb +1 -1
  168. data/lib/bundler/vendor/thor/lib/thor/util.rb +8 -7
  169. data/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
  170. data/lib/bundler/vendor/thor/lib/thor.rb +155 -8
  171. data/lib/bundler/vendor/tsort/lib/tsort.rb +3 -0
  172. data/lib/bundler/vendor/uri/lib/uri/common.rb +256 -132
  173. data/lib/bundler/vendor/uri/lib/uri/generic.rb +1 -0
  174. data/lib/bundler/vendor/uri/lib/uri/rfc3986_parser.rb +95 -31
  175. data/lib/bundler/vendor/uri/lib/uri/version.rb +1 -1
  176. data/lib/bundler/vendored_net_http.rb +8 -0
  177. data/lib/bundler/vendored_persistent.rb +0 -4
  178. data/lib/bundler/vendored_timeout.rb +8 -0
  179. data/lib/bundler/version.rb +1 -1
  180. data/lib/bundler/vlad.rb +1 -1
  181. data/lib/bundler/yaml_serializer.rb +9 -4
  182. data/lib/bundler.rb +38 -35
  183. metadata +16 -5
@@ -11,7 +11,7 @@ module Bundler
11
11
  class CLI::Gem
12
12
  TEST_FRAMEWORK_VERSIONS = {
13
13
  "rspec" => "3.0",
14
- "minitest" => "5.0",
14
+ "minitest" => "5.16",
15
15
  "test-unit" => "3.0",
16
16
  }.freeze
17
17
 
@@ -59,23 +59,23 @@ module Bundler
59
59
  end
60
60
 
61
61
  config = {
62
- :name => name,
63
- :underscored_name => underscored_name,
64
- :namespaced_path => namespaced_path,
65
- :makefile_path => "#{underscored_name}/#{underscored_name}",
66
- :constant_name => constant_name,
67
- :constant_array => constant_array,
68
- :author => git_author_name.empty? ? "TODO: Write your name" : git_author_name,
69
- :email => git_user_email.empty? ? "TODO: Write your email address" : git_user_email,
70
- :test => options[:test],
71
- :ext => extension,
72
- :exe => options[:exe],
73
- :bundler_version => bundler_dependency_version,
74
- :git => use_git,
75
- :github_username => github_username.empty? ? "[USERNAME]" : github_username,
76
- :required_ruby_version => required_ruby_version,
77
- :rust_builder_required_rubygems_version => rust_builder_required_rubygems_version,
78
- :minitest_constant_name => minitest_constant_name,
62
+ name: name,
63
+ underscored_name: underscored_name,
64
+ namespaced_path: namespaced_path,
65
+ makefile_path: "#{underscored_name}/#{underscored_name}",
66
+ constant_name: constant_name,
67
+ constant_array: constant_array,
68
+ author: git_author_name.empty? ? "TODO: Write your name" : git_author_name,
69
+ email: git_user_email.empty? ? "TODO: Write your email address" : git_user_email,
70
+ test: options[:test],
71
+ ext: extension,
72
+ exe: options[:exe],
73
+ bundler_version: bundler_dependency_version,
74
+ git: use_git,
75
+ github_username: github_username.empty? ? "[USERNAME]" : github_username,
76
+ required_ruby_version: required_ruby_version,
77
+ rust_builder_required_rubygems_version: rust_builder_required_rubygems_version,
78
+ minitest_constant_name: minitest_constant_name,
79
79
  }
80
80
  ensure_safe_gem_name(name, constant_array)
81
81
 
@@ -137,10 +137,13 @@ module Bundler
137
137
  case config[:ci]
138
138
  when "github"
139
139
  templates.merge!("github/workflows/main.yml.tt" => ".github/workflows/main.yml")
140
+ config[:ci_config_path] = ".github "
140
141
  when "gitlab"
141
142
  templates.merge!("gitlab-ci.yml.tt" => ".gitlab-ci.yml")
143
+ config[:ci_config_path] = ".gitlab-ci.yml "
142
144
  when "circle"
143
145
  templates.merge!("circleci/config.yml.tt" => ".circleci/config.yml")
146
+ config[:ci_config_path] = ".circleci "
144
147
  end
145
148
 
146
149
  if ask_and_set(:mit, "Do you want to license your code permissively under the MIT license?",
@@ -233,7 +236,7 @@ module Bundler
233
236
  end
234
237
 
235
238
  if use_git
236
- IO.popen(%w[git add .], { :chdir => target }, &:read)
239
+ IO.popen(%w[git add .], { chdir: target }, &:read)
237
240
  end
238
241
 
239
242
  # Open gemspec in editor
@@ -346,7 +349,7 @@ module Bundler
346
349
  Bundler.ui.confirm "Do you want to add a code linter and formatter to your gem? " \
347
350
  "Supported Linters:\n" \
348
351
  "* RuboCop: https://rubocop.org\n" \
349
- "* Standard: https://github.com/testdouble/standard\n" \
352
+ "* Standard: https://github.com/standardrb/standard\n" \
350
353
  "\n"
351
354
  Bundler.ui.info hint_text("linter")
352
355
 
@@ -377,15 +380,20 @@ module Bundler
377
380
  def deprecated_rubocop_option
378
381
  if !options[:rubocop].nil?
379
382
  if options[:rubocop]
380
- Bundler::SharedHelpers.major_deprecation 2, "--rubocop is deprecated, use --linter=rubocop"
383
+ Bundler::SharedHelpers.major_deprecation 2,
384
+ "--rubocop is deprecated, use --linter=rubocop",
385
+ removed_message: "--rubocop has been removed, use --linter=rubocop"
381
386
  "rubocop"
382
387
  else
383
- Bundler::SharedHelpers.major_deprecation 2, "--no-rubocop is deprecated, use --linter"
388
+ Bundler::SharedHelpers.major_deprecation 2,
389
+ "--no-rubocop is deprecated, use --linter",
390
+ removed_message: "--no-rubocop has been removed, use --linter"
384
391
  false
385
392
  end
386
393
  elsif !Bundler.settings["gem.rubocop"].nil?
387
394
  Bundler::SharedHelpers.major_deprecation 2,
388
- "config gem.rubocop is deprecated; we've updated your config to use gem.linter instead"
395
+ "config gem.rubocop is deprecated; we've updated your config to use gem.linter instead",
396
+ removed_message: "config gem.rubocop has been removed; we've updated your config to use gem.linter instead"
389
397
  Bundler.settings["gem.rubocop"] ? "rubocop" : false
390
398
  end
391
399
  end
@@ -25,19 +25,8 @@ module Bundler
25
25
 
26
26
  private
27
27
 
28
- def spec_for_gem(gem_name)
29
- spec = Bundler.definition.specs.find {|s| s.name == gem_name }
30
- spec || default_gem_spec(gem_name) || Bundler::CLI::Common.select_spec(gem_name, :regex_match)
31
- end
32
-
33
- def default_gem_spec(gem_name)
34
- return unless Gem::Specification.respond_to?(:find_all_by_name)
35
- gem_spec = Gem::Specification.find_all_by_name(gem_name).last
36
- gem_spec if gem_spec&.default_gem?
37
- end
38
-
39
- def spec_not_found(gem_name)
40
- raise GemNotFound, Bundler::CLI::Common.gem_not_found_message(gem_name, Bundler.definition.dependencies)
28
+ def spec_for_gem(name)
29
+ Bundler::CLI::Common.select_spec(name, :regex_match)
41
30
  end
42
31
 
43
32
  def print_gem_version(spec)
@@ -51,7 +51,8 @@ module Bundler
51
51
 
52
52
  if options["binstubs"]
53
53
  Bundler::SharedHelpers.major_deprecation 2,
54
- "The --binstubs option will be removed in favor of `bundle binstubs --all`"
54
+ "The --binstubs option will be removed in favor of `bundle binstubs --all`",
55
+ removed_message: "The --binstubs option have been removed in favor of `bundle binstubs --all`"
55
56
  end
56
57
 
57
58
  Plugin.gemfile_install(Bundler.default_gemfile) if Bundler.feature_flag.plugins?
@@ -61,7 +62,7 @@ module Bundler
61
62
 
62
63
  installer = Installer.install(Bundler.root, definition, options)
63
64
 
64
- Bundler.settings.temporary(:cache_all_platforms => options[:local] ? false : Bundler.settings[:cache_all_platforms]) do
65
+ Bundler.settings.temporary(cache_all_platforms: options[:local] ? false : Bundler.settings[:cache_all_platforms]) do
65
66
  Bundler.load.cache(nil, options[:local]) if Bundler.app_cache.exist? && !options["no-cache"] && !Bundler.frozen_bundle?
66
67
  end
67
68
 
@@ -95,7 +96,7 @@ module Bundler
95
96
  def warn_if_root
96
97
  return if Bundler.settings[:silence_root_warning] || Gem.win_platform? || !Process.uid.zero?
97
98
  Bundler.ui.warn "Don't run Bundler as root. Installing your bundle as root " \
98
- "will break this application for all non-root users on this machine.", :wrap => true
99
+ "will break this application for all non-root users on this machine.", wrap: true
99
100
  end
100
101
 
101
102
  def dependencies_count_for(definition)
@@ -148,7 +149,7 @@ module Bundler
148
149
  Bundler.settings.set_command_option_if_given :path, options[:path]
149
150
 
150
151
  if options["standalone"] && Bundler.settings[:path].nil? && !options["local"]
151
- Bundler.settings.temporary(:path_relative_to_cwd => false) do
152
+ Bundler.settings.temporary(path_relative_to_cwd: false) do
152
153
  Bundler.settings.set_command_option :path, "bundle"
153
154
  end
154
155
  end
@@ -5,7 +5,7 @@ require "rbconfig"
5
5
  module Bundler
6
6
  class CLI::Issue
7
7
  def run
8
- Bundler.ui.info <<-EOS.gsub(/^ {8}/, "")
8
+ Bundler.ui.info <<~EOS
9
9
  Did you find an issue with Bundler? Before filing a new issue,
10
10
  be sure to check out these resources:
11
11
 
@@ -26,14 +26,14 @@ module Bundler
26
26
 
27
27
  if update.is_a?(Array) # unlocking specific gems
28
28
  Bundler::CLI::Common.ensure_all_gems_in_lockfile!(update)
29
- update = { :gems => update, :conservative => conservative }
29
+ update = { gems: update, conservative: conservative }
30
30
  elsif update && conservative
31
- update = { :conservative => conservative }
31
+ update = { conservative: conservative }
32
32
  elsif update && bundler
33
- update = { :bundler => bundler }
33
+ update = { bundler: bundler }
34
34
  end
35
35
 
36
- Bundler.settings.temporary(:frozen => false) do
36
+ Bundler.settings.temporary(frozen: false) do
37
37
  definition = Bundler.definition(update)
38
38
 
39
39
  Bundler::CLI::Common.configure_gem_version_promoter(definition, options) if options[:update]
@@ -21,7 +21,7 @@ module Bundler
21
21
  require "shellwords"
22
22
  command = Shellwords.split(editor) << File.join([root_path, path].compact)
23
23
  Bundler.with_original_env do
24
- system(*command, { :chdir => root_path })
24
+ system(*command, { chdir: root_path })
25
25
  end || Bundler.ui.info("Could not run '#{command.join(" ")}'")
26
26
  end
27
27
  end
@@ -41,12 +41,12 @@ module Bundler
41
41
  # We're doing a full update
42
42
  Bundler.definition(true)
43
43
  else
44
- Bundler.definition(:gems => gems, :sources => sources)
44
+ Bundler.definition(gems: gems, sources: sources)
45
45
  end
46
46
 
47
47
  Bundler::CLI::Common.configure_gem_version_promoter(
48
48
  Bundler.definition,
49
- options.merge(:strict => @strict)
49
+ options.merge(strict: @strict)
50
50
  )
51
51
 
52
52
  definition_resolution = proc do
@@ -90,10 +90,10 @@ module Bundler
90
90
  end
91
91
 
92
92
  outdated_gems << {
93
- :active_spec => active_spec,
94
- :current_spec => current_spec,
95
- :dependency => dependency,
96
- :groups => groups,
93
+ active_spec: active_spec,
94
+ current_spec: current_spec,
95
+ dependency: dependency,
96
+ groups: groups,
97
97
  }
98
98
  end
99
99
 
@@ -7,18 +7,12 @@ module Bundler
7
7
  long_desc <<-D
8
8
  Install plugins either from the rubygems source provided (with --source option) or from a git source provided with --git (for remote repos) or --local_git (for local repos). If no sources are provided, it uses Gem.sources
9
9
  D
10
- method_option "source", :type => :string, :default => nil, :banner =>
11
- "URL of the RubyGems source to fetch the plugin from"
12
- method_option "version", :type => :string, :default => nil, :banner =>
13
- "The version of the plugin to fetch"
14
- method_option "git", :type => :string, :default => nil, :banner =>
15
- "URL of the git repo to fetch from"
16
- method_option "local_git", :type => :string, :default => nil, :banner =>
17
- "Path of the local git repo to fetch from"
18
- method_option "branch", :type => :string, :default => nil, :banner =>
19
- "The git branch to checkout"
20
- method_option "ref", :type => :string, :default => nil, :banner =>
21
- "The git revision to check out"
10
+ method_option "source", type: :string, default: nil, banner: "URL of the RubyGems source to fetch the plugin from"
11
+ method_option "version", type: :string, default: nil, banner: "The version of the plugin to fetch"
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"
14
+ method_option "branch", type: :string, default: nil, banner: "The git branch to checkout"
15
+ method_option "ref", type: :string, default: nil, banner: "The git revision to check out"
22
16
  def install(*plugins)
23
17
  Bundler::Plugin.install(plugins, options)
24
18
  end
@@ -27,8 +21,7 @@ module Bundler
27
21
  long_desc <<-D
28
22
  Uninstall given list of plugins. To uninstall all the plugins, use -all option.
29
23
  D
30
- method_option "all", :type => :boolean, :default => nil, :banner =>
31
- "Uninstall all the installed plugins. If no plugin is installed, then it does nothing."
24
+ method_option "all", type: :boolean, default: nil, banner: "Uninstall all the installed plugins. If no plugin is installed, then it does nothing."
32
25
  def uninstall(*plugins)
33
26
  Bundler::Plugin.uninstall(plugins, options)
34
27
  end
@@ -12,40 +12,48 @@ module Bundler
12
12
  definition.validate_runtime!
13
13
  installer = Bundler::Installer.new(Bundler.root, definition)
14
14
 
15
- Bundler.load.specs.each do |spec|
16
- next if spec.name == "bundler" # Source::Rubygems doesn't install bundler
17
- next if !@gems.empty? && !@gems.include?(spec.name)
18
-
19
- gem_name = "#{spec.name} (#{spec.version}#{spec.git_version})"
20
- gem_name += " (#{spec.platform})" if !spec.platform.nil? && spec.platform != Gem::Platform::RUBY
21
-
22
- case source = spec.source
23
- when Source::Rubygems
24
- cached_gem = spec.cache_file
25
- unless File.exist?(cached_gem)
26
- Bundler.ui.error("Failed to pristine #{gem_name}. Cached gem #{cached_gem} does not exist.")
15
+ ProcessLock.lock do
16
+ installed_specs = definition.specs.reject do |spec|
17
+ next if spec.name == "bundler" # Source::Rubygems doesn't install bundler
18
+ next if !@gems.empty? && !@gems.include?(spec.name)
19
+
20
+ gem_name = "#{spec.name} (#{spec.version}#{spec.git_version})"
21
+ gem_name += " (#{spec.platform})" if !spec.platform.nil? && spec.platform != Gem::Platform::RUBY
22
+
23
+ case source = spec.source
24
+ when Source::Rubygems
25
+ cached_gem = spec.cache_file
26
+ unless File.exist?(cached_gem)
27
+ Bundler.ui.error("Failed to pristine #{gem_name}. Cached gem #{cached_gem} does not exist.")
28
+ next
29
+ end
30
+
31
+ FileUtils.rm_rf spec.full_gem_path
32
+ when Source::Git
33
+ if source.local?
34
+ Bundler.ui.warn("Cannot pristine #{gem_name}. Gem is locally overridden.")
35
+ next
36
+ end
37
+
38
+ source.remote!
39
+ if extension_cache_path = source.extension_cache_path(spec)
40
+ FileUtils.rm_rf extension_cache_path
41
+ end
42
+ FileUtils.rm_rf spec.extension_dir
43
+ FileUtils.rm_rf spec.full_gem_path
44
+ else
45
+ Bundler.ui.warn("Cannot pristine #{gem_name}. Gem is sourced from local path.")
27
46
  next
28
47
  end
29
48
 
30
- FileUtils.rm_rf spec.full_gem_path
31
- when Source::Git
32
- if source.local?
33
- Bundler.ui.warn("Cannot pristine #{gem_name}. Gem is locally overridden.")
34
- next
35
- end
49
+ true
50
+ end.map(&:name)
36
51
 
37
- source.remote!
38
- if extension_cache_path = source.extension_cache_path(spec)
39
- FileUtils.rm_rf extension_cache_path
40
- end
41
- FileUtils.rm_rf spec.extension_dir
42
- FileUtils.rm_rf spec.full_gem_path
43
- else
44
- Bundler.ui.warn("Cannot pristine #{gem_name}. Gem is sourced from local path.")
45
- next
46
- end
47
-
48
- Bundler::GemInstaller.new(spec, installer, false, 0, true).install_from_spec
52
+ jobs = installer.send(:installation_parallelization, {})
53
+ pristine_count = definition.specs.count - installed_specs.count
54
+ # allow a pristining a single gem to skip the parallel worker
55
+ jobs = [jobs, pristine_count].min
56
+ ParallelInstaller.call(installer, definition.specs, jobs, false, true, skip: installed_specs)
49
57
  end
50
58
  end
51
59
  end
@@ -40,8 +40,8 @@ module Bundler
40
40
  desc = " * #{s.name} (#{s.version}#{s.git_version})"
41
41
  if @verbose
42
42
  latest = latest_specs.find {|l| l.name == s.name }
43
- Bundler.ui.info <<-END.gsub(/^ +/, "")
44
- #{desc}
43
+ Bundler.ui.info <<~END
44
+ #{desc.lstrip}
45
45
  \tSummary: #{s.summary || "No description available."}
46
46
  \tHomepage: #{s.homepage || "No website available."}
47
47
  \tStatus: #{outdated?(s, latest) ? "Outdated - #{s.version} < #{latest.version}" : "Up to date"}
@@ -35,7 +35,7 @@ module Bundler
35
35
 
36
36
  if full_update
37
37
  if conservative
38
- Bundler.definition(:conservative => conservative)
38
+ Bundler.definition(conservative: conservative)
39
39
  else
40
40
  Bundler.definition(true)
41
41
  end
@@ -51,9 +51,9 @@ module Bundler
51
51
  gems.concat(deps.map(&:name))
52
52
  end
53
53
 
54
- Bundler.definition(:gems => gems, :sources => sources, :ruby => options[:ruby],
55
- :conservative => conservative,
56
- :bundler => update_bundler)
54
+ Bundler.definition(gems: gems, sources: sources, ruby: options[:ruby],
55
+ conservative: conservative,
56
+ bundler: update_bundler)
57
57
  end
58
58
 
59
59
  Bundler::CLI::Common.configure_gem_version_promoter(Bundler.definition, options)
@@ -71,7 +71,7 @@ module Bundler
71
71
 
72
72
  if locked_gems = Bundler.definition.locked_gems
73
73
  previous_locked_info = locked_gems.specs.reduce({}) do |h, s|
74
- h[s.name] = { :spec => s, :version => s.version, :source => s.source.identifier }
74
+ h[s.name] = { spec: s, version: s.version, source: s.source.identifier }
75
75
  h
76
76
  end
77
77
  end