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
@@ -43,16 +43,6 @@ module Bundler
43
43
  private
44
44
 
45
45
  def check_sources_consistency!(options)
46
- if options.key?(:git) && options.key?(:local_git)
47
- raise InvalidOption, "Remote and local plugin git sources can't be both specified"
48
- end
49
-
50
- # back-compat; local_git is an alias for git
51
- if options.key?(:local_git)
52
- Bundler::SharedHelpers.major_deprecation(2, "--local_git is deprecated, use --git")
53
- options[:git] = options.delete(:local_git)
54
- end
55
-
56
46
  if (options.keys & [:source, :git, :path]).length > 1
57
47
  raise InvalidOption, "Only one of --source, --git, or --path may be specified"
58
48
  end
@@ -23,7 +23,7 @@ module Bundler
23
23
 
24
24
  private
25
25
 
26
- def rubygems_aggregate_class
26
+ def source_class
27
27
  Plugin::Installer::Rubygems
28
28
  end
29
29
  end
@@ -220,7 +220,7 @@ module Bundler
220
220
  #
221
221
  # @param [String] event
222
222
  def hook(event, *args, &arg_blk)
223
- return unless Bundler.feature_flag.plugins?
223
+ return unless Bundler.settings[:plugins]
224
224
  unless Events.defined_event?(event)
225
225
  raise ArgumentError, "Event '#{event}' not defined in Bundler::Plugin::Events"
226
226
  end
@@ -21,6 +21,7 @@ module Bundler
21
21
  @locked_version = locked_specs.version_for(name)
22
22
  @unlock = unlock
23
23
  @dependency = dependency || Dependency.new(name, @locked_version)
24
+ @platforms |= [Gem::Platform::RUBY] if @dependency.default_force_ruby_platform
24
25
  @top_level = !dependency.nil?
25
26
  @prerelease = @dependency.prerelease? || @locked_version&.prerelease? || prerelease ? :consider_first : :ignore
26
27
  @prefer_local = prefer_local
@@ -165,7 +165,7 @@ module Bundler
165
165
  PubGrub::VersionConstraint.new(package, range: range)
166
166
  end
167
167
 
168
- def versions_for(package, range=VersionRange.any)
168
+ def versions_for(package, range = VersionRange.any)
169
169
  range.select_versions(@sorted_versions[package])
170
170
  end
171
171
 
@@ -57,6 +57,8 @@ module Bundler
57
57
  else
58
58
  file_content.strip
59
59
  end
60
+ rescue Errno::ENOENT
61
+ raise GemfileError, "Could not find version file #{filename}"
60
62
  end
61
63
  end
62
64
  end
@@ -43,7 +43,6 @@ module Bundler
43
43
 
44
44
  def to_s(versions = self.versions)
45
45
  output = String.new("ruby #{versions_string(versions)}")
46
- output << "p#{patchlevel}" if patchlevel && patchlevel != "-1"
47
46
  output << " (#{engine} #{versions_string(engine_versions)})" unless engine == "ruby"
48
47
 
49
48
  output
@@ -72,8 +71,7 @@ module Bundler
72
71
  def ==(other)
73
72
  versions == other.versions &&
74
73
  engine == other.engine &&
75
- engine_versions == other.engine_versions &&
76
- patchlevel == other.patchlevel
74
+ engine_versions == other.engine_versions
77
75
  end
78
76
 
79
77
  def host
@@ -417,7 +417,7 @@ module Gem
417
417
  unless Gem::NameTuple.new("a", Gem::Version.new("1"), Gem::Platform.new("x86_64-linux")).platform.is_a?(String)
418
418
  alias_method :initialize_with_platform, :initialize
419
419
 
420
- def initialize(name, version, platform=Gem::Platform::RUBY)
420
+ def initialize(name, version, platform = Gem::Platform::RUBY)
421
421
  if Gem::Platform === platform
422
422
  initialize_with_platform(name, version, platform.to_s)
423
423
  else
@@ -69,7 +69,7 @@ module Bundler
69
69
  end
70
70
 
71
71
  def generate_plugins
72
- return unless Gem::Installer.instance_methods(false).include?(:generate_plugins)
72
+ return unless Gem::Installer.method_defined?(:generate_plugins, false)
73
73
 
74
74
  latest = Gem::Specification.stubs_for(spec.name).first
75
75
  return if latest && latest.version > spec.version
@@ -416,11 +416,7 @@ module Bundler
416
416
  end
417
417
 
418
418
  def all_specs
419
- SharedHelpers.major_deprecation 2, "Bundler.rubygems.all_specs has been removed in favor of Bundler.rubygems.installed_specs"
420
-
421
- Gem::Specification.stubs.map do |stub|
422
- StubSpecification.from_stub(stub)
423
- end
419
+ SharedHelpers.feature_removed! "Bundler.rubygems.all_specs has been removed in favor of Bundler.rubygems.installed_specs"
424
420
  end
425
421
 
426
422
  def installed_specs
@@ -97,7 +97,7 @@ module Bundler
97
97
  end
98
98
 
99
99
  def autoswitching_applies?
100
- ENV["BUNDLER_VERSION"].nil? &&
100
+ (ENV["BUNDLER_VERSION"].nil? || ENV["BUNDLER_VERSION"].empty?) &&
101
101
  ruby_can_restart_with_same_arguments? &&
102
102
  lockfile_version
103
103
  end
@@ -7,7 +7,6 @@ module Bundler
7
7
  autoload :Validator, File.expand_path("settings/validator", __dir__)
8
8
 
9
9
  BOOL_KEYS = %w[
10
- allow_offline_install
11
10
  auto_install
12
11
  cache_all
13
12
  cache_all_platforms
@@ -20,7 +19,6 @@ module Bundler
20
19
  disable_shared_gems
21
20
  disable_version_check
22
21
  force_ruby_platform
23
- forget_cli_options
24
22
  frozen
25
23
  gem.changelog
26
24
  gem.coc
@@ -43,20 +41,6 @@ module Bundler
43
41
  verbose
44
42
  ].freeze
45
43
 
46
- REMEMBERED_KEYS = %w[
47
- bin
48
- cache_all
49
- clean
50
- deployment
51
- frozen
52
- no_prune
53
- path
54
- shebang
55
- path.system
56
- without
57
- with
58
- ].freeze
59
-
60
44
  NUMBER_KEYS = %w[
61
45
  jobs
62
46
  redirect
@@ -97,6 +81,11 @@ module Bundler
97
81
  "BUNDLE_RETRY" => 3,
98
82
  "BUNDLE_TIMEOUT" => 10,
99
83
  "BUNDLE_VERSION" => "lockfile",
84
+ "BUNDLE_LOCKFILE_CHECKSUMS" => true,
85
+ "BUNDLE_CACHE_ALL" => true,
86
+ "BUNDLE_PLUGINS" => true,
87
+ "BUNDLE_GLOBAL_GEM_CACHE" => false,
88
+ "BUNDLE_UPDATE_REQUIRES_ALL_FLAG" => false,
100
89
  }.freeze
101
90
 
102
91
  def initialize(root = nil)
@@ -128,12 +117,8 @@ module Bundler
128
117
  end
129
118
 
130
119
  def set_command_option(key, value)
131
- if !is_remembered(key) || Bundler.feature_flag.forget_cli_options?
132
- temporary(key => value)
133
- value
134
- else
135
- set_local(key, value)
136
- end
120
+ temporary(key => value)
121
+ value
137
122
  end
138
123
 
139
124
  def set_command_option_if_given(key, value)
@@ -272,7 +257,7 @@ module Bundler
272
257
  def use_system_gems?
273
258
  return true if system_path
274
259
  return false if explicit_path
275
- !Bundler.feature_flag.bundler_4_mode?
260
+ !Bundler.feature_flag.bundler_5_mode?
276
261
  end
277
262
 
278
263
  def base_path
@@ -387,10 +372,6 @@ module Bundler
387
372
  ARRAY_KEYS.include?(self.class.key_to_s(key))
388
373
  end
389
374
 
390
- def is_remembered(key)
391
- REMEMBERED_KEYS.include?(self.class.key_to_s(key))
392
- end
393
-
394
375
  def is_credential(key)
395
376
  key == "gem.push_key"
396
377
  end
@@ -4,8 +4,6 @@ require_relative "version"
4
4
  require_relative "rubygems_integration"
5
5
  require_relative "current_ruby"
6
6
 
7
- autoload :Pathname, "pathname"
8
-
9
7
  module Bundler
10
8
  autoload :WINDOWS, File.expand_path("constants", __dir__)
11
9
  autoload :FREEBSD, File.expand_path("constants", __dir__)
@@ -57,7 +55,7 @@ module Bundler
57
55
 
58
56
  def pwd
59
57
  Bundler.rubygems.ext_lock.synchronize do
60
- Pathname.pwd
58
+ Dir.pwd
61
59
  end
62
60
  end
63
61
 
@@ -125,27 +123,17 @@ module Bundler
125
123
  raise GenericSystemCallError.new(e, "There was an error #{[:create, :write].include?(action) ? "creating" : "accessing"} `#{path}`.")
126
124
  end
127
125
 
128
- def major_deprecation(major_version, message, removed_message: nil, print_caller_location: false)
129
- if print_caller_location
130
- caller_location = caller_locations(2, 2).first
131
- suffix = " (called at #{caller_location.path}:#{caller_location.lineno})"
132
- message += suffix
133
- removed_message += suffix if removed_message
134
- end
135
-
136
- require_relative "../bundler"
137
-
138
- feature_flag = Bundler.feature_flag
126
+ def feature_deprecated!(message)
127
+ return unless prints_major_deprecations?
139
128
 
140
- if feature_flag.removed_major?(major_version)
141
- require_relative "errors"
142
- raise DeprecatedError, "[REMOVED] #{removed_message || message}"
143
- end
144
-
145
- return unless feature_flag.deprecated_major?(major_version) && prints_major_deprecations?
146
129
  Bundler.ui.warn("[DEPRECATED] #{message}")
147
130
  end
148
131
 
132
+ def feature_removed!(message)
133
+ require_relative "errors"
134
+ raise RemovedError, "[REMOVED] #{message}"
135
+ end
136
+
149
137
  def print_major_deprecations!
150
138
  multiple_gemfiles = search_up(".") do |dir|
151
139
  gemfiles = gemfile_names.select {|gf| File.file? File.expand_path(gf, dir) }
@@ -10,6 +10,10 @@ module Bundler
10
10
  super
11
11
  @gemspec = options["gemspec"]
12
12
  end
13
+
14
+ def to_s
15
+ "gemspec at `#{@path}`"
16
+ end
13
17
  end
14
18
  end
15
19
  end
@@ -16,7 +16,7 @@ module Bundler
16
16
  def initialize(command)
17
17
  msg = String.new
18
18
  msg << "Bundler is trying to run `#{command}` at runtime. You probably need to run `bundle install`. However, "
19
- msg << "this error message could probably be more useful. Please submit a ticket at https://github.com/rubygems/rubygems/issues/new?labels=Bundler&template=bundler-related-issue.md "
19
+ msg << "this error message could probably be more useful. Please submit a ticket at https://github.com/ruby/rubygems/issues/new?labels=Bundler&template=bundler-related-issue.md "
20
20
  msg << "with steps to reproduce as well as the following\n\nCALLER: #{caller.join("\n")}"
21
21
  super msg
22
22
  end
@@ -121,7 +121,7 @@ module Bundler
121
121
  FileUtils.rm_rf(p)
122
122
  end
123
123
  git "clone", "--no-checkout", "--quiet", path.to_s, destination.to_s
124
- File.chmod(((File.stat(destination).mode | 0o777) & ~File.umask), destination)
124
+ File.chmod((File.stat(destination).mode | 0o777) & ~File.umask, destination)
125
125
  rescue Errno::EEXIST => e
126
126
  file_path = e.message[%r{.*?((?:[a-zA-Z]:)?/.*)}, 1]
127
127
  raise GitError, "Bundler could not install a gem because it needs to " \
@@ -408,11 +408,7 @@ module Bundler
408
408
  def capture3_args_for(cmd, dir)
409
409
  return ["git", *cmd] unless dir
410
410
 
411
- if Bundler.feature_flag.bundler_4_mode? || supports_minus_c?
412
- ["git", "-C", dir.to_s, *cmd]
413
- else
414
- ["git", *cmd, { chdir: dir.to_s }]
415
- end
411
+ ["git", "-C", dir.to_s, *cmd]
416
412
  end
417
413
 
418
414
  def extra_clone_args
@@ -451,10 +447,6 @@ module Bundler
451
447
  depth.nil?
452
448
  end
453
449
 
454
- def supports_minus_c?
455
- @supports_minus_c ||= Gem::Version.new(version) >= Gem::Version.new("1.8.5")
456
- end
457
-
458
450
  def needs_allow_any_sha1_in_want?
459
451
  @needs_allow_any_sha1_in_want ||= Gem::Version.new(version) <= Gem::Version.new("2.13.7")
460
452
  end
@@ -238,7 +238,7 @@ module Bundler
238
238
  # across different projects, this cache will be shared.
239
239
  # When using local git repos, this is set to the local repo.
240
240
  def cache_path
241
- @cache_path ||= if Bundler.feature_flag.global_gem_cache?
241
+ @cache_path ||= if Bundler.settings[:global_gem_cache]
242
242
  Bundler.user_cache
243
243
  else
244
244
  Bundler.bundle_path.join("cache", "bundler")
@@ -268,7 +268,7 @@ module Bundler
268
268
  private
269
269
 
270
270
  def cache_to(custom_path, try_migrate: false)
271
- return unless Bundler.feature_flag.cache_all?
271
+ return unless Bundler.settings[:cache_all]
272
272
 
273
273
  app_cache_path = app_cache_path(custom_path)
274
274
 
@@ -416,7 +416,6 @@ module Bundler
416
416
  def fetch
417
417
  git_proxy.checkout
418
418
  rescue GitError => e
419
- raise unless Bundler.feature_flag.allow_offline_install?
420
419
  Bundler.ui.warn "Using cached git data because of network errors:\n#{e}"
421
420
  end
422
421
 
@@ -24,7 +24,7 @@ module Bundler
24
24
  @path = Pathname.new(options["path"])
25
25
  expanded_path = expand(@path)
26
26
  @path = if @path.relative?
27
- expanded_path.relative_path_from(root_path.expand_path)
27
+ expanded_path.relative_path_from(File.expand_path(root_path))
28
28
  else
29
29
  expanded_path
30
30
  end
@@ -53,6 +53,8 @@ module Bundler
53
53
  "source at `#{@path}`"
54
54
  end
55
55
 
56
+ alias_method :identifier, :to_s
57
+
56
58
  alias_method :to_gemfile, :path
57
59
 
58
60
  def hash
@@ -81,7 +83,7 @@ module Bundler
81
83
 
82
84
  def cache(spec, custom_path = nil)
83
85
  app_cache_path = app_cache_path(custom_path)
84
- return unless Bundler.feature_flag.cache_all?
86
+ return unless Bundler.settings[:cache_all]
85
87
  return if expand(@original_path).to_s.index(root_path.to_s + "/") == 0
86
88
 
87
89
  unless @original_path.exist?
@@ -124,11 +126,7 @@ module Bundler
124
126
  end
125
127
 
126
128
  def expand(somepath)
127
- if Bundler.current_ruby.jruby? # TODO: Unify when https://github.com/rubygems/bundler/issues/7598 fixed upstream and all supported jrubies include the fix
128
- somepath.expand_path(root_path).expand_path
129
- else
130
- somepath.expand_path(root_path)
131
- end
129
+ somepath.expand_path(root_path)
132
130
  rescue ArgumentError => e
133
131
  Bundler.ui.debug(e)
134
132
  raise PathError, "There was an error while trying to use the path " \
@@ -8,7 +8,7 @@ module Bundler
8
8
  autoload :Remote, File.expand_path("rubygems/remote", __dir__)
9
9
 
10
10
  # Ask for X gems per API request
11
- API_REQUEST_SIZE = 50
11
+ API_REQUEST_SIZE = 100
12
12
 
13
13
  attr_accessor :remotes
14
14
 
@@ -168,12 +168,6 @@ module Bundler
168
168
  return nil # no post-install message
169
169
  end
170
170
 
171
- if spec.remote
172
- # Check for this spec from other sources
173
- uris = [spec.remote, *remotes_for_spec(spec)].map(&:anonymized_uri).uniq
174
- Installer.ambiguous_gems << [spec.name, *uris] if uris.length > 1
175
- end
176
-
177
171
  path = fetch_gem_if_possible(spec, options[:previous_spec])
178
172
  raise GemNotFound, "Could not find #{spec.file_name} for installation" unless path
179
173
 
@@ -217,7 +211,11 @@ module Bundler
217
211
  message += " with native extensions" if spec.extensions.any?
218
212
  Bundler.ui.confirm message
219
213
 
220
- installed_spec = installer.install
214
+ installed_spec = nil
215
+
216
+ Gem.time("Installed #{spec.name} in", 0, true) do
217
+ installed_spec = installer.install
218
+ end
221
219
 
222
220
  spec.full_gem_path = installed_spec.full_gem_path
223
221
  spec.loaded_from = installed_spec.loaded_from
@@ -332,13 +330,6 @@ module Bundler
332
330
  remotes.map(&method(:remove_auth))
333
331
  end
334
332
 
335
- def remotes_for_spec(spec)
336
- specs.search_all(spec.name).inject([]) do |uris, s|
337
- uris << s.remote if s.remote
338
- uris
339
- end
340
- end
341
-
342
333
  def cached_gem(spec)
343
334
  global_cache_path = download_cache_path(spec)
344
335
  caches << global_cache_path if global_cache_path
@@ -491,7 +482,10 @@ module Bundler
491
482
  uri = spec.remote.uri
492
483
  Bundler.ui.confirm("Fetching #{version_message(spec, previous_spec)}")
493
484
  gem_remote_fetcher = remote_fetchers.fetch(spec.remote).gem_remote_fetcher
494
- Bundler.rubygems.download_gem(spec, uri, download_cache_path, gem_remote_fetcher)
485
+
486
+ Gem.time("Downloaded #{spec.name} in", 0, true) do
487
+ Bundler.rubygems.download_gem(spec, uri, download_cache_path, gem_remote_fetcher)
488
+ end
495
489
  end
496
490
 
497
491
  # Returns the global cache path of the calling Rubygems::Source object.
@@ -506,7 +500,7 @@ module Bundler
506
500
  # @return [Pathname] The global cache path.
507
501
  #
508
502
  def download_cache_path(spec)
509
- return unless Bundler.feature_flag.global_gem_cache?
503
+ return unless Bundler.settings[:global_gem_cache]
510
504
  return unless remote = spec.remote
511
505
  return unless cache_slug = remote.cache_slug
512
506
 
@@ -79,7 +79,7 @@ module Bundler
79
79
  end
80
80
 
81
81
  def extension_cache_path(spec)
82
- return unless Bundler.feature_flag.global_gem_cache?
82
+ return unless Bundler.settings[:global_gem_cache]
83
83
  return unless source_slug = extension_cache_slug(spec)
84
84
  Bundler.user_cache.join(
85
85
  "extensions", Gem::Platform.local.to_s, Bundler.ruby_scope,
@@ -9,7 +9,7 @@ module Bundler
9
9
  :metadata_source
10
10
 
11
11
  def global_rubygems_source
12
- @global_rubygems_source ||= rubygems_aggregate_class.new("allow_local" => true)
12
+ @global_rubygems_source ||= source_class.new("allow_local" => true)
13
13
  end
14
14
 
15
15
  def initialize
@@ -21,19 +21,9 @@ module Bundler
21
21
  @rubygems_sources = []
22
22
  @metadata_source = Source::Metadata.new
23
23
 
24
- @merged_gem_lockfile_sections = false
25
24
  @local_mode = true
26
25
  end
27
26
 
28
- def merged_gem_lockfile_sections?
29
- @merged_gem_lockfile_sections
30
- end
31
-
32
- def merged_gem_lockfile_sections!(replacement_source)
33
- @merged_gem_lockfile_sections = true
34
- @global_rubygems_source = replacement_source
35
- end
36
-
37
27
  def aggregate_global_source?
38
28
  global_rubygems_source.multiple_remotes?
39
29
  end
@@ -90,10 +80,6 @@ module Bundler
90
80
  @rubygems_sources
91
81
  end
92
82
 
93
- def rubygems_remotes
94
- rubygems_sources.flat_map(&:remotes).uniq
95
- end
96
-
97
83
  def all_sources
98
84
  path_sources + git_sources + plugin_sources + rubygems_sources + [metadata_source]
99
85
  end
@@ -115,11 +101,7 @@ module Bundler
115
101
  end
116
102
 
117
103
  def lock_rubygems_sources
118
- if merged_gem_lockfile_sections?
119
- [combine_rubygems_sources]
120
- else
121
- rubygems_sources.sort_by(&:identifier)
122
- end
104
+ rubygems_sources.sort_by(&:identifier)
123
105
  end
124
106
 
125
107
  # Returns true if there are changes
@@ -129,16 +111,7 @@ module Bundler
129
111
  @rubygems_sources, @path_sources, @git_sources, @plugin_sources = map_sources(replacement_sources)
130
112
  @global_rubygems_source = global_replacement_source(replacement_sources)
131
113
 
132
- different_sources?(lock_sources, replacement_sources)
133
- end
134
-
135
- # Returns true if there are changes
136
- def expired_sources?(replacement_sources)
137
- return false if replacement_sources.empty?
138
-
139
- lock_sources = dup_with_replaced_sources(replacement_sources).lock_sources
140
-
141
- different_sources?(lock_sources, replacement_sources)
114
+ !equivalent_sources?(lock_sources, replacement_sources)
142
115
  end
143
116
 
144
117
  def prefer_local!
@@ -165,12 +138,6 @@ module Bundler
165
138
 
166
139
  private
167
140
 
168
- def dup_with_replaced_sources(replacement_sources)
169
- new_source_list = dup
170
- new_source_list.replace_sources!(replacement_sources)
171
- new_source_list
172
- end
173
-
174
141
  def map_sources(replacement_sources)
175
142
  rubygems = @rubygems_sources.map do |source|
176
143
  replace_rubygems_source(replacement_sources, source)
@@ -224,11 +191,7 @@ module Bundler
224
191
  end
225
192
  end
226
193
 
227
- def different_sources?(lock_sources, replacement_sources)
228
- !equivalent_sources?(lock_sources, replacement_sources)
229
- end
230
-
231
- def rubygems_aggregate_class
194
+ def source_class
232
195
  Source::Rubygems
233
196
  end
234
197
 
@@ -247,10 +210,6 @@ module Bundler
247
210
  end
248
211
  end
249
212
 
250
- def combine_rubygems_sources
251
- Source::Rubygems.new("remotes" => rubygems_remotes)
252
- end
253
-
254
213
  def warn_on_git_protocol(source)
255
214
  return if Bundler.settings["git.allow_insecure"]
256
215
 
@@ -23,15 +23,12 @@ module Bundler
23
23
  if previous_source.nil?
24
24
  requirements[indirect_dependency_name] = source
25
25
  else
26
- no_ambiguous_sources = Bundler.feature_flag.bundler_4_mode?
27
-
28
26
  msg = ["The gem '#{indirect_dependency_name}' was found in multiple relevant sources."]
29
27
  msg.concat [previous_source, source].map {|s| " * #{s}" }.sort
30
- msg << "You #{no_ambiguous_sources ? :must : :should} add this gem to the source block for the source you wish it to be installed from."
28
+ msg << "You must add this gem to the source block for the source you wish it to be installed from."
31
29
  msg = msg.join("\n")
32
30
 
33
- raise SecurityError, msg if no_ambiguous_sources
34
- Bundler.ui.warn "Warning: #{msg}"
31
+ raise SecurityError, msg
35
32
  end
36
33
  end
37
34
 
@@ -11,16 +11,11 @@ module Bundler
11
11
  @specs = specs
12
12
  end
13
13
 
14
- def for(dependencies, platforms_or_legacy_check = [nil], legacy_platforms = [nil], skips: [])
15
- platforms = if [true, false].include?(platforms_or_legacy_check)
16
- Bundler::SharedHelpers.major_deprecation 2,
14
+ def for(dependencies, platforms = [nil], legacy_platforms = [nil], skips: [])
15
+ if [true, false].include?(platforms)
16
+ Bundler::SharedHelpers.feature_removed! \
17
17
  "SpecSet#for received a `check` parameter, but that's no longer used and deprecated. " \
18
- "SpecSet#for always implicitly performs validation. Please remove this parameter",
19
- print_caller_location: true
20
-
21
- legacy_platforms
22
- else
23
- platforms_or_legacy_check
18
+ "SpecSet#for always implicitly performs validation. Please remove this parameter"
24
19
  end
25
20
 
26
21
  materialize_dependencies(dependencies, platforms, skips: skips)
@@ -179,9 +174,7 @@ module Bundler
179
174
  end
180
175
 
181
176
  def -(other)
182
- SharedHelpers.major_deprecation 2, "SpecSet#- has been removed with no replacement"
183
-
184
- SpecSet.new(to_a - other.to_a)
177
+ SharedHelpers.feature_removed! "SpecSet#- has been removed with no replacement"
185
178
  end
186
179
 
187
180
  def find_by_name_and_platform(name, platform)
@@ -212,9 +205,7 @@ module Bundler
212
205
  end
213
206
 
214
207
  def <<(spec)
215
- SharedHelpers.major_deprecation 2, "SpecSet#<< has been removed with no replacement"
216
-
217
- @specs << spec
208
+ SharedHelpers.feature_removed! "SpecSet#<< has been removed with no replacement"
218
209
  end
219
210
 
220
211
  def length