bundler 1.15.4 → 1.16.0.pre.1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of bundler might be problematic. Click here for more details.

Files changed (251) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +43 -0
  3. data/README.md +12 -7
  4. data/exe/bundle +1 -1
  5. data/exe/bundle_ruby +4 -3
  6. data/lib/bundler.rb +47 -37
  7. data/lib/bundler/build_metadata.rb +38 -0
  8. data/lib/bundler/capistrano.rb +5 -0
  9. data/lib/bundler/cli.rb +155 -67
  10. data/lib/bundler/cli/add.rb +0 -1
  11. data/lib/bundler/cli/binstubs.rb +9 -7
  12. data/lib/bundler/cli/cache.rb +5 -4
  13. data/lib/bundler/cli/check.rb +3 -5
  14. data/lib/bundler/cli/clean.rb +5 -6
  15. data/lib/bundler/cli/common.rb +11 -2
  16. data/lib/bundler/cli/config.rb +2 -1
  17. data/lib/bundler/cli/console.rb +2 -1
  18. data/lib/bundler/cli/doctor.rb +1 -0
  19. data/lib/bundler/cli/exec.rb +2 -1
  20. data/lib/bundler/cli/gem.rb +3 -2
  21. data/lib/bundler/cli/info.rb +0 -1
  22. data/lib/bundler/cli/init.rb +17 -6
  23. data/lib/bundler/cli/inject.rb +1 -0
  24. data/lib/bundler/cli/install.rb +61 -61
  25. data/lib/bundler/cli/issue.rb +1 -1
  26. data/lib/bundler/cli/list.rb +22 -0
  27. data/lib/bundler/cli/lock.rb +0 -1
  28. data/lib/bundler/cli/open.rb +2 -2
  29. data/lib/bundler/cli/outdated.rb +13 -8
  30. data/lib/bundler/cli/package.rb +9 -6
  31. data/lib/bundler/cli/platform.rb +1 -0
  32. data/lib/bundler/cli/plugin.rb +1 -0
  33. data/lib/bundler/cli/pristine.rb +9 -2
  34. data/lib/bundler/cli/show.rb +0 -1
  35. data/lib/bundler/cli/update.rb +31 -5
  36. data/lib/bundler/cli/viz.rb +1 -0
  37. data/lib/bundler/compact_index_client.rb +1 -0
  38. data/lib/bundler/compact_index_client/cache.rb +1 -0
  39. data/lib/bundler/compact_index_client/updater.rb +3 -2
  40. data/lib/bundler/compatibility_guard.rb +14 -0
  41. data/lib/bundler/constants.rb +1 -0
  42. data/lib/bundler/current_ruby.rb +5 -4
  43. data/lib/bundler/definition.rb +140 -95
  44. data/lib/bundler/dep_proxy.rb +2 -0
  45. data/lib/bundler/dependency.rb +6 -7
  46. data/lib/bundler/deployment.rb +1 -1
  47. data/lib/bundler/deprecate.rb +1 -0
  48. data/lib/bundler/dsl.rb +97 -62
  49. data/lib/bundler/endpoint_specification.rb +9 -0
  50. data/lib/bundler/env.rb +63 -27
  51. data/lib/bundler/environment_preserver.rb +26 -6
  52. data/lib/bundler/errors.rb +1 -0
  53. data/lib/bundler/feature_flag.rb +39 -4
  54. data/lib/bundler/fetcher.rb +15 -8
  55. data/lib/bundler/fetcher/base.rb +1 -0
  56. data/lib/bundler/fetcher/compact_index.rb +2 -11
  57. data/lib/bundler/fetcher/dependency.rb +1 -0
  58. data/lib/bundler/fetcher/downloader.rb +1 -0
  59. data/lib/bundler/fetcher/index.rb +1 -0
  60. data/lib/bundler/friendly_errors.rb +2 -1
  61. data/lib/bundler/gem_helper.rb +14 -9
  62. data/lib/bundler/gem_helpers.rb +1 -0
  63. data/lib/bundler/gem_remote_fetcher.rb +1 -0
  64. data/lib/bundler/gem_tasks.rb +1 -0
  65. data/lib/bundler/gem_version_promoter.rb +1 -0
  66. data/lib/bundler/gemdeps.rb +1 -0
  67. data/lib/bundler/graph.rb +1 -0
  68. data/lib/bundler/index.rb +15 -8
  69. data/lib/bundler/injector.rb +25 -22
  70. data/lib/bundler/inline.rb +5 -7
  71. data/lib/bundler/installer.rb +93 -45
  72. data/lib/bundler/installer/gem_installer.rb +2 -0
  73. data/lib/bundler/installer/parallel_installer.rb +73 -42
  74. data/lib/bundler/installer/standalone.rb +1 -0
  75. data/lib/bundler/lazy_specification.rb +2 -1
  76. data/lib/bundler/lockfile_generator.rb +95 -0
  77. data/lib/bundler/lockfile_parser.rb +10 -4
  78. data/lib/bundler/match_platform.rb +1 -0
  79. data/lib/bundler/mirror.rb +6 -3
  80. data/lib/bundler/plugin.rb +1 -0
  81. data/lib/bundler/plugin/api/source.rb +8 -0
  82. data/lib/bundler/plugin/installer.rb +7 -6
  83. data/lib/bundler/plugin/source_list.rb +7 -8
  84. data/lib/bundler/process_lock.rb +24 -0
  85. data/lib/bundler/psyched_yaml.rb +1 -0
  86. data/lib/bundler/remote_specification.rb +1 -0
  87. data/lib/bundler/resolver.rb +138 -191
  88. data/lib/bundler/resolver/spec_group.rb +111 -0
  89. data/lib/bundler/retry.rb +1 -0
  90. data/lib/bundler/ruby_dsl.rb +1 -0
  91. data/lib/bundler/ruby_version.rb +1 -0
  92. data/lib/bundler/rubygems_ext.rb +5 -4
  93. data/lib/bundler/rubygems_gem_installer.rb +23 -0
  94. data/lib/bundler/rubygems_integration.rb +56 -27
  95. data/lib/bundler/runtime.rb +3 -5
  96. data/lib/bundler/settings.rb +177 -76
  97. data/lib/bundler/settings/validator.rb +79 -0
  98. data/lib/bundler/setup.rb +1 -0
  99. data/lib/bundler/shared_helpers.rb +86 -26
  100. data/lib/bundler/similarity_detector.rb +1 -0
  101. data/lib/bundler/source.rb +32 -0
  102. data/lib/bundler/source/gemspec.rb +1 -0
  103. data/lib/bundler/source/git.rb +21 -16
  104. data/lib/bundler/source/git/git_proxy.rb +14 -10
  105. data/lib/bundler/source/metadata.rb +63 -0
  106. data/lib/bundler/source/path.rb +8 -8
  107. data/lib/bundler/source/path/installer.rb +2 -0
  108. data/lib/bundler/source/rubygems.rb +131 -84
  109. data/lib/bundler/source/rubygems/remote.rb +3 -0
  110. data/lib/bundler/source_list.rb +75 -15
  111. data/lib/bundler/spec_set.rb +2 -1
  112. data/lib/bundler/ssl_certs/certificate_manager.rb +2 -1
  113. data/lib/bundler/stub_specification.rb +1 -0
  114. data/lib/bundler/templates/Executable +4 -0
  115. data/lib/bundler/templates/Executable.bundler +105 -0
  116. data/lib/bundler/templates/Gemfile +1 -0
  117. data/lib/bundler/templates/gems.rb +8 -0
  118. data/lib/bundler/templates/newgem/README.md.tt +1 -1
  119. data/lib/bundler/templates/newgem/gitignore.tt +0 -1
  120. data/lib/bundler/templates/newgem/newgem.gemspec.tt +4 -1
  121. data/lib/bundler/templates/newgem/rspec.tt +1 -0
  122. data/lib/bundler/templates/newgem/spec/newgem_spec.rb.tt +0 -2
  123. data/lib/bundler/ui.rb +1 -0
  124. data/lib/bundler/ui/rg_proxy.rb +1 -0
  125. data/lib/bundler/ui/shell.rb +15 -4
  126. data/lib/bundler/ui/silent.rb +1 -0
  127. data/lib/bundler/uri_credentials_filter.rb +1 -0
  128. data/lib/bundler/vendor/fileutils/lib/fileutils.rb +1638 -0
  129. data/lib/bundler/vendor/molinillo/lib/molinillo.rb +2 -0
  130. data/lib/bundler/vendor/molinillo/lib/molinillo/compatibility.rb +26 -0
  131. data/lib/bundler/vendor/molinillo/lib/molinillo/delegates/resolution_state.rb +7 -0
  132. data/lib/bundler/vendor/molinillo/lib/molinillo/delegates/specification_provider.rb +1 -0
  133. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +3 -2
  134. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/action.rb +1 -0
  135. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb +1 -0
  136. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_vertex.rb +1 -0
  137. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/delete_edge.rb +1 -0
  138. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb +1 -0
  139. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/log.rb +1 -0
  140. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/set_payload.rb +1 -0
  141. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/tag.rb +1 -0
  142. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb +3 -2
  143. data/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb +69 -6
  144. data/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb +2 -1
  145. data/lib/bundler/vendor/molinillo/lib/molinillo/modules/specification_provider.rb +1 -0
  146. data/lib/bundler/vendor/molinillo/lib/molinillo/modules/ui.rb +3 -1
  147. data/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb +487 -148
  148. data/lib/bundler/vendor/molinillo/lib/molinillo/resolver.rb +1 -0
  149. data/lib/bundler/vendor/molinillo/lib/molinillo/state.rb +8 -4
  150. data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +1 -1
  151. data/lib/bundler/vendored_fileutils.rb +9 -0
  152. data/lib/bundler/vendored_molinillo.rb +1 -0
  153. data/lib/bundler/vendored_persistent.rb +34 -0
  154. data/lib/bundler/vendored_thor.rb +1 -0
  155. data/lib/bundler/version.rb +6 -2
  156. data/lib/bundler/version_ranges.rb +1 -0
  157. data/lib/bundler/vlad.rb +5 -0
  158. data/lib/bundler/worker.rb +1 -0
  159. data/lib/bundler/yaml_serializer.rb +3 -3
  160. data/man/bundle-add.1 +43 -0
  161. data/man/bundle-add.1.txt +40 -0
  162. data/man/bundle-binstubs.1 +40 -0
  163. data/man/bundle-binstubs.1.txt +48 -0
  164. data/man/bundle-binstubs.ronn +14 -0
  165. data/man/bundle-check.1 +31 -0
  166. data/man/bundle-check.1.txt +32 -0
  167. data/man/bundle-clean.1 +24 -0
  168. data/man/bundle-clean.1.txt +26 -0
  169. data/man/bundle-config.1 +455 -0
  170. data/man/bundle-config.1.txt +491 -0
  171. data/man/bundle-config.ronn +133 -79
  172. data/man/bundle-exec.1 +165 -0
  173. data/man/bundle-exec.1.txt +178 -0
  174. data/man/bundle-exec.ronn +7 -0
  175. data/man/bundle-gem.1 +80 -0
  176. data/man/bundle-gem.1.txt +91 -0
  177. data/man/bundle-gem.ronn +2 -1
  178. data/man/bundle-info.1 +20 -0
  179. data/man/bundle-info.1.txt +21 -0
  180. data/man/bundle-init.1 +20 -0
  181. data/man/bundle-init.1.txt +24 -0
  182. data/man/bundle-inject.1 +33 -0
  183. data/man/bundle-inject.1.txt +32 -0
  184. data/man/bundle-install.1 +305 -0
  185. data/man/bundle-install.1.txt +385 -0
  186. data/man/bundle-install.ronn +32 -32
  187. data/man/bundle-list.1 +20 -0
  188. data/man/bundle-list.1.txt +21 -0
  189. data/man/bundle-list.ronn +15 -0
  190. data/man/bundle-lock.1 +84 -0
  191. data/man/bundle-lock.1.txt +93 -0
  192. data/man/bundle-open.1 +32 -0
  193. data/man/bundle-open.1.txt +29 -0
  194. data/man/bundle-outdated.1 +151 -0
  195. data/man/bundle-outdated.1.txt +127 -0
  196. data/man/bundle-outdated.ronn +1 -1
  197. data/man/bundle-package.1 +55 -0
  198. data/man/bundle-package.1.txt +79 -0
  199. data/man/bundle-package.ronn +5 -0
  200. data/man/bundle-platform.1 +61 -0
  201. data/man/bundle-platform.1.txt +57 -0
  202. data/man/bundle-pristine.1 +34 -0
  203. data/man/bundle-pristine.1.txt +44 -0
  204. data/man/bundle-pristine.ronn +24 -3
  205. data/man/bundle-show.1 +23 -0
  206. data/man/bundle-show.1.txt +25 -0
  207. data/man/bundle-update.1 +390 -0
  208. data/man/bundle-update.1.txt +386 -0
  209. data/man/bundle-update.ronn +2 -2
  210. data/man/bundle-viz.1 +39 -0
  211. data/man/bundle-viz.1.txt +38 -0
  212. data/man/bundle-viz.ronn +5 -5
  213. data/man/bundle.1 +132 -0
  214. data/man/bundle.1.txt +113 -0
  215. data/man/bundle.ronn +5 -2
  216. data/man/gemfile.5 +679 -0
  217. data/man/gemfile.5.ronn +31 -0
  218. data/man/gemfile.5.txt +636 -0
  219. data/man/index.txt +23 -0
  220. metadata +21 -36
  221. data/.codeclimate.yml +0 -25
  222. data/.gitignore +0 -18
  223. data/.rspec +0 -3
  224. data/.rubocop.yml +0 -131
  225. data/.rubocop_todo.yml +0 -418
  226. data/.travis.yml +0 -122
  227. data/CODE_OF_CONDUCT.md +0 -42
  228. data/CONTRIBUTING.md +0 -17
  229. data/Rakefile +0 -338
  230. data/bin/rake +0 -19
  231. data/bin/rspec +0 -15
  232. data/bin/rubocop +0 -17
  233. data/bin/with_rubygems +0 -39
  234. data/bundler.gemspec +0 -48
  235. data/doc/README.md +0 -30
  236. data/doc/TROUBLESHOOTING.md +0 -64
  237. data/doc/contributing/BUG_TRIAGE.md +0 -36
  238. data/doc/contributing/COMMUNITY.md +0 -13
  239. data/doc/contributing/GETTING_HELP.md +0 -11
  240. data/doc/contributing/HOW_YOU_CAN_HELP.md +0 -27
  241. data/doc/contributing/ISSUES.md +0 -51
  242. data/doc/contributing/README.md +0 -38
  243. data/doc/development/NEW_FEATURES.md +0 -10
  244. data/doc/development/PULL_REQUESTS.md +0 -40
  245. data/doc/development/README.md +0 -19
  246. data/doc/development/RELEASING.md +0 -9
  247. data/doc/development/SETUP.md +0 -27
  248. data/doc/documentation/README.md +0 -29
  249. data/doc/documentation/VISION.md +0 -26
  250. data/doc/documentation/WRITING.md +0 -54
  251. data/task/release.rake +0 -116
@@ -26,7 +26,7 @@ module Bundler
26
26
 
27
27
  EOS
28
28
 
29
- Bundler.ui.info Bundler::Env.new.report
29
+ Bundler.ui.info Bundler::Env.report
30
30
 
31
31
  Bundler.ui.info "\n## Bundle Doctor"
32
32
  doctor
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bundler
4
+ class CLI::List
5
+ def initialize(options)
6
+ @options = options
7
+ end
8
+
9
+ def run
10
+ specs = Bundler.load.specs.reject {|s| s.name == "bundler" }.sort_by(&:name)
11
+ return specs.each {|s| Bundler.ui.info s.name } if @options["name-only"]
12
+
13
+ return Bundler.ui.info "No gems in the Gemfile" if specs.empty?
14
+ Bundler.ui.info "Gems included by the bundle:"
15
+ specs.each do |s|
16
+ Bundler.ui.info " * #{s.name} (#{s.version}#{s.git_version})"
17
+ end
18
+
19
+ Bundler.ui.info "Use `bundle info` to print more detailed information about a gem"
20
+ end
21
+ end
22
+ end
@@ -1,5 +1,4 @@
1
1
  # frozen_string_literal: true
2
- require "bundler/cli/common"
3
2
 
4
3
  module Bundler
5
4
  class CLI::Lock
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
- require "bundler/cli/common"
2
+
3
3
  require "shellwords"
4
4
 
5
5
  module Bundler
@@ -17,7 +17,7 @@ module Bundler
17
17
  path = spec.full_gem_path
18
18
  Dir.chdir(path) do
19
19
  command = Shellwords.split(editor) + [path]
20
- Bundler.with_clean_env do
20
+ Bundler.with_original_env do
21
21
  system(*command)
22
22
  end || Bundler.ui.info("Could not run '#{command.join(" ")}'")
23
23
  end
@@ -1,5 +1,4 @@
1
1
  # frozen_string_literal: true
2
- require "bundler/cli/common"
3
2
 
4
3
  module Bundler
5
4
  class CLI::Outdated
@@ -46,7 +45,7 @@ module Bundler
46
45
  Bundler::CLI::Common.patch_level_options(options).any?
47
46
 
48
47
  filter_options_patch = options.keys &
49
- %w(filter-major filter-minor filter-patch)
48
+ %w[filter-major filter-minor filter-patch]
50
49
 
51
50
  definition_resolution = proc do
52
51
  options[:local] ? definition.resolve_with_cache! : definition.resolve_remotely!
@@ -214,13 +213,19 @@ module Bundler
214
213
  end
215
214
 
216
215
  def check_for_deployment_mode
217
- if Bundler.settings[:frozen]
218
- raise ProductionError, "You are trying to check outdated gems in " \
219
- "deployment mode. Run `bundle outdated` elsewhere.\n" \
220
- "\nIf this is a development machine, remove the " \
221
- "#{Bundler.default_gemfile} freeze" \
222
- "\nby running `bundle install --no-deployment`."
216
+ return unless Bundler.frozen?
217
+ suggested_command = if Bundler.settings.locations("frozen")[:global]
218
+ "bundle config --delete frozen"
219
+ elsif Bundler.settings.locations("deployment").keys.&([:global, :local]).any?
220
+ "bundle config --delete deployment"
221
+ else
222
+ "bundle install --no-deployment"
223
223
  end
224
+ raise ProductionError, "You are trying to check outdated gems in " \
225
+ "deployment mode. Run `bundle outdated` elsewhere.\n" \
226
+ "\nIf this is a development machine, remove the " \
227
+ "#{Bundler.default_gemfile} freeze" \
228
+ "\nby running `#{suggested_command}`."
224
229
  end
225
230
 
226
231
  def update_present_via_semver_portions(current_spec, active_spec, options)
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module Bundler
3
4
  class CLI::Package
4
5
  attr_reader :options
@@ -9,15 +10,15 @@ module Bundler
9
10
 
10
11
  def run
11
12
  Bundler.ui.level = "error" if options[:quiet]
12
- Bundler.settings[:path] = File.expand_path(options[:path]) if options[:path]
13
- Bundler.settings[:cache_all_platforms] = options["all-platforms"] if options.key?("all-platforms")
14
- Bundler.settings[:cache_path] = options["cache-path"] if options.key?("cache-path")
13
+ Bundler.settings.set_command_option_if_given :path, options[:path]
14
+ Bundler.settings.set_command_option_if_given :cache_all_platforms, options["all-platforms"]
15
+ Bundler.settings.set_command_option_if_given :cache_path, options["cache-path"]
15
16
 
16
17
  setup_cache_all
17
18
  install
18
19
 
19
20
  # TODO: move cache contents here now that all bundles are locked
20
- custom_path = Pathname.new(options[:path]) if options[:path]
21
+ custom_path = Bundler.settings[:path] if options[:path]
21
22
  Bundler.load.cache(custom_path)
22
23
  end
23
24
 
@@ -34,9 +35,11 @@ module Bundler
34
35
  end
35
36
 
36
37
  def setup_cache_all
37
- Bundler.settings[:cache_all] = options[:all] if options.key?("all")
38
+ all = options.fetch(:all, Bundler.feature_flag.cache_command_is_package? || nil)
39
+
40
+ Bundler.settings.set_command_option_if_given :cache_all, all
38
41
 
39
- if Bundler.definition.has_local_dependencies? && !Bundler.settings[:cache_all]
42
+ if Bundler.definition.has_local_dependencies? && !Bundler.feature_flag.cache_all?
40
43
  Bundler.ui.warn "Your Gemfile contains path and git dependencies. If you want " \
41
44
  "to package them as well, please pass the --all flag. This will be the default " \
42
45
  "on Bundler 2.0."
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module Bundler
3
4
  class CLI::Platform
4
5
  attr_reader :options
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require "bundler/vendored_thor"
3
4
  module Bundler
4
5
  class CLI::Plugin < Thor
@@ -1,15 +1,20 @@
1
1
  # frozen_string_literal: true
2
- require "bundler/cli/common"
3
2
 
4
3
  module Bundler
5
4
  class CLI::Pristine
5
+ def initialize(gems)
6
+ @gems = gems
7
+ end
8
+
6
9
  def run
10
+ CLI::Common.ensure_all_gems_in_lockfile!(@gems)
7
11
  definition = Bundler.definition
8
12
  definition.validate_runtime!
9
13
  installer = Bundler::Installer.new(Bundler.root, definition)
10
14
 
11
15
  Bundler.load.specs.each do |spec|
12
16
  next if spec.name == "bundler" # Source::Rubygems doesn't install bundler
17
+ next if !@gems.empty? && !@gems.include?(spec.name)
13
18
 
14
19
  gem_name = "#{spec.name} (#{spec.version}#{spec.git_version})"
15
20
  gem_name += " (#{spec.platform})" if !spec.platform.nil? && spec.platform != Gem::Platform::RUBY
@@ -21,13 +26,15 @@ module Bundler
21
26
  Bundler.ui.error("Failed to pristine #{gem_name}. Cached gem #{cached_gem} does not exist.")
22
27
  next
23
28
  end
29
+
30
+ FileUtils.rm_rf spec.full_gem_path
24
31
  when Source::Git
25
32
  source.remote!
33
+ FileUtils.rm_rf spec.full_gem_path
26
34
  else
27
35
  Bundler.ui.warn("Cannot pristine #{gem_name}. Gem is sourced from local path.")
28
36
  next
29
37
  end
30
- FileUtils.rm_rf spec.full_gem_path
31
38
 
32
39
  Bundler::GemInstaller.new(spec, installer, false, 0, true).install_from_spec
33
40
  end
@@ -1,5 +1,4 @@
1
1
  # frozen_string_literal: true
2
- require "bundler/cli/common"
3
2
 
4
3
  module Bundler
5
4
  class CLI::Show
@@ -1,5 +1,4 @@
1
1
  # frozen_string_literal: true
2
- require "bundler/cli/common"
3
2
 
4
3
  module Bundler
5
4
  class CLI::Update
@@ -17,7 +16,18 @@ module Bundler
17
16
  sources = Array(options[:source])
18
17
  groups = Array(options[:group]).map(&:to_sym)
19
18
 
20
- if gems.empty? && sources.empty? && groups.empty? && !options[:ruby] && !options[:bundler]
19
+ full_update = gems.empty? && sources.empty? && groups.empty? && !options[:ruby] && !options[:bundler]
20
+
21
+ if full_update && !options[:all]
22
+ if Bundler.feature_flag.update_requires_all_flag?
23
+ raise InvalidOption, "To update everything, pass the `--all` flag."
24
+ end
25
+ SharedHelpers.major_deprecation 2, "Pass --all to `bundle update` to update everything"
26
+ elsif !full_update && options[:all]
27
+ raise InvalidOption, "Cannot specify --all along with specific options."
28
+ end
29
+
30
+ if full_update
21
31
  # We're doing a full update
22
32
  Bundler.definition(true)
23
33
  else
@@ -33,7 +43,8 @@ module Bundler
33
43
  end
34
44
 
35
45
  Bundler.definition(:gems => gems, :sources => sources, :ruby => options[:ruby],
36
- :lock_shared_dependencies => options[:conservative])
46
+ :lock_shared_dependencies => options[:conservative],
47
+ :bundler => options[:bundler])
37
48
  end
38
49
 
39
50
  Bundler::CLI::Common.configure_gem_version_promoter(Bundler.definition, options)
@@ -44,17 +55,32 @@ module Bundler
44
55
  opts["update"] = true
45
56
  opts["local"] = options[:local]
46
57
 
47
- Bundler.settings[:jobs] = opts["jobs"] if opts["jobs"]
58
+ Bundler.settings.set_command_option_if_given :jobs, opts["jobs"]
48
59
 
49
60
  Bundler.definition.validate_runtime!
50
61
  installer = Installer.install Bundler.root, Bundler.definition, opts
51
62
  Bundler.load.cache if Bundler.app_cache.exist?
52
63
 
53
- if Bundler.settings[:clean] && Bundler.settings[:path]
64
+ if CLI::Common.clean_after_install?
54
65
  require "bundler/cli/clean"
55
66
  Bundler::CLI::Clean.new(options).run
56
67
  end
57
68
 
69
+ if locked_gems = Bundler.definition.locked_gems
70
+ gems.each do |name|
71
+ locked_version = locked_gems.specs.find {|s| s.name == name }.version
72
+ new_version = Bundler.definition.specs[name].first
73
+ new_version &&= new_version.version
74
+ if !new_version
75
+ Bundler.ui.warn "Bundler attempted to update #{name} but it was removed from the bundle"
76
+ elsif new_version < locked_version
77
+ Bundler.ui.warn "Bundler attempted to update #{name} but its version regressed from #{locked_version} to #{new_version}"
78
+ elsif new_version == locked_version
79
+ Bundler.ui.warn "Bundler attempted to update #{name} but its version stayed the same"
80
+ end
81
+ end
82
+ end
83
+
58
84
  Bundler.ui.confirm "Bundle updated!"
59
85
  Bundler::CLI::Common.output_without_groups_message
60
86
  Bundler::CLI::Common.output_post_install_messages installer.post_install_messages
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module Bundler
3
4
  class CLI::Viz
4
5
  attr_reader :options, :gem_name
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require "pathname"
3
4
  require "set"
4
5
 
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require "digest/md5"
3
4
 
4
5
  module Bundler
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
- require "fileutils"
2
+
3
+ require "bundler/vendored_fileutils"
3
4
  require "stringio"
4
- require "tmpdir"
5
5
  require "zlib"
6
6
 
7
7
  module Bundler
@@ -22,6 +22,7 @@ module Bundler
22
22
 
23
23
  def initialize(fetcher)
24
24
  @fetcher = fetcher
25
+ require "tmpdir"
25
26
  end
26
27
 
27
28
  def update(local_path, remote_path, retrying = nil)
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: false
2
+
3
+ require "rubygems"
4
+ require "bundler/version"
5
+
6
+ if Bundler::VERSION.split(".").first.to_i >= 2
7
+ if Gem::Version.new(Object::RUBY_VERSION.dup) < Gem::Version.new("2.3")
8
+ abort "Bundler 2 requires Ruby 2.3 or later. Either install bundler 1 or update to a supported Ruby version."
9
+ end
10
+
11
+ if Gem::Version.new(Gem::VERSION.dup) < Gem::Version.new("2.5")
12
+ abort "Bundler 2 requires RubyGems 2.5 or later. Either install bundler 1 or update to a supported RubyGems version."
13
+ end
14
+ end
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module Bundler
3
4
  WINDOWS = RbConfig::CONFIG["host_os"] =~ /(msdos|mswin|djgpp|mingw)/
4
5
  FREEBSD = RbConfig::CONFIG["host_os"] =~ /bsd/
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module Bundler
3
4
  # Returns current version of Ruby
4
5
  #
@@ -8,7 +9,7 @@ module Bundler
8
9
  end
9
10
 
10
11
  class CurrentRuby
11
- KNOWN_MINOR_VERSIONS = %w(
12
+ KNOWN_MINOR_VERSIONS = %w[
12
13
  1.8
13
14
  1.9
14
15
  2.0
@@ -17,11 +18,11 @@ module Bundler
17
18
  2.3
18
19
  2.4
19
20
  2.5
20
- ).freeze
21
+ ].freeze
21
22
 
22
23
  KNOWN_MAJOR_VERSIONS = KNOWN_MINOR_VERSIONS.map {|v| v.split(".", 2).first }.uniq.freeze
23
24
 
24
- KNOWN_PLATFORMS = %w(
25
+ KNOWN_PLATFORMS = %w[
25
26
  jruby
26
27
  maglev
27
28
  mingw
@@ -31,7 +32,7 @@ module Bundler
31
32
  rbx
32
33
  ruby
33
34
  x64_mingw
34
- ).freeze
35
+ ].freeze
35
36
 
36
37
  def ruby?
37
38
  !mswin? && (!defined?(RUBY_ENGINE) || RUBY_ENGINE == "ruby" || RUBY_ENGINE == "rbx" || RUBY_ENGINE == "maglev")
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require "bundler/lockfile_parser"
3
4
  require "digest/sha1"
4
5
  require "set"
@@ -14,7 +15,9 @@ module Bundler
14
15
  :locked_gems,
15
16
  :platforms,
16
17
  :requires,
17
- :ruby_version
18
+ :ruby_version,
19
+ :lockfile,
20
+ :gemfiles
18
21
  )
19
22
 
20
23
  # Given a gemfile and lockfile creates a Bundler definition
@@ -51,8 +54,16 @@ module Bundler
51
54
  # to be updated or true if all gems should be updated
52
55
  # @param ruby_version [Bundler::RubyVersion, nil] Requested Ruby Version
53
56
  # @param optional_groups [Array(String)] A list of optional groups
54
- def initialize(lockfile, dependencies, sources, unlock, ruby_version = nil, optional_groups = [])
55
- @unlocking = unlock == true || !unlock.empty?
57
+ def initialize(lockfile, dependencies, sources, unlock, ruby_version = nil, optional_groups = [], gemfiles = [])
58
+ if [true, false].include?(unlock)
59
+ @unlocking_bundler = false
60
+ @unlocking = unlock
61
+ else
62
+ unlock = unlock.dup
63
+ @unlocking_bundler = unlock.delete(:bundler)
64
+ unlock.delete_if {|_k, v| Array(v).empty? }
65
+ @unlocking = !unlock.empty?
66
+ end
56
67
 
57
68
  @dependencies = dependencies
58
69
  @sources = sources
@@ -61,6 +72,7 @@ module Bundler
61
72
  @remote = false
62
73
  @specs = nil
63
74
  @ruby_version = ruby_version
75
+ @gemfiles = gemfiles
64
76
 
65
77
  @lockfile = lockfile
66
78
  @lockfile_contents = String.new
@@ -102,7 +114,7 @@ module Bundler
102
114
  end
103
115
  @unlocking ||= @unlock[:ruby] ||= (!@locked_ruby_version ^ !@ruby_version)
104
116
 
105
- add_current_platform unless Bundler.settings[:frozen]
117
+ add_current_platform unless Bundler.frozen?
106
118
 
107
119
  converge_path_sources_to_gemspec_sources
108
120
  @path_changes = converge_paths
@@ -167,9 +179,8 @@ module Bundler
167
179
  "to a different version of #{locked_gem} that hasn't been removed in order to install."
168
180
  end
169
181
  unless specs["bundler"].any?
170
- local = Bundler.settings[:frozen] ? rubygems_index : index
171
- bundler = local.search(Gem::Dependency.new("bundler", VERSION)).last
172
- specs["bundler"] = bundler if bundler
182
+ bundler = sources.metadata_source.specs.search(Gem::Dependency.new("bundler", VERSION)).last
183
+ specs["bundler"] = bundler
173
184
  end
174
185
 
175
186
  specs
@@ -194,10 +205,19 @@ module Bundler
194
205
  missing
195
206
  end
196
207
 
197
- def missing_dependencies
208
+ def missing_specs?
198
209
  missing = []
199
- resolve.materialize(current_dependencies, missing)
200
- missing
210
+ resolve.materialize(requested_dependencies, missing)
211
+ return false if missing.empty?
212
+ Bundler.ui.debug "The definition is missing #{missing.map(&:full_name)}"
213
+ true
214
+ rescue BundlerError => e
215
+ Bundler.ui.debug "The definition is missing dependencies, failed to resolve & materialize locally (#{e})"
216
+ true
217
+ ensure
218
+ @index = nil
219
+ @resolve = nil
220
+ @specs = nil
201
221
  end
202
222
 
203
223
  def requested_specs
@@ -226,7 +246,10 @@ module Bundler
226
246
  def resolve
227
247
  @resolve ||= begin
228
248
  last_resolve = converge_locked_specs
229
- if Bundler.settings[:frozen] || (!unlocking? && nothing_changed?)
249
+ if Bundler.frozen?
250
+ Bundler.ui.debug "Frozen, using resolution from the lockfile"
251
+ last_resolve
252
+ elsif !unlocking? && nothing_changed?
230
253
  Bundler.ui.debug("Found no changes, using resolution from the lockfile")
231
254
  last_resolve
232
255
  else
@@ -247,20 +270,36 @@ module Bundler
247
270
  dependency_names -= pinned_spec_names(source.specs)
248
271
  dependency_names.concat(source.unmet_deps).uniq!
249
272
  end
250
- idx << Gem::Specification.new("ruby\0", RubyVersion.system.to_gem_version_with_patchlevel)
251
- idx << Gem::Specification.new("rubygems\0", Gem::VERSION)
273
+
274
+ double_check_for_index(idx, dependency_names)
252
275
  end
253
276
  end
254
277
 
255
- # used when frozen is enabled so we can find the bundler
256
- # spec, even if (say) a git gem is not checked out.
257
- def rubygems_index
258
- @rubygems_index ||= Index.build do |idx|
259
- sources.rubygems_sources.each do |rubygems|
260
- idx.add_source rubygems.specs
278
+ # Suppose the gem Foo depends on the gem Bar. Foo exists in Source A. Bar has some versions that exist in both
279
+ # sources A and B. At this point, the API request will have found all the versions of Bar in source A,
280
+ # but will not have found any versions of Bar from source B, which is a problem if the requested version
281
+ # of Foo specifically depends on a version of Bar that is only found in source B. This ensures that for
282
+ # each spec we found, we add all possible versions from all sources to the index.
283
+ def double_check_for_index(idx, dependency_names)
284
+ loop do
285
+ idxcount = idx.size
286
+ sources.all_sources.each do |source|
287
+ names = :names # do this so we only have to traverse to get dependency_names from the index once
288
+ unmet_dependency_names = proc do
289
+ break names unless names == :names
290
+ names = if idx.size > Source::Rubygems::API_REQUEST_LIMIT
291
+ new_names = idx.dependency_names_if_available
292
+ new_names && dependency_names.+(new_names).uniq
293
+ else
294
+ dependency_names.+(idx.dependency_names).uniq
295
+ end
296
+ end
297
+ source.double_check_for(unmet_dependency_names, :override_dupes)
261
298
  end
299
+ break if idxcount == idx.size
262
300
  end
263
301
  end
302
+ private :double_check_for_index
264
303
 
265
304
  def has_rubygems_remotes?
266
305
  sources.rubygems_sources.any? {|s| s.remotes.any? }
@@ -295,10 +334,10 @@ module Bundler
295
334
  end
296
335
  end
297
336
 
298
- preserve_unknown_sections ||= !updating_major && (Bundler.settings[:frozen] || !unlocking?)
337
+ preserve_unknown_sections ||= !updating_major && (Bundler.frozen? || !(unlocking? || @unlocking_bundler))
299
338
  return if lockfiles_equal?(@lockfile_contents, contents, preserve_unknown_sections)
300
339
 
301
- if Bundler.settings[:frozen]
340
+ if Bundler.frozen?
302
341
  Bundler.ui.error "Cannot write a changed lockfile while frozen."
303
342
  return
304
343
  end
@@ -338,51 +377,8 @@ module Bundler
338
377
  end
339
378
 
340
379
  def to_lock
341
- out = String.new
342
-
343
- sources.lock_sources.each do |source|
344
- # Add the source header
345
- out << source.to_lock
346
- # Find all specs for this source
347
- resolve.
348
- select {|s| source.can_lock?(s) }.
349
- # This needs to be sorted by full name so that
350
- # gems with the same name, but different platform
351
- # are ordered consistently
352
- sort_by(&:full_name).
353
- each do |spec|
354
- next if spec.name == "bundler"
355
- out << spec.to_lock
356
- end
357
- out << "\n"
358
- end
359
-
360
- out << "PLATFORMS\n"
361
-
362
- platforms.map(&:to_s).sort.each do |p|
363
- out << " #{p}\n"
364
- end
365
-
366
- out << "\n"
367
- out << "DEPENDENCIES\n"
368
-
369
- handled = []
370
- dependencies.sort_by(&:to_s).each do |dep|
371
- next if handled.include?(dep.name)
372
- out << dep.to_lock
373
- handled << dep.name
374
- end
375
-
376
- if locked_ruby_version
377
- out << "\nRUBY VERSION\n"
378
- out << " #{locked_ruby_version}\n"
379
- end
380
-
381
- # Record the version of Bundler that was used to create the lockfile
382
- out << "\nBUNDLED WITH\n"
383
- out << " #{locked_bundler_version}\n"
384
-
385
- out
380
+ require "bundler/lockfile_generator"
381
+ LockfileGenerator.generate(self)
386
382
  end
387
383
 
388
384
  def ensure_equivalent_gemfile_and_lockfile(explicit_flag = false)
@@ -392,8 +388,13 @@ module Bundler
392
388
  "updated #{Bundler.default_lockfile.relative_path_from(SharedHelpers.pwd)} to version control."
393
389
 
394
390
  unless explicit_flag
395
-
396
- suggested_command = Bundler.settings.locations("frozen")[:global] == "1" ? "bundle config --delete frozen" : "bundle install --no-deployment"
391
+ suggested_command = if Bundler.settings.locations("frozen")[:global]
392
+ "bundle config --delete frozen"
393
+ elsif Bundler.settings.locations("deployment").keys.&([:global, :local]).any?
394
+ "bundle config --delete deployment"
395
+ else
396
+ "bundle install --no-deployment"
397
+ end
397
398
  msg << "\n\nIf this is a development machine, remove the #{Bundler.default_gemfile} " \
398
399
  "freeze \nby running `#{suggested_command}`."
399
400
  end
@@ -417,8 +418,8 @@ module Bundler
417
418
 
418
419
  # Check if it is possible that the source is only changed thing
419
420
  if (new_deps.empty? && deleted_deps.empty?) && (!new_sources.empty? && !deleted_sources.empty?)
420
- new_sources.reject! {|source| source.is_a_path? && source.path.exist? }
421
- deleted_sources.reject! {|source| source.is_a_path? && source.path.exist? }
421
+ new_sources.reject! {|source| (source.path? && source.path.exist?) || equivalent_rubygems_remotes?(source) }
422
+ deleted_sources.reject! {|source| (source.path? && source.path.exist?) || equivalent_rubygems_remotes?(source) }
422
423
  end
423
424
 
424
425
  if @locked_sources != gemfile_sources
@@ -511,7 +512,7 @@ module Bundler
511
512
 
512
513
  def add_current_platform
513
514
  current_platform = Bundler.local_platform
514
- add_platform(current_platform) if Bundler.settings[:specific_platform]
515
+ add_platform(current_platform) if Bundler.feature_flag.specific_platform?
515
516
  add_platform(generic(current_platform))
516
517
  end
517
518
 
@@ -558,10 +559,7 @@ module Bundler
558
559
  end
559
560
 
560
561
  def pretty_dep(dep, source = false)
561
- msg = String.new(dep.name)
562
- msg << " (#{dep.requirement})" unless dep.requirement == Gem::Requirement.default
563
- msg << " from the `#{dep.source}` source" if source && dep.source
564
- msg
562
+ SharedHelpers.pretty_dependency(dep, source)
565
563
  end
566
564
 
567
565
  # Check if the specs of the given source changed
@@ -585,6 +583,9 @@ module Bundler
585
583
 
586
584
  # order here matters, since Index#== is checking source.specs.include?(locked_index)
587
585
  locked_index != source.specs
586
+ rescue PathError, GitError => e
587
+ Bundler.ui.debug "Assuming that #{source} has not changed since fetching its specs errored (#{e})"
588
+ false
588
589
  end
589
590
 
590
591
  # Get all locals and override their matching sources.
@@ -632,22 +633,32 @@ module Bundler
632
633
  end
633
634
  end
634
635
 
635
- def converge_sources
636
+ def converge_rubygems_sources
637
+ return false if Bundler.feature_flag.lockfile_uses_separate_rubygems_sources?
638
+
636
639
  changes = false
637
640
 
638
- # Get the Rubygems sources from the Gemfile.lock
641
+ # Get the RubyGems sources from the Gemfile.lock
639
642
  locked_gem_sources = @locked_sources.select {|s| s.is_a?(Source::Rubygems) }
640
- # Get the Rubygems remotes from the Gemfile
643
+ # Get the RubyGems remotes from the Gemfile
641
644
  actual_remotes = sources.rubygems_remotes
642
645
 
643
- # If there is a Rubygems source in both
646
+ # If there is a RubyGems source in both
644
647
  if !locked_gem_sources.empty? && !actual_remotes.empty?
645
648
  locked_gem_sources.each do |locked_gem|
646
649
  # Merge the remotes from the Gemfile into the Gemfile.lock
647
- changes |= locked_gem.replace_remotes(actual_remotes)
650
+ changes |= locked_gem.replace_remotes(actual_remotes, Bundler.settings[:allow_deployment_source_credential_changes])
648
651
  end
649
652
  end
650
653
 
654
+ changes
655
+ end
656
+
657
+ def converge_sources
658
+ changes = false
659
+
660
+ changes |= converge_rubygems_sources
661
+
651
662
  # Replace the sources from the Gemfile with the sources from the Gemfile.lock,
652
663
  # if they exist in the Gemfile.lock and are `==`. If you can't find an equivalent
653
664
  # source in the Gemfile.lock, use the one from the Gemfile.
@@ -669,7 +680,7 @@ module Bundler
669
680
  end
670
681
 
671
682
  def converge_dependencies
672
- frozen = Bundler.settings[:frozen]
683
+ frozen = Bundler.frozen?
673
684
  (@dependencies + @locked_deps.values).each do |dep|
674
685
  locked_source = @locked_deps[dep.name]
675
686
  # This is to make sure that if bundler is installing in deployment mode and
@@ -739,6 +750,8 @@ module Bundler
739
750
  end
740
751
  end
741
752
 
753
+ unlock_source_unlocks_spec = Bundler.feature_flag.unlock_source_unlocks_spec?
754
+
742
755
  converged = []
743
756
  @locked_specs.each do |s|
744
757
  # Replace the locked dependency's source with the equivalent source from the Gemfile
@@ -746,21 +759,33 @@ module Bundler
746
759
  s.source = (dep && dep.source) || sources.get(s.source)
747
760
 
748
761
  # Don't add a spec to the list if its source is expired. For example,
749
- # if you change a Git gem to Rubygems.
762
+ # if you change a Git gem to RubyGems.
750
763
  next if s.source.nil?
751
764
  next if @unlock[:sources].include?(s.source.name)
752
765
 
753
766
  # XXX This is a backwards-compatibility fix to preserve the ability to
754
767
  # unlock a single gem by passing its name via `--source`. See issue #3759
755
768
  # TODO: delete in Bundler 2
756
- next if @unlock[:sources].include?(s.name)
769
+ next if unlock_source_unlocks_spec && @unlock[:sources].include?(s.name)
757
770
 
758
771
  # If the spec is from a path source and it doesn't exist anymore
759
772
  # then we unlock it.
760
773
 
761
774
  # Path sources have special logic
762
775
  if s.source.instance_of?(Source::Path) || s.source.instance_of?(Source::Gemspec)
763
- other = s.source.specs[s].first
776
+ other_sources_specs = begin
777
+ s.source.specs
778
+ rescue PathError, GitError
779
+ # if we won't need the source (according to the lockfile),
780
+ # don't error if the path/git source isn't available
781
+ next if @locked_specs.
782
+ for(requested_dependencies, [], false, true, false).
783
+ none? {|locked_spec| locked_spec.source == s.source }
784
+
785
+ raise
786
+ end
787
+
788
+ other = other_sources_specs[s].first
764
789
 
765
790
  # If the spec is no longer in the path source, unlock it. This
766
791
  # commonly happens if the version changed in the gemspec
@@ -807,17 +832,21 @@ module Bundler
807
832
  # the metadata dependencies here
808
833
  def expanded_dependencies
809
834
  @expanded_dependencies ||= begin
835
+ expand_dependencies(dependencies + metadata_dependencies, @remote)
836
+ end
837
+ end
838
+
839
+ def metadata_dependencies
840
+ @metadata_dependencies ||= begin
810
841
  ruby_versions = concat_ruby_version_requirements(@ruby_version)
811
842
  if ruby_versions.empty? || !@ruby_version.exact?
812
843
  concat_ruby_version_requirements(RubyVersion.system)
813
844
  concat_ruby_version_requirements(locked_ruby_version_object) unless @unlock[:ruby]
814
845
  end
815
-
816
- metadata_dependencies = [
846
+ [
817
847
  Dependency.new("ruby\0", ruby_versions),
818
848
  Dependency.new("rubygems\0", Gem::VERSION),
819
849
  ]
820
- expand_dependencies(dependencies + metadata_dependencies, @remote)
821
850
  end
822
851
  end
823
852
 
@@ -838,11 +867,12 @@ module Bundler
838
867
  end
839
868
 
840
869
  def expand_dependencies(dependencies, remote = false)
870
+ sorted_platforms = Resolver.sort_platforms(@platforms)
841
871
  deps = []
842
872
  dependencies.each do |dep|
843
873
  dep = Dependency.new(dep, ">= 0") unless dep.respond_to?(:name)
844
874
  next if !remote && !dep.current_platform?
845
- platforms = dep.gem_platforms(@platforms)
875
+ platforms = dep.gem_platforms(sorted_platforms)
846
876
  if platforms.empty?
847
877
  mapped_platforms = dep.platforms.map {|p| Dependency::PLATFORM_MAP[p] }
848
878
  Bundler.ui.warn \
@@ -872,11 +902,17 @@ module Bundler
872
902
  # Record the specs available in each gem's source, so that those
873
903
  # specs will be available later when the resolver knows where to
874
904
  # look for that gemspec (or its dependencies)
875
- source_requirements = {}
905
+ default = sources.default_source
906
+ source_requirements = { :default => default }
907
+ default = nil unless Bundler.feature_flag.lockfile_uses_separate_rubygems_sources?
876
908
  dependencies.each do |dep|
877
- next unless dep.source
878
- source_requirements[dep.name] = dep.source.specs
909
+ next unless source = dep.source || default
910
+ source_requirements[dep.name] = source
911
+ end
912
+ metadata_dependencies.each do |dep|
913
+ source_requirements[dep.name] = sources.metadata_source
879
914
  end
915
+ source_requirements["bundler"] = sources.metadata_source # needs to come last to override
880
916
  source_requirements
881
917
  end
882
918
 
@@ -885,7 +921,7 @@ module Bundler
885
921
  specs.each do |s|
886
922
  # TODO: when two sources without blocks is an error, we can change
887
923
  # this check to !s.source.is_a?(Source::LocalRubygems). For now,
888
- # we need to ask every Rubygems for every gem name.
924
+ # we need to ask every RubyGems for every gem name.
889
925
  if s.source.is_a?(Source::Git) || s.source.is_a?(Source::Path)
890
926
  names << s.name
891
927
  end
@@ -895,7 +931,7 @@ module Bundler
895
931
  end
896
932
 
897
933
  def requested_groups
898
- groups - Bundler.settings.without - @optional_groups + Bundler.settings.with
934
+ groups - Bundler.settings[:without] - @optional_groups + Bundler.settings[:with]
899
935
  end
900
936
 
901
937
  def lockfiles_equal?(current, proposed, preserve_unknown_sections)
@@ -930,11 +966,20 @@ module Bundler
930
966
 
931
967
  def additional_base_requirements_for_resolve
932
968
  return [] unless @locked_gems && Bundler.feature_flag.only_update_to_newer_versions?
969
+ dependencies_by_name = dependencies.group_by(&:name)
933
970
  @locked_gems.specs.reduce({}) do |requirements, locked_spec|
934
- dep = Gem::Dependency.new(locked_spec.name, ">= #{locked_spec.version}")
935
- requirements[locked_spec.name] = DepProxy.new(dep, locked_spec.platform)
971
+ name = locked_spec.name
972
+ next requirements if @locked_deps[name] != dependencies_by_name[name]
973
+ dep = Gem::Dependency.new(name, ">= #{locked_spec.version}")
974
+ requirements[name] = DepProxy.new(dep, locked_spec.platform)
936
975
  requirements
937
976
  end.values
938
977
  end
978
+
979
+ def equivalent_rubygems_remotes?(source)
980
+ return false unless source.is_a?(Source::Rubygems)
981
+
982
+ Bundler.settings[:allow_deployment_source_credential_changes] && source.equivalent_remotes?(sources.rubygems_remotes)
983
+ end
939
984
  end
940
985
  end