rubygems-update 3.2.8 → 3.2.13

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 (43) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +42 -0
  3. data/Manifest.txt +1 -0
  4. data/Rakefile +6 -0
  5. data/bundler/CHANGELOG.md +48 -0
  6. data/bundler/lib/bundler.rb +1 -1
  7. data/bundler/lib/bundler/build_metadata.rb +2 -2
  8. data/bundler/lib/bundler/cli/gem.rb +23 -17
  9. data/bundler/lib/bundler/definition.rb +26 -29
  10. data/bundler/lib/bundler/dsl.rb +36 -22
  11. data/bundler/lib/bundler/inline.rb +1 -0
  12. data/bundler/lib/bundler/installer.rb +2 -0
  13. data/bundler/lib/bundler/lockfile_parser.rb +12 -8
  14. data/bundler/lib/bundler/man/bundle-config.1 +4 -4
  15. data/bundler/lib/bundler/man/bundle-config.1.ronn +8 -7
  16. data/bundler/lib/bundler/plugin.rb +1 -0
  17. data/bundler/lib/bundler/plugin/installer.rb +8 -10
  18. data/bundler/lib/bundler/plugin/source_list.rb +4 -0
  19. data/bundler/lib/bundler/resolver.rb +36 -38
  20. data/bundler/lib/bundler/rubygems_gem_installer.rb +47 -0
  21. data/bundler/lib/bundler/source_list.rb +15 -18
  22. data/bundler/lib/bundler/stub_specification.rb +8 -0
  23. data/bundler/lib/bundler/templates/newgem/README.md.tt +5 -3
  24. data/bundler/lib/bundler/version.rb +1 -1
  25. data/lib/rubygems.rb +2 -2
  26. data/lib/rubygems/command.rb +1 -0
  27. data/lib/rubygems/config_file.rb +9 -0
  28. data/lib/rubygems/core_ext/tcpsocket_init.rb +52 -0
  29. data/lib/rubygems/dependency.rb +5 -1
  30. data/lib/rubygems/platform.rb +7 -3
  31. data/lib/rubygems/remote_fetcher.rb +1 -0
  32. data/lib/rubygems/specification.rb +13 -11
  33. data/lib/rubygems/test_case.rb +5 -6
  34. data/rubygems-update.gemspec +1 -1
  35. data/test/rubygems/test_gem.rb +80 -8
  36. data/test/rubygems/test_gem_commands_outdated_command.rb +18 -0
  37. data/test/rubygems/test_gem_config_file.rb +10 -0
  38. data/test/rubygems/test_gem_dependency_installer.rb +2 -18
  39. data/test/rubygems/test_gem_platform.rb +29 -0
  40. data/test/rubygems/test_gem_remote_fetcher.rb +6 -0
  41. data/test/rubygems/test_gem_specification.rb +10 -15
  42. data/test/rubygems/test_gem_util.rb +4 -4
  43. metadata +4 -3
@@ -50,6 +50,7 @@ def gemfile(install = false, options = {}, &gemfile)
50
50
  Bundler::Plugin.gemfile_install(&gemfile) if Bundler.feature_flag.plugins?
51
51
  builder = Bundler::Dsl.new
52
52
  builder.instance_eval(&gemfile)
53
+ builder.check_primary_source_safety
53
54
 
54
55
  Bundler.settings.temporary(:frozen => false) do
55
56
  definition = builder.to_definition(nil, true)
@@ -89,6 +89,8 @@ module Bundler
89
89
  end
90
90
  install(options)
91
91
 
92
+ Gem::Specification.reset # invalidate gem specification cache so that installed gems are immediately available
93
+
92
94
  lock unless Bundler.frozen_bundle?
93
95
  Standalone.new(options[:standalone], @definition).generate if options[:standalone]
94
96
  end
@@ -64,8 +64,6 @@ module Bundler
64
64
  @state = nil
65
65
  @specs = {}
66
66
 
67
- @rubygems_aggregate = Source::Rubygems.new
68
-
69
67
  if lockfile.match(/<<<<<<<|=======|>>>>>>>|\|\|\|\|\|\|\|/)
70
68
  raise LockfileError, "Your #{Bundler.default_lockfile.relative_path_from(SharedHelpers.pwd)} contains merge conflicts.\n" \
71
69
  "Run `git checkout HEAD -- #{Bundler.default_lockfile.relative_path_from(SharedHelpers.pwd)}` first to get a clean lock."
@@ -89,7 +87,6 @@ module Bundler
89
87
  send("parse_#{@state}", line)
90
88
  end
91
89
  end
92
- @sources << @rubygems_aggregate unless Bundler.feature_flag.disable_multisource?
93
90
  @specs = @specs.values.sort_by(&:identifier)
94
91
  warn_for_outdated_bundler_version
95
92
  rescue ArgumentError => e
@@ -134,16 +131,19 @@ module Bundler
134
131
  @sources << @current_source
135
132
  end
136
133
  when GEM
137
- if Bundler.feature_flag.disable_multisource?
134
+ source_remotes = Array(@opts["remote"])
135
+
136
+ if source_remotes.size == 1
138
137
  @opts["remotes"] = @opts.delete("remote")
139
138
  @current_source = TYPES[@type].from_lock(@opts)
140
- @sources << @current_source
141
139
  else
142
- Array(@opts["remote"]).each do |url|
143
- @rubygems_aggregate.add_remote(url)
140
+ source_remotes.each do |url|
141
+ rubygems_aggregate.add_remote(url)
144
142
  end
145
- @current_source = @rubygems_aggregate
143
+ @current_source = rubygems_aggregate
146
144
  end
145
+
146
+ @sources << @current_source
147
147
  when PLUGIN
148
148
  @current_source = Plugin.source_from_lock(@opts)
149
149
  @sources << @current_source
@@ -245,5 +245,9 @@ module Bundler
245
245
  def parse_ruby(line)
246
246
  @ruby_version = line.strip
247
247
  end
248
+
249
+ def rubygems_aggregate
250
+ @rubygems_aggregate ||= Source::Rubygems.new
251
+ end
248
252
  end
249
253
  end
@@ -211,10 +211,10 @@ The following is a list of all configuration keys and their purpose\. You can le
211
211
  \fBignore_messages\fR (\fBBUNDLE_IGNORE_MESSAGES\fR): When set, no post install messages will be printed\. To silence a single gem, use dot notation like \fBignore_messages\.httparty true\fR\.
212
212
  .
213
213
  .IP "\(bu" 4
214
- \fBinit_gems_rb\fR (\fBBUNDLE_INIT_GEMS_RB\fR) Generate a \fBgems\.rb\fR instead of a \fBGemfile\fR when running \fBbundle init\fR\.
214
+ \fBinit_gems_rb\fR (\fBBUNDLE_INIT_GEMS_RB\fR): Generate a \fBgems\.rb\fR instead of a \fBGemfile\fR when running \fBbundle init\fR\.
215
215
  .
216
216
  .IP "\(bu" 4
217
- \fBjobs\fR (\fBBUNDLE_JOBS\fR): The number of gems Bundler can install in parallel\. Defaults to 1\.
217
+ \fBjobs\fR (\fBBUNDLE_JOBS\fR): The number of gems Bundler can install in parallel\. Defaults to 1 on Windows, and to the the number of processors on other platforms\.
218
218
  .
219
219
  .IP "\(bu" 4
220
220
  \fBno_install\fR (\fBBUNDLE_NO_INSTALL\fR): Whether \fBbundle package\fR should skip installing gems\.
@@ -241,7 +241,7 @@ The following is a list of all configuration keys and their purpose\. You can le
241
241
  \fBprefer_patch\fR (BUNDLE_PREFER_PATCH): Prefer updating only to next patch version during updates\. Makes \fBbundle update\fR calls equivalent to \fBbundler update \-\-patch\fR\.
242
242
  .
243
243
  .IP "\(bu" 4
244
- \fBprint_only_version_number\fR (\fBBUNDLE_PRINT_ONLY_VERSION_NUMBER\fR) Print only version number from \fBbundler \-\-version\fR\.
244
+ \fBprint_only_version_number\fR (\fBBUNDLE_PRINT_ONLY_VERSION_NUMBER\fR): Print only version number from \fBbundler \-\-version\fR\.
245
245
  .
246
246
  .IP "\(bu" 4
247
247
  \fBredirect\fR (\fBBUNDLE_REDIRECT\fR): The number of redirects allowed for network requests\. Defaults to \fB5\fR\.
@@ -283,7 +283,7 @@ The following is a list of all configuration keys and their purpose\. You can le
283
283
  \fBunlock_source_unlocks_spec\fR (\fBBUNDLE_UNLOCK_SOURCE_UNLOCKS_SPEC\fR): Whether running \fBbundle update \-\-source NAME\fR unlocks a gem with the given name\. Defaults to \fBtrue\fR\.
284
284
  .
285
285
  .IP "\(bu" 4
286
- \fBupdate_requires_all_flag\fR (\fBBUNDLE_UPDATE_REQUIRES_ALL_FLAG\fR) Require passing \fB\-\-all\fR to \fBbundle update\fR when everything should be updated, and disallow passing no options to \fBbundle update\fR\.
286
+ \fBupdate_requires_all_flag\fR (\fBBUNDLE_UPDATE_REQUIRES_ALL_FLAG\fR): Require passing \fB\-\-all\fR to \fBbundle update\fR when everything should be updated, and disallow passing no options to \fBbundle update\fR\.
287
287
  .
288
288
  .IP "\(bu" 4
289
289
  \fBuser_agent\fR (\fBBUNDLE_USER_AGENT\fR): The custom user agent fragment Bundler includes in API requests\.
@@ -206,13 +206,14 @@ learn more about their operation in [bundle install(1)](bundle-install.1.html).
206
206
  * `global_gem_cache` (`BUNDLE_GLOBAL_GEM_CACHE`):
207
207
  Whether Bundler should cache all gems globally, rather than locally to the
208
208
  installing Ruby installation.
209
- * `ignore_messages` (`BUNDLE_IGNORE_MESSAGES`): When set, no post install
210
- messages will be printed. To silence a single gem, use dot notation like
211
- `ignore_messages.httparty true`.
212
- * `init_gems_rb` (`BUNDLE_INIT_GEMS_RB`)
209
+ * `ignore_messages` (`BUNDLE_IGNORE_MESSAGES`):
210
+ When set, no post install messages will be printed. To silence a single gem,
211
+ use dot notation like `ignore_messages.httparty true`.
212
+ * `init_gems_rb` (`BUNDLE_INIT_GEMS_RB`):
213
213
  Generate a `gems.rb` instead of a `Gemfile` when running `bundle init`.
214
214
  * `jobs` (`BUNDLE_JOBS`):
215
- The number of gems Bundler can install in parallel. Defaults to 1.
215
+ The number of gems Bundler can install in parallel. Defaults to 1 on Windows,
216
+ and to the the number of processors on other platforms.
216
217
  * `no_install` (`BUNDLE_NO_INSTALL`):
217
218
  Whether `bundle package` should skip installing gems.
218
219
  * `no_prune` (`BUNDLE_NO_PRUNE`):
@@ -233,7 +234,7 @@ learn more about their operation in [bundle install(1)](bundle-install.1.html).
233
234
  Enable Bundler's experimental plugin system.
234
235
  * `prefer_patch` (BUNDLE_PREFER_PATCH):
235
236
  Prefer updating only to next patch version during updates. Makes `bundle update` calls equivalent to `bundler update --patch`.
236
- * `print_only_version_number` (`BUNDLE_PRINT_ONLY_VERSION_NUMBER`)
237
+ * `print_only_version_number` (`BUNDLE_PRINT_ONLY_VERSION_NUMBER`):
237
238
  Print only version number from `bundler --version`.
238
239
  * `redirect` (`BUNDLE_REDIRECT`):
239
240
  The number of redirects allowed for network requests. Defaults to `5`.
@@ -269,7 +270,7 @@ learn more about their operation in [bundle install(1)](bundle-install.1.html).
269
270
  * `unlock_source_unlocks_spec` (`BUNDLE_UNLOCK_SOURCE_UNLOCKS_SPEC`):
270
271
  Whether running `bundle update --source NAME` unlocks a gem with the given
271
272
  name. Defaults to `true`.
272
- * `update_requires_all_flag` (`BUNDLE_UPDATE_REQUIRES_ALL_FLAG`)
273
+ * `update_requires_all_flag` (`BUNDLE_UPDATE_REQUIRES_ALL_FLAG`):
273
274
  Require passing `--all` to `bundle update` when everything should be updated,
274
275
  and disallow passing no options to `bundle update`.
275
276
  * `user_agent` (`BUNDLE_USER_AGENT`):
@@ -105,6 +105,7 @@ module Bundler
105
105
  else
106
106
  builder.eval_gemfile(gemfile)
107
107
  end
108
+ builder.check_primary_source_safety
108
109
  definition = builder.to_definition(nil, true)
109
110
 
110
111
  return if definition.dependencies.empty?
@@ -16,15 +16,13 @@ module Bundler
16
16
 
17
17
  version = options[:version] || [">= 0"]
18
18
 
19
- Bundler.settings.temporary(:disable_multisource => false) do
20
- if options[:git]
21
- install_git(names, version, options)
22
- elsif options[:local_git]
23
- install_local_git(names, version, options)
24
- else
25
- sources = options[:source] || Bundler.rubygems.sources
26
- install_rubygems(names, version, sources)
27
- end
19
+ if options[:git]
20
+ install_git(names, version, options)
21
+ elsif options[:local_git]
22
+ install_local_git(names, version, options)
23
+ else
24
+ sources = options[:source] || Bundler.rubygems.sources
25
+ install_rubygems(names, version, sources)
28
26
  end
29
27
  end
30
28
 
@@ -79,7 +77,7 @@ module Bundler
79
77
  source_list = SourceList.new
80
78
 
81
79
  source_list.add_git_source(git_source_options) if git_source_options
82
- source_list.add_rubygems_source("remotes" => rubygems_source) if rubygems_source
80
+ source_list.global_rubygems_source = rubygems_source if rubygems_source
83
81
 
84
82
  deps = names.map {|name| Dependency.new name, version }
85
83
 
@@ -17,6 +17,10 @@ module Bundler
17
17
  path_sources + git_sources + rubygems_sources + [metadata_source]
18
18
  end
19
19
 
20
+ def default_source
21
+ git_sources.first || global_rubygems_source
22
+ end
23
+
20
24
  private
21
25
 
22
26
  def rubygems_aggregate_class
@@ -17,16 +17,21 @@ module Bundler
17
17
  # ==== Returns
18
18
  # <GemBundle>,nil:: If the list of dependencies can be resolved, a
19
19
  # collection of gemspecs is returned. Otherwise, nil is returned.
20
- def self.resolve(requirements, index, source_requirements = {}, base = [], gem_version_promoter = GemVersionPromoter.new, additional_base_requirements = [], platforms = nil)
20
+ def self.resolve(requirements, source_requirements = {}, base = [], gem_version_promoter = GemVersionPromoter.new, additional_base_requirements = [], platforms = nil)
21
21
  base = SpecSet.new(base) unless base.is_a?(SpecSet)
22
- resolver = new(index, source_requirements, base, gem_version_promoter, additional_base_requirements, platforms)
22
+ resolver = new(source_requirements, base, gem_version_promoter, additional_base_requirements, platforms)
23
23
  result = resolver.start(requirements)
24
24
  SpecSet.new(result)
25
25
  end
26
26
 
27
- def initialize(index, source_requirements, base, gem_version_promoter, additional_base_requirements, platforms)
28
- @index = index
27
+ def initialize(source_requirements, base, gem_version_promoter, additional_base_requirements, platforms)
29
28
  @source_requirements = source_requirements
29
+
30
+ @index_requirements = source_requirements.each_with_object({}) do |source_requirement, index_requirements|
31
+ name, source = source_requirement
32
+ index_requirements[name] = name == :global ? source : source.specs
33
+ end
34
+
30
35
  @base = base
31
36
  @resolver = Molinillo::Resolver.new(self, self)
32
37
  @search_for = {}
@@ -36,14 +41,14 @@ module Bundler
36
41
  @base_dg.add_vertex(ls.name, DepProxy.get_proxy(dep, ls.platform), true)
37
42
  end
38
43
  additional_base_requirements.each {|d| @base_dg.add_vertex(d.name, d) }
39
- @platforms = platforms
44
+ @platforms = platforms.reject {|p| p != Gem::Platform::RUBY && (platforms - [p]).any? {|pl| generic(pl) == p } }
40
45
  @resolving_only_for_ruby = platforms == [Gem::Platform::RUBY]
41
46
  @gem_version_promoter = gem_version_promoter
42
47
  @use_gvp = Bundler.feature_flag.use_gem_version_promoter_for_major_updates? || !@gem_version_promoter.major?
43
- @lockfile_uses_separate_rubygems_sources = Bundler.feature_flag.disable_multisource?
48
+ @no_aggregate_global_source = @source_requirements[:global].nil?
44
49
 
45
50
  @variant_specific_names = []
46
- @generic_names = []
51
+ @generic_names = ["Ruby\0", "RubyGems\0"]
47
52
  end
48
53
 
49
54
  def start(requirements)
@@ -125,8 +130,7 @@ module Bundler
125
130
  dependency = dependency_proxy.dep
126
131
  name = dependency.name
127
132
  search_result = @search_for[dependency_proxy] ||= begin
128
- index = index_for(dependency)
129
- results = index.search(dependency, @base[name])
133
+ results = results_for(dependency, @base[name])
130
134
 
131
135
  if vertex = @base_dg.vertex_named(name)
132
136
  locked_requirement = vertex.payload.requirement
@@ -196,22 +200,22 @@ module Bundler
196
200
  end
197
201
 
198
202
  def index_for(dependency)
199
- source = @source_requirements[dependency.name]
203
+ source = @index_requirements[dependency.name]
200
204
  if source
201
- source.specs
202
- elsif @lockfile_uses_separate_rubygems_sources
205
+ source
206
+ elsif @no_aggregate_global_source
203
207
  Index.build do |idx|
204
- if dependency.all_sources
205
- dependency.all_sources.each {|s| idx.add_source(s.specs) if s }
206
- else
207
- idx.add_source @source_requirements[:default].specs
208
- end
208
+ dependency.all_sources.each {|s| idx.add_source(s.specs) }
209
209
  end
210
210
  else
211
- @index
211
+ @index_requirements[:global]
212
212
  end
213
213
  end
214
214
 
215
+ def results_for(dependency, base)
216
+ index_for(dependency).search(dependency, base)
217
+ end
218
+
215
219
  def name_for(dependency)
216
220
  dependency.name
217
221
  end
@@ -239,18 +243,20 @@ module Bundler
239
243
  def relevant_sources_for_vertex(vertex)
240
244
  if vertex.root?
241
245
  [@source_requirements[vertex.name]]
242
- elsif @lockfile_uses_separate_rubygems_sources
246
+ elsif @no_aggregate_global_source
243
247
  vertex.recursive_predecessors.map do |v|
244
248
  @source_requirements[v.name]
245
- end << @source_requirements[:default]
249
+ end.compact << @source_requirements[:default]
250
+ else
251
+ []
246
252
  end
247
253
  end
248
254
 
249
255
  def sort_dependencies(dependencies, activated, conflicts)
250
256
  dependencies.sort_by do |dependency|
251
- dependency.all_sources = relevant_sources_for_vertex(activated.vertex_named(dependency.name))
252
257
  name = name_for(dependency)
253
258
  vertex = activated.vertex_named(name)
259
+ dependency.all_sources = relevant_sources_for_vertex(vertex)
254
260
  [
255
261
  @base_dg.vertex_named(name) ? 0 : 1,
256
262
  vertex.payload ? 0 : 1,
@@ -317,7 +323,7 @@ module Bundler
317
323
  "If you are updating multiple gems in your Gemfile at once,\n" \
318
324
  "try passing them all to `bundle update`"
319
325
  elsif source = @source_requirements[name]
320
- specs = source.specs[name]
326
+ specs = source.specs.search(name)
321
327
  versions_with_platforms = specs.map {|s| [s.version, s.platform] }
322
328
  message = String.new("Could not find gem '#{SharedHelpers.pretty_dependency(requirement)}' in #{source}#{cache_message}.\n")
323
329
  message << if versions_with_platforms.any?
@@ -326,7 +332,7 @@ module Bundler
326
332
  "The source does not contain any versions of '#{name}'"
327
333
  end
328
334
  else
329
- message = "Could not find gem '#{requirement}' in any of the gem sources " \
335
+ message = "Could not find gem '#{SharedHelpers.pretty_dependency(requirement)}' in any of the gem sources " \
330
336
  "listed in your Gemfile#{cache_message}."
331
337
  end
332
338
  raise GemNotFound, message
@@ -392,7 +398,7 @@ module Bundler
392
398
  if other_bundler_required
393
399
  o << "\n\n"
394
400
 
395
- candidate_specs = @source_requirements[:default_bundler].specs.search(conflict_dependency)
401
+ candidate_specs = @index_requirements[:default_bundler].search(conflict_dependency)
396
402
  if candidate_specs.any?
397
403
  target_version = candidate_specs.last.version
398
404
  new_command = [File.basename($PROGRAM_NAME), "_#{target_version}_", *ARGV].join(" ")
@@ -411,14 +417,8 @@ module Bundler
411
417
 
412
418
  relevant_sources = if conflict.requirement.source
413
419
  [conflict.requirement.source]
414
- elsif conflict.requirement.all_sources
415
- conflict.requirement.all_sources
416
- elsif @lockfile_uses_separate_rubygems_sources
417
- # every conflict should have an explicit group of sources when we
418
- # enforce strict pinning
419
- raise "no source set for #{conflict}"
420
420
  else
421
- []
421
+ conflict.requirement.all_sources
422
422
  end.compact.map(&:to_s).uniq.sort
423
423
 
424
424
  metadata_requirement = name.end_with?("\0")
@@ -455,23 +455,21 @@ module Bundler
455
455
  def validate_resolved_specs!(resolved_specs)
456
456
  resolved_specs.each do |v|
457
457
  name = v.name
458
- next unless sources = relevant_sources_for_vertex(v)
459
- sources.compact!
458
+ sources = relevant_sources_for_vertex(v)
459
+ next unless sources.any?
460
460
  if default_index = sources.index(@source_requirements[:default])
461
461
  sources.delete_at(default_index)
462
462
  end
463
- sources.reject! {|s| s.specs[name].empty? }
463
+ sources.reject! {|s| s.specs.search(name).empty? }
464
464
  sources.uniq!
465
465
  next if sources.size <= 1
466
466
 
467
- multisource_disabled = Bundler.feature_flag.disable_multisource?
468
-
469
467
  msg = ["The gem '#{name}' was found in multiple relevant sources."]
470
468
  msg.concat sources.map {|s| " * #{s}" }.sort
471
- msg << "You #{multisource_disabled ? :must : :should} add this gem to the source block for the source you wish it to be installed from."
469
+ msg << "You #{@no_aggregate_global_source ? :must : :should} add this gem to the source block for the source you wish it to be installed from."
472
470
  msg = msg.join("\n")
473
471
 
474
- raise SecurityError, msg if multisource_disabled
472
+ raise SecurityError, msg if @no_aggregate_global_source
475
473
  Bundler.ui.warn "Warning: #{msg}"
476
474
  end
477
475
  end
@@ -8,6 +8,53 @@ module Bundler
8
8
  # Bundler needs to install gems regardless of binstub overwriting
9
9
  end
10
10
 
11
+ def install
12
+ pre_install_checks
13
+
14
+ run_pre_install_hooks
15
+
16
+ spec.loaded_from = spec_file
17
+
18
+ # Completely remove any previous gem files
19
+ FileUtils.rm_rf gem_dir
20
+ FileUtils.rm_rf spec.extension_dir
21
+
22
+ FileUtils.mkdir_p gem_dir, :mode => 0o755
23
+
24
+ extract_files
25
+
26
+ build_extensions
27
+ write_build_info_file
28
+ run_post_build_hooks
29
+
30
+ generate_bin
31
+ generate_plugins
32
+
33
+ write_spec
34
+ write_cache_file
35
+
36
+ say spec.post_install_message unless spec.post_install_message.nil?
37
+
38
+ run_post_install_hooks
39
+
40
+ spec
41
+ end
42
+
43
+ def generate_plugins
44
+ return unless Gem::Installer.instance_methods(false).include?(:generate_plugins)
45
+
46
+ latest = Gem::Specification.stubs_for(spec.name).first
47
+ return if latest && latest.version > spec.version
48
+
49
+ ensure_writable_dir @plugins_dir
50
+
51
+ if spec.plugins.empty?
52
+ remove_plugins_for(spec, @plugins_dir)
53
+ else
54
+ regenerate_plugins_for(spec, @plugins_dir)
55
+ end
56
+ end
57
+
11
58
  def pre_install_checks
12
59
  super && validate_bundler_checksum(options[:bundler_expected_checksum])
13
60
  end
@@ -5,15 +5,19 @@ module Bundler
5
5
  attr_reader :path_sources,
6
6
  :git_sources,
7
7
  :plugin_sources,
8
- :global_rubygems_source,
8
+ :global_path_source,
9
9
  :metadata_source
10
10
 
11
+ def global_rubygems_source
12
+ @global_rubygems_source ||= rubygems_aggregate_class.new
13
+ end
14
+
11
15
  def initialize
12
16
  @path_sources = []
13
17
  @git_sources = []
14
18
  @plugin_sources = []
15
19
  @global_rubygems_source = nil
16
- @rubygems_aggregate = rubygems_aggregate_class.new
20
+ @global_path_source = nil
17
21
  @rubygems_sources = []
18
22
  @metadata_source = Source::Metadata.new
19
23
  end
@@ -22,7 +26,9 @@ module Bundler
22
26
  if options["gemspec"]
23
27
  add_source_to_list Source::Gemspec.new(options), path_sources
24
28
  else
25
- add_source_to_list Source::Path.new(options), path_sources
29
+ path_source = add_source_to_list Source::Path.new(options), path_sources
30
+ @global_path_source ||= path_source if options["global"]
31
+ path_source
26
32
  end
27
33
  end
28
34
 
@@ -41,24 +47,20 @@ module Bundler
41
47
  end
42
48
 
43
49
  def global_rubygems_source=(uri)
44
- if Bundler.feature_flag.disable_multisource?
45
- @global_rubygems_source ||= rubygems_aggregate_class.new("remotes" => uri)
46
- end
47
- add_rubygems_remote(uri)
50
+ @global_rubygems_source ||= rubygems_aggregate_class.new("remotes" => uri)
48
51
  end
49
52
 
50
53
  def add_rubygems_remote(uri)
51
- return if Bundler.feature_flag.disable_multisource?
52
- @rubygems_aggregate.add_remote(uri)
53
- @rubygems_aggregate
54
+ global_rubygems_source.add_remote(uri)
55
+ global_rubygems_source
54
56
  end
55
57
 
56
58
  def default_source
57
- global_rubygems_source || @rubygems_aggregate
59
+ global_path_source || global_rubygems_source
58
60
  end
59
61
 
60
62
  def rubygems_sources
61
- @rubygems_sources + [default_source]
63
+ @rubygems_sources + [global_rubygems_source]
62
64
  end
63
65
 
64
66
  def rubygems_remotes
@@ -94,10 +96,9 @@ module Bundler
94
96
 
95
97
  replacement_rubygems = !Bundler.feature_flag.disable_multisource? &&
96
98
  replacement_sources.detect {|s| s.is_a?(Source::Rubygems) }
97
- @rubygems_aggregate = replacement_rubygems if replacement_rubygems
99
+ @global_rubygems_source = replacement_rubygems if replacement_rubygems
98
100
 
99
101
  return true if !equal_sources?(lock_sources, replacement_sources) && !equivalent_sources?(lock_sources, replacement_sources)
100
- return true if replacement_rubygems && rubygems_remotes.sort_by(&:to_s) != replacement_rubygems.remotes.sort_by(&:to_s)
101
102
 
102
103
  false
103
104
  end
@@ -110,10 +111,6 @@ module Bundler
110
111
  all_sources.each(&:remote!)
111
112
  end
112
113
 
113
- def rubygems_primary_remotes
114
- @rubygems_aggregate.remotes
115
- end
116
-
117
114
  private
118
115
 
119
116
  def rubygems_aggregate_class