rubygems-update 3.2.11 → 3.2.16

Sign up to get free protection for your applications and to get access to all the features.
Files changed (80) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +41 -0
  3. data/Manifest.txt +1 -0
  4. data/Rakefile +11 -6
  5. data/bundler/CHANGELOG.md +57 -0
  6. data/bundler/lib/bundler/build_metadata.rb +2 -2
  7. data/bundler/lib/bundler/cli.rb +1 -0
  8. data/bundler/lib/bundler/cli/common.rb +13 -2
  9. data/bundler/lib/bundler/cli/gem.rb +31 -17
  10. data/bundler/lib/bundler/cli/outdated.rb +1 -1
  11. data/bundler/lib/bundler/compact_index_client/updater.rb +1 -1
  12. data/bundler/lib/bundler/definition.rb +48 -31
  13. data/bundler/lib/bundler/dsl.rb +36 -25
  14. data/bundler/lib/bundler/feature_flag.rb +0 -1
  15. data/bundler/lib/bundler/gem_helper.rb +16 -0
  16. data/bundler/lib/bundler/inline.rb +1 -0
  17. data/bundler/lib/bundler/installer.rb +2 -0
  18. data/bundler/lib/bundler/installer/parallel_installer.rb +36 -15
  19. data/bundler/lib/bundler/lazy_specification.rb +6 -1
  20. data/bundler/lib/bundler/lockfile_parser.rb +3 -13
  21. data/bundler/lib/bundler/man/bundle-add.1 +1 -1
  22. data/bundler/lib/bundler/man/bundle-binstubs.1 +1 -1
  23. data/bundler/lib/bundler/man/bundle-cache.1 +1 -1
  24. data/bundler/lib/bundler/man/bundle-check.1 +1 -1
  25. data/bundler/lib/bundler/man/bundle-clean.1 +1 -1
  26. data/bundler/lib/bundler/man/bundle-config.1 +4 -4
  27. data/bundler/lib/bundler/man/bundle-config.1.ronn +4 -3
  28. data/bundler/lib/bundler/man/bundle-doctor.1 +1 -1
  29. data/bundler/lib/bundler/man/bundle-exec.1 +1 -1
  30. data/bundler/lib/bundler/man/bundle-gem.1 +1 -1
  31. data/bundler/lib/bundler/man/bundle-info.1 +1 -1
  32. data/bundler/lib/bundler/man/bundle-init.1 +1 -1
  33. data/bundler/lib/bundler/man/bundle-inject.1 +1 -1
  34. data/bundler/lib/bundler/man/bundle-install.1 +1 -1
  35. data/bundler/lib/bundler/man/bundle-list.1 +1 -1
  36. data/bundler/lib/bundler/man/bundle-lock.1 +1 -1
  37. data/bundler/lib/bundler/man/bundle-open.1 +1 -1
  38. data/bundler/lib/bundler/man/bundle-outdated.1 +1 -1
  39. data/bundler/lib/bundler/man/bundle-platform.1 +1 -1
  40. data/bundler/lib/bundler/man/bundle-pristine.1 +1 -1
  41. data/bundler/lib/bundler/man/bundle-remove.1 +1 -1
  42. data/bundler/lib/bundler/man/bundle-show.1 +1 -1
  43. data/bundler/lib/bundler/man/bundle-update.1 +1 -1
  44. data/bundler/lib/bundler/man/bundle-viz.1 +1 -1
  45. data/bundler/lib/bundler/man/bundle.1 +1 -1
  46. data/bundler/lib/bundler/man/gemfile.5 +1 -1
  47. data/bundler/lib/bundler/plugin.rb +1 -0
  48. data/bundler/lib/bundler/plugin/api/source.rb +7 -0
  49. data/bundler/lib/bundler/plugin/installer.rb +8 -10
  50. data/bundler/lib/bundler/plugin/source_list.rb +4 -0
  51. data/bundler/lib/bundler/resolver.rb +34 -36
  52. data/bundler/lib/bundler/rubygems_gem_installer.rb +47 -0
  53. data/bundler/lib/bundler/settings.rb +0 -1
  54. data/bundler/lib/bundler/source.rb +6 -0
  55. data/bundler/lib/bundler/source/metadata.rb +0 -4
  56. data/bundler/lib/bundler/source/path.rb +3 -1
  57. data/bundler/lib/bundler/source/path/installer.rb +1 -1
  58. data/bundler/lib/bundler/source/rubygems.rb +20 -4
  59. data/bundler/lib/bundler/source_list.rb +28 -21
  60. data/bundler/lib/bundler/spec_set.rb +2 -0
  61. data/bundler/lib/bundler/stub_specification.rb +8 -0
  62. data/bundler/lib/bundler/templates/newgem/README.md.tt +5 -3
  63. data/bundler/lib/bundler/templates/newgem/github/workflows/main.yml.tt +2 -4
  64. data/bundler/lib/bundler/vendor/tmpdir/lib/tmpdir.rb +1 -1
  65. data/bundler/lib/bundler/version.rb +1 -1
  66. data/lib/rubygems.rb +1 -1
  67. data/lib/rubygems/commands/update_command.rb +21 -3
  68. data/lib/rubygems/core_ext/tcpsocket_init.rb +4 -1
  69. data/lib/rubygems/installer.rb +5 -2
  70. data/lib/rubygems/package.rb +1 -8
  71. data/lib/rubygems/remote_fetcher.rb +3 -8
  72. data/lib/rubygems/security/trust_dir.rb +1 -0
  73. data/rubygems-update.gemspec +1 -1
  74. data/test/rubygems/packages/ascii_binder-0.1.10.1.gem +0 -0
  75. data/test/rubygems/test_gem.rb +2 -8
  76. data/test/rubygems/test_gem_commands_update_command.rb +28 -1
  77. data/test/rubygems/test_gem_installer.rb +20 -0
  78. data/test/rubygems/test_gem_package.rb +1 -1
  79. data/test/rubygems/test_gem_remote_fetcher.rb +38 -6
  80. metadata +4 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 027ee31fe24ec2094fdc8bcfecae4261c36ce412a813b2d0c68376679de49d26
4
- data.tar.gz: deb4ea6deab65dc34df00c5836443743ed0ae367fc191dc2050ecc598fc76fc1
3
+ metadata.gz: ccd219adf38f48a5bf473e99fc307d14829f6fcef8cd1a74cf1da058ab7e82a0
4
+ data.tar.gz: fb9a36d286fcb7dd940495c5abdbe92bc5008ab736ebc581568b12e46984e746
5
5
  SHA512:
6
- metadata.gz: 0f876e2acbd22963c1a5cd0e799bd34c801c6751293030c715d1eb4d0faddc010fe6c9b353e9d0ce1540f601773b4e295d3b16ee3d597dcbe36867509f977e5d
7
- data.tar.gz: 21e3b99cc9733a4ce41e0aac1c5f97dac2053b87f58388dfabf8658c5bdd506484c4576e96137fa968f89aea368a81ff4f4ca9e5a141b6de72e4cadbc7129efb
6
+ metadata.gz: 6fb98ef231fdb44f615927ff27be6b92b42306eb5f4a89df105775dbe45d632c596fb5f41359a94b6488952a595f7707bf29811d228732125edb638616185aef
7
+ data.tar.gz: 90aa71948495dd12cbcf701827e85a523521dbe08774729e4de857a60c9be2c180781fa98172100a71025169690f7f9ffffa82ca30d288b421c7f59691c501ec
data/CHANGELOG.md CHANGED
@@ -1,3 +1,44 @@
1
+ # 3.2.16 / 2021-04-08
2
+
3
+ ## Bug fixes:
4
+
5
+ * Correctly handle symlinks. Pull request #2836 by voxik
6
+
7
+ # 3.2.15 / 2021-03-19
8
+
9
+ ## Enhancements:
10
+
11
+ * Prevent downgrades to untested rubygems versions. Pull request #4460 by
12
+ deivid-rodriguez
13
+
14
+ ## Bug fixes:
15
+
16
+ * Fix missing require breaking `gem cert`. Pull request #4464 by lukehinds
17
+
18
+ # 3.2.14 / 2021-03-08
19
+
20
+ ## Enhancements:
21
+
22
+ * Less wrapping of network errors. Pull request #4064 by deivid-rodriguez
23
+
24
+ ## Bug fixes:
25
+
26
+ * Revert addition of support for `musl` variants to restore graceful
27
+ fallback on Alpine. Pull request #4434 by deivid-rodriguez
28
+
29
+ # 3.2.13 / 2021-03-03
30
+
31
+ ## Bug fixes:
32
+
33
+ * Support non-gnu libc linux platforms. Pull request #4082 by lloeki
34
+
35
+ # 3.2.12 / 2021-03-01
36
+
37
+ ## Bug fixes:
38
+
39
+ * Restore the ability to manually install extension gems. Pull request
40
+ #4384 by cfis
41
+
1
42
  # 3.2.11 / 2021-02-17
2
43
 
3
44
  ## Enhancements:
data/Manifest.txt CHANGED
@@ -535,6 +535,7 @@ test/rubygems/invalid_signer_cert_32.pem
535
535
  test/rubygems/invalidchild_cert.pem
536
536
  test/rubygems/invalidchild_cert_32.pem
537
537
  test/rubygems/invalidchild_key.pem
538
+ test/rubygems/packages/ascii_binder-0.1.10.1.gem
538
539
  test/rubygems/plugin/exception/rubygems_plugin.rb
539
540
  test/rubygems/plugin/load/rubygems_plugin.rb
540
541
  test/rubygems/plugin/standarderror/rubygems_plugin.rb
data/Rakefile CHANGED
@@ -7,12 +7,20 @@ require 'psych'
7
7
 
8
8
  desc "Setup Rubygems dev environment"
9
9
  task :setup do
10
- sh "ruby", "bundler/bin/bundle", "install", "--gemfile=dev_gems.rb"
10
+ sh "ruby", "bundler/spec/support/bundle.rb", "install", "--gemfile=dev_gems.rb"
11
11
  end
12
12
 
13
13
  desc "Update Rubygems dev environment"
14
14
  task :update do |_, args|
15
- sh "ruby", "bundler/bin/bundle", "update", *args, "--gemfile=dev_gems.rb"
15
+ sh "ruby", "bundler/spec/support/bundle.rb", "update", *args, "--gemfile=dev_gems.rb"
16
+ end
17
+
18
+ desc "Update the locked bundler version in dev environment"
19
+ task :update_locked_bundler do |_, args|
20
+ sh "ruby", "bundler/spec/support/bundle.rb", "update", "--bundler", "--gemfile=dev_gems.rb"
21
+ sh "ruby", "bundler/spec/support/bundle.rb", "update", "--bundler", "--gemfile=bundler/tool/bundler/test_gems.rb"
22
+ sh "ruby", "bundler/spec/support/bundle.rb", "update", "--bundler", "--gemfile=bundler/tool/bundler/rubocop_gems.rb"
23
+ sh "ruby", "bundler/spec/support/bundle.rb", "update", "--bundler", "--gemfile=bundler/tool/bundler/rubocop23_gems.rb"
16
24
  end
17
25
 
18
26
  desc "Setup git hooks"
@@ -236,15 +244,12 @@ namespace 'guides' do
236
244
  desc 'Updates and publishes the guides for the just-released RubyGems'
237
245
  task 'publish'
238
246
 
239
- on_master = `git branch --list master`.strip == '* master'
240
- on_master = true if ENV['FORCE']
241
-
242
247
  task 'publish' => %w[
243
248
  guides:pull
244
249
  guides:update
245
250
  guides:commit
246
251
  guides:push
247
- ] if on_master
252
+ ]
248
253
  end
249
254
 
250
255
  directory '../blog.rubygems.org' do
data/bundler/CHANGELOG.md CHANGED
@@ -1,3 +1,60 @@
1
+ # 2.2.16 (April 8, 2021)
2
+
3
+ ## Enhancements:
4
+
5
+ - Add `--github-username` option and config to `bundle gem` [#3687](https://github.com/rubygems/rubygems/pull/3687)
6
+ - Bump vendored `tmpdir` library copy [#4506](https://github.com/rubygems/rubygems/pull/4506)
7
+ - Add `rake build:checksum` task to build cheksums for a gem package [#4156](https://github.com/rubygems/rubygems/pull/4156)
8
+ - Enable bundler-cache for GitHub Actions template [#4498](https://github.com/rubygems/rubygems/pull/4498)
9
+ - Improve `bundle info` error when gem is on a "disabled" group [#4492](https://github.com/rubygems/rubygems/pull/4492)
10
+ - Small tweak to yank message [#4494](https://github.com/rubygems/rubygems/pull/4494)
11
+ - Don't show duplicate entries in `bundle outdated` output [#4474](https://github.com/rubygems/rubygems/pull/4474)
12
+ - Never downgrade top level gems when running `bundle update` [#4473](https://github.com/rubygems/rubygems/pull/4473)
13
+
14
+ ## Bug fixes:
15
+
16
+ - Fix incorrect logic for filtering metadata matching candidates [#4497](https://github.com/rubygems/rubygems/pull/4497)
17
+
18
+ # 2.2.15 (March 19, 2021)
19
+
20
+ ## Enhancements:
21
+
22
+ - Add a hint about bundler installing executables for path gems [#4461](https://github.com/rubygems/rubygems/pull/4461)
23
+ - Warn lockfiles with incorrect resolutions [#4459](https://github.com/rubygems/rubygems/pull/4459)
24
+ - Don't generate duplicate redundant sources in the lockfile [#4456](https://github.com/rubygems/rubygems/pull/4456)
25
+
26
+ ## Bug fixes:
27
+
28
+ - Respect running ruby when resolving platforms [#4449](https://github.com/rubygems/rubygems/pull/4449)
29
+
30
+ # 2.2.14 (March 8, 2021)
31
+
32
+ ## Security fixes:
33
+
34
+ - Lock GEM sources separately and fix locally installed specs confusing bundler [#4381](https://github.com/rubygems/rubygems/pull/4381)
35
+
36
+ ## Bug fixes:
37
+
38
+ - Make `rake` available to other gems' installers right after it's installed [#4428](https://github.com/rubygems/rubygems/pull/4428)
39
+ - Fix encoding issue on compact index updater [#4362](https://github.com/rubygems/rubygems/pull/4362)
40
+
41
+ # 2.2.13 (March 3, 2021)
42
+
43
+ ## Enhancements:
44
+
45
+ - Respect user configured default branch in README links in new generated gems [#4303](https://github.com/rubygems/rubygems/pull/4303)
46
+
47
+ ## Bug fixes:
48
+
49
+ - Fix gems sometimes being pulled from irrelevant sources [#4418](https://github.com/rubygems/rubygems/pull/4418)
50
+
51
+ # 2.2.12 (March 1, 2021)
52
+
53
+ ## Bug fixes:
54
+
55
+ - Fix sporadic warnings about `nil` gemspec on install/update and make those faster [#4409](https://github.com/rubygems/rubygems/pull/4409)
56
+ - Fix deployment install with duplicate path gems added to Gemfile [#4410](https://github.com/rubygems/rubygems/pull/4410)
57
+
1
58
  # 2.2.11 (February 17, 2021)
2
59
 
3
60
  ## Bug fixes:
@@ -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 = "2021-02-17".freeze
8
- @git_commit_sha = "6ca677a0eb".freeze
7
+ @built_at = "2021-04-09".freeze
8
+ @git_commit_sha = "3d7bfaff25".freeze
9
9
  @release = true
10
10
  # end ivars
11
11
 
@@ -591,6 +591,7 @@ module Bundler
591
591
  :desc => "Generate a test directory for your library, either rspec, minitest or test-unit. Set a default with `bundle config set --global gem.test (rspec|minitest|test-unit)`."
592
592
  method_option :ci, :type => :string, :lazy_default => Bundler.settings["gem.ci"] || "",
593
593
  :desc => "Generate CI configuration, either GitHub Actions, Travis CI, GitLab CI or CircleCI. Set a default with `bundle config set --global gem.ci (github|travis|gitlab|circle)`"
594
+ method_option :github_username, :type => :string, :default => Bundler.settings["gem.github_username"], :banner => "Set your username on GitHub", :desc => "Fill in GitHub username on README so that you don't have to do it manually. Set a default with `bundle config set --global gem.github_username <your_username>`."
594
595
 
595
596
  def gem(name)
596
597
  end
@@ -36,10 +36,15 @@ module Bundler
36
36
  def self.without_groups_message(command)
37
37
  command_in_past_tense = command == :install ? "installed" : "updated"
38
38
  groups = Bundler.settings[:without]
39
+ "Gems in the #{verbalize_groups(groups)} were not #{command_in_past_tense}."
40
+ end
41
+
42
+ def self.verbalize_groups(groups)
43
+ groups.map!{|g| "'#{g}'" }
39
44
  group_list = [groups[0...-1].join(", "), groups[-1..-1]].
40
45
  reject {|s| s.to_s.empty? }.join(" and ")
41
46
  group_str = groups.size == 1 ? "group" : "groups"
42
- "Gems in the #{group_str} #{group_list} were not #{command_in_past_tense}."
47
+ "#{group_str} #{group_list}"
43
48
  end
44
49
 
45
50
  def self.select_spec(name, regex_match = nil)
@@ -53,7 +58,13 @@ module Bundler
53
58
 
54
59
  case specs.count
55
60
  when 0
56
- raise GemNotFound, gem_not_found_message(name, Bundler.definition.dependencies)
61
+ dep_in_other_group = Bundler.definition.current_dependencies.find {|dep|dep.name == name }
62
+
63
+ if dep_in_other_group
64
+ raise GemNotFound, "Could not find gem '#{name}', because it's in the #{verbalize_groups(dep_in_other_group.groups)}, configured to be ignored."
65
+ else
66
+ raise GemNotFound, gem_not_found_message(name, Bundler.definition.dependencies)
67
+ end
57
68
  when 1
58
69
  specs.first
59
70
  else
@@ -39,11 +39,19 @@ module Bundler
39
39
  constant_name = name.gsub(/-[_-]*(?![_-]|$)/) { "::" }.gsub(/([_-]+|(::)|^)(.|$)/) { $2.to_s + $3.upcase }
40
40
  constant_array = constant_name.split("::")
41
41
 
42
- git_installed = Bundler.git_present?
42
+ use_git = Bundler.git_present? && options[:git]
43
43
 
44
- git_author_name = git_installed ? `git config user.name`.chomp : ""
45
- github_username = git_installed ? `git config github.user`.chomp : ""
46
- git_user_email = git_installed ? `git config user.email`.chomp : ""
44
+ git_author_name = use_git ? `git config user.name`.chomp : ""
45
+ git_username = use_git ? `git config github.user`.chomp : ""
46
+ git_user_email = use_git ? `git config user.email`.chomp : ""
47
+
48
+ github_username = if options[:github_username].nil?
49
+ git_username
50
+ elsif options[:github_username] == false
51
+ ""
52
+ else
53
+ options[:github_username]
54
+ end
47
55
 
48
56
  config = {
49
57
  :name => name,
@@ -58,6 +66,7 @@ module Bundler
58
66
  :ext => options[:ext],
59
67
  :exe => options[:exe],
60
68
  :bundler_version => bundler_dependency_version,
69
+ :git => use_git,
61
70
  :github_username => github_username.empty? ? "[USERNAME]" : github_username,
62
71
  :required_ruby_version => Gem.ruby_version < Gem::Version.new("2.4.a") ? "2.3.0" : "2.4.0",
63
72
  }
@@ -79,7 +88,7 @@ module Bundler
79
88
  bin/setup
80
89
  ]
81
90
 
82
- templates.merge!("gitignore.tt" => ".gitignore") if Bundler.git_present?
91
+ templates.merge!("gitignore.tt" => ".gitignore") if use_git
83
92
 
84
93
  if test_framework = ask_and_set_test_framework
85
94
  config[:test] = test_framework
@@ -175,24 +184,31 @@ module Bundler
175
184
  )
176
185
  end
177
186
 
187
+ if File.exist?(target) && !File.directory?(target)
188
+ Bundler.ui.error "Couldn't create a new gem named `#{gem_name}` because there's an existing file named `#{gem_name}`."
189
+ exit Bundler::BundlerError.all_errors[Bundler::GenericSystemCallError]
190
+ end
191
+
192
+ if use_git
193
+ Bundler.ui.info "Initializing git repo in #{target}"
194
+ `git init #{target}`
195
+
196
+ config[:git_default_branch] = File.read("#{target}/.git/HEAD").split("/").last.chomp
197
+ end
198
+
178
199
  templates.each do |src, dst|
179
200
  destination = target.join(dst)
180
- SharedHelpers.filesystem_access(destination) do
181
- thor.template("newgem/#{src}", destination, config)
182
- end
201
+ thor.template("newgem/#{src}", destination, config)
183
202
  end
184
203
 
185
204
  executables.each do |file|
186
- SharedHelpers.filesystem_access(target.join(file)) do |path|
187
- executable = (path.stat.mode | 0o111)
188
- path.chmod(executable)
189
- end
205
+ path = target.join(file)
206
+ executable = (path.stat.mode | 0o111)
207
+ path.chmod(executable)
190
208
  end
191
209
 
192
- if Bundler.git_present? && options[:git]
193
- Bundler.ui.info "Initializing git repo in #{target}"
210
+ if use_git
194
211
  Dir.chdir(target) do
195
- `git init`
196
212
  `git add .`
197
213
  end
198
214
  end
@@ -202,8 +218,6 @@ module Bundler
202
218
 
203
219
  Bundler.ui.info "Gem '#{name}' was successfully created. " \
204
220
  "For more information on making a RubyGem visit https://bundler.io/guides/creating_gem.html"
205
- rescue Errno::EEXIST => e
206
- raise GenericSystemCallError.new(e, "There was a conflict while creating the new gem.")
207
221
  end
208
222
 
209
223
  private
@@ -72,7 +72,7 @@ module Bundler
72
72
  gemfile_specs + dependency_specs
73
73
  end
74
74
 
75
- specs.sort_by(&:name).each do |current_spec|
75
+ specs.sort_by(&:name).uniq(&:name).each do |current_spec|
76
76
  next unless gems.empty? || gems.include?(current_spec.name)
77
77
 
78
78
  active_spec = retrieve_active_spec(definition, current_spec)
@@ -54,7 +54,7 @@ module Bundler
54
54
  if response.is_a?(Net::HTTPPartialContent) && local_temp_path.size.nonzero?
55
55
  local_temp_path.open("a") {|f| f << slice_body(content, 1..-1) }
56
56
  else
57
- local_temp_path.open("w") {|f| f << content }
57
+ local_temp_path.open("wb") {|f| f << content }
58
58
  end
59
59
  end
60
60
 
@@ -106,6 +106,17 @@ module Bundler
106
106
  @locked_platforms = []
107
107
  end
108
108
 
109
+ @locked_gem_sources = @locked_sources.select {|s| s.is_a?(Source::Rubygems) }
110
+ @disable_multisource = @locked_gem_sources.all?(&:disable_multisource?)
111
+
112
+ unless @disable_multisource
113
+ msg = "Your lockfile contains a single rubygems source section with multiple remotes, which is insecure. You should run `bundle update` or generate your lockfile from scratch."
114
+
115
+ Bundler::SharedHelpers.major_deprecation 2, msg
116
+
117
+ @sources.merged_gem_lockfile_sections!
118
+ end
119
+
109
120
  @unlock[:gems] ||= []
110
121
  @unlock[:sources] ||= []
111
122
  @unlock[:ruby] ||= if @ruby_version && locked_ruby_version_object
@@ -145,6 +156,10 @@ module Bundler
145
156
  end
146
157
  end
147
158
 
159
+ def disable_multisource?
160
+ @disable_multisource
161
+ end
162
+
148
163
  def resolve_with_cache!
149
164
  raise "Specs already loaded" if @specs
150
165
  sources.cached!
@@ -172,10 +187,10 @@ module Bundler
172
187
  gem_name, gem_version = extract_gem_info(e)
173
188
  locked_gem = @locked_specs[gem_name].last
174
189
  raise if locked_gem.nil? || locked_gem.version.to_s != gem_version || !@remote
175
- raise GemNotFound, "Your bundle is locked to #{locked_gem}, but that version could not " \
176
- "be found in any of the sources listed in your Gemfile. If you haven't changed sources, " \
177
- "that means the author of #{locked_gem} has removed it. You'll need to update your bundle " \
178
- "to a version other than #{locked_gem} that hasn't been removed in order to install."
190
+ raise GemNotFound, "Your bundle is locked to #{locked_gem} from #{locked_gem.source}, but that version can " \
191
+ "no longer be found in that source. That means the author of #{locked_gem} has removed it. " \
192
+ "You'll need to update your bundle to a version other than #{locked_gem} that hasn't been " \
193
+ "removed in order to install."
179
194
  end
180
195
  unless specs["bundler"].any?
181
196
  bundler = sources.metadata_source.specs.search(Gem::Dependency.new("bundler", VERSION)).last
@@ -264,7 +279,7 @@ module Bundler
264
279
  # Run a resolve against the locally available gems
265
280
  Bundler.ui.debug("Found changes from the lockfile, re-resolving dependencies because #{change_reason}")
266
281
  expanded_dependencies = expand_dependencies(dependencies + metadata_dependencies, @remote)
267
- Resolver.resolve(expanded_dependencies, index, source_requirements, last_resolve, gem_version_promoter, additional_base_requirements_for_resolve, platforms)
282
+ Resolver.resolve(expanded_dependencies, source_requirements, last_resolve, gem_version_promoter, additional_base_requirements_for_resolve, platforms)
268
283
  end
269
284
  end
270
285
  end
@@ -530,6 +545,9 @@ module Bundler
530
545
  attr_reader :sources
531
546
  private :sources
532
547
 
548
+ attr_reader :locked_gem_sources
549
+ private :locked_gem_sources
550
+
533
551
  def nothing_changed?
534
552
  !@source_changes && !@dependency_changes && !@new_platform && !@path_changes && !@local_changes && !@locked_specs_incomplete_for_platform
535
553
  end
@@ -594,7 +612,7 @@ module Bundler
594
612
  deps_for_source = @dependencies.select {|s| s.source == source }
595
613
  locked_deps_for_source = @locked_deps.values.select {|dep| dep.source == locked_source }
596
614
 
597
- deps_for_source.sort != locked_deps_for_source.sort
615
+ deps_for_source.uniq.sort != locked_deps_for_source.sort
598
616
  end
599
617
 
600
618
  def specs_for_source_changed?(source)
@@ -654,21 +672,20 @@ module Bundler
654
672
  end
655
673
 
656
674
  def converge_rubygems_sources
657
- return false if Bundler.feature_flag.disable_multisource?
675
+ return false if disable_multisource?
658
676
 
659
- changes = false
677
+ return false if locked_gem_sources.empty?
660
678
 
661
- # Get the RubyGems sources from the Gemfile.lock
662
- locked_gem_sources = @locked_sources.select {|s| s.is_a?(Source::Rubygems) }
663
679
  # Get the RubyGems remotes from the Gemfile
664
680
  actual_remotes = sources.rubygems_remotes
681
+ return false if actual_remotes.empty?
682
+
683
+ changes = false
665
684
 
666
685
  # If there is a RubyGems source in both
667
- if !locked_gem_sources.empty? && !actual_remotes.empty?
668
- locked_gem_sources.each do |locked_gem|
669
- # Merge the remotes from the Gemfile into the Gemfile.lock
670
- changes |= locked_gem.replace_remotes(actual_remotes, Bundler.settings[:allow_deployment_source_credential_changes])
671
- end
686
+ locked_gem_sources.each do |locked_gem|
687
+ # Merge the remotes from the Gemfile into the Gemfile.lock
688
+ changes |= locked_gem.replace_remotes(actual_remotes, Bundler.settings[:allow_deployment_source_credential_changes])
672
689
  end
673
690
 
674
691
  changes
@@ -893,30 +910,18 @@ module Bundler
893
910
  # Record the specs available in each gem's source, so that those
894
911
  # specs will be available later when the resolver knows where to
895
912
  # look for that gemspec (or its dependencies)
896
- default = sources.default_source
897
- source_requirements = { :default => default }
898
- default = nil unless Bundler.feature_flag.disable_multisource?
899
- dependencies.each do |dep|
900
- next unless source = dep.source || default
901
- source_requirements[dep.name] = source
902
- end
913
+ source_requirements = { :default => sources.default_source }.merge(dependency_source_requirements)
903
914
  metadata_dependencies.each do |dep|
904
915
  source_requirements[dep.name] = sources.metadata_source
905
916
  end
917
+ source_requirements[:global] = index unless Bundler.feature_flag.disable_multisource?
906
918
  source_requirements[:default_bundler] = source_requirements["bundler"] || source_requirements[:default]
907
919
  source_requirements["bundler"] = sources.metadata_source # needs to come last to override
908
920
  source_requirements
909
921
  end
910
922
 
911
923
  def pinned_spec_names(skip = nil)
912
- pinned_names = []
913
- default = Bundler.feature_flag.disable_multisource? && sources.default_source
914
- @dependencies.each do |dep|
915
- next unless dep_source = dep.source || default
916
- next if dep_source == skip
917
- pinned_names << dep.name
918
- end
919
- pinned_names
924
+ dependency_source_requirements.reject {|_, source| source == skip }.keys
920
925
  end
921
926
 
922
927
  def requested_groups
@@ -954,7 +959,7 @@ module Bundler
954
959
  end
955
960
 
956
961
  def additional_base_requirements_for_resolve
957
- return [] unless @locked_gems && Bundler.feature_flag.only_update_to_newer_versions?
962
+ return [] unless @locked_gems
958
963
  dependencies_by_name = dependencies.inject({}) {|memo, dep| memo.update(dep.name => dep) }
959
964
  @locked_gems.specs.reduce({}) do |requirements, locked_spec|
960
965
  name = locked_spec.name
@@ -973,5 +978,17 @@ module Bundler
973
978
 
974
979
  Bundler.settings[:allow_deployment_source_credential_changes] && source.equivalent_remotes?(sources.rubygems_remotes)
975
980
  end
981
+
982
+ def dependency_source_requirements
983
+ @dependency_source_requirements ||= begin
984
+ source_requirements = {}
985
+ default = sources.default_source
986
+ dependencies.each do |dep|
987
+ dep_source = dep.source || default
988
+ source_requirements[dep.name] = dep_source
989
+ end
990
+ source_requirements
991
+ end
992
+ end
976
993
  end
977
994
  end