rubygems-update 2.7.3 → 2.7.11

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 (179) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +6 -30
  3. data/History.txt +146 -0
  4. data/Manifest.txt +5 -4
  5. data/Rakefile +19 -2
  6. data/bundler/CHANGELOG.md +143 -0
  7. data/bundler/README.md +5 -1
  8. data/bundler/bundler.gemspec +4 -1
  9. data/bundler/lib/bundler.rb +12 -8
  10. data/bundler/lib/bundler/build_metadata.rb +19 -2
  11. data/bundler/lib/bundler/cli.rb +3 -1
  12. data/bundler/lib/bundler/cli/check.rb +1 -1
  13. data/bundler/lib/bundler/cli/exec.rb +4 -4
  14. data/bundler/lib/bundler/cli/gem.rb +6 -3
  15. data/bundler/lib/bundler/cli/init.rb +6 -5
  16. data/bundler/lib/bundler/cli/install.rb +2 -2
  17. data/bundler/lib/bundler/cli/outdated.rb +1 -1
  18. data/bundler/lib/bundler/cli/update.rb +6 -4
  19. data/bundler/lib/bundler/compact_index_client/updater.rb +10 -1
  20. data/bundler/lib/bundler/current_ruby.rb +8 -1
  21. data/bundler/lib/bundler/definition.rb +34 -24
  22. data/bundler/lib/bundler/dep_proxy.rb +2 -2
  23. data/bundler/lib/bundler/dependency.rb +1 -0
  24. data/bundler/lib/bundler/deprecate.rb +2 -1
  25. data/bundler/lib/bundler/endpoint_specification.rb +1 -1
  26. data/bundler/lib/bundler/env.rb +10 -8
  27. data/bundler/lib/bundler/fetcher.rb +3 -3
  28. data/bundler/lib/bundler/fetcher/downloader.rb +10 -5
  29. data/bundler/lib/bundler/fetcher/index.rb +2 -2
  30. data/bundler/lib/bundler/friendly_errors.rb +2 -0
  31. data/bundler/lib/bundler/gem_helper.rb +1 -1
  32. data/bundler/lib/bundler/gem_version_promoter.rb +12 -0
  33. data/bundler/lib/bundler/injector.rb +5 -5
  34. data/bundler/lib/bundler/installer.rb +12 -4
  35. data/bundler/lib/bundler/installer/gem_installer.rb +9 -2
  36. data/bundler/lib/bundler/installer/parallel_installer.rb +1 -1
  37. data/bundler/lib/bundler/lazy_specification.rb +1 -1
  38. data/bundler/lib/bundler/mirror.rb +2 -2
  39. data/bundler/lib/bundler/plugin.rb +2 -2
  40. data/bundler/lib/bundler/plugin/index.rb +7 -2
  41. data/bundler/lib/bundler/process_lock.rb +1 -1
  42. data/bundler/lib/bundler/resolver.rb +14 -10
  43. data/bundler/lib/bundler/resolver/spec_group.rb +0 -5
  44. data/bundler/lib/bundler/ruby_version.rb +1 -1
  45. data/bundler/lib/bundler/rubygems_integration.rb +9 -3
  46. data/bundler/lib/bundler/runtime.rb +2 -2
  47. data/bundler/lib/bundler/shared_helpers.rb +15 -3
  48. data/bundler/lib/bundler/source/git.rb +2 -1
  49. data/bundler/lib/bundler/source/git/git_proxy.rb +6 -1
  50. data/bundler/lib/bundler/source/metadata.rb +1 -1
  51. data/bundler/lib/bundler/source/rubygems.rb +13 -6
  52. data/bundler/lib/bundler/source/rubygems/remote.rb +4 -1
  53. data/bundler/lib/bundler/spec_set.rb +4 -1
  54. data/bundler/lib/bundler/templates/.document +1 -0
  55. data/bundler/lib/bundler/templates/Executable +11 -3
  56. data/bundler/lib/bundler/templates/newgem/newgem.gemspec.tt +8 -2
  57. data/bundler/lib/bundler/templates/newgem/{.travis.yml.tt → travis.yml.tt} +2 -0
  58. data/bundler/lib/bundler/ui/shell.rb +3 -1
  59. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb +11 -1
  60. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb +7 -2
  61. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb +1 -1
  62. data/bundler/lib/bundler/version.rb +1 -1
  63. data/bundler/man/bundle-binstubs.ronn +3 -3
  64. data/bundler/man/bundle-check.ronn +3 -3
  65. data/bundler/man/bundle-config.ronn +13 -9
  66. data/bundler/man/bundle-doctor.ronn +33 -0
  67. data/bundler/man/bundle-exec.ronn +3 -3
  68. data/bundler/man/bundle-gem.ronn +1 -1
  69. data/bundler/man/bundle-init.ronn +15 -4
  70. data/bundler/man/bundle-inject.ronn +3 -3
  71. data/bundler/man/bundle-install.ronn +12 -3
  72. data/bundler/man/bundle-lock.ronn +1 -1
  73. data/bundler/man/bundle-outdated.ronn +1 -1
  74. data/bundler/man/bundle-package.ronn +3 -3
  75. data/bundler/man/bundle-show.ronn +3 -2
  76. data/bundler/man/bundle-update.ronn +18 -14
  77. data/bundler/man/bundle-viz.ronn +1 -1
  78. data/bundler/man/bundle.ronn +27 -27
  79. data/bundler/man/gemfile.5.ronn +24 -9
  80. data/lib/rubygems.rb +30 -17
  81. data/lib/rubygems/bundler_version_finder.rb +9 -22
  82. data/lib/rubygems/command.rb +9 -1
  83. data/lib/rubygems/command_manager.rb +6 -4
  84. data/lib/rubygems/commands/generate_index_command.rb +1 -1
  85. data/lib/rubygems/commands/install_command.rb +7 -0
  86. data/lib/rubygems/commands/owner_command.rb +4 -1
  87. data/lib/rubygems/commands/push_command.rb +37 -4
  88. data/lib/rubygems/commands/setup_command.rb +22 -7
  89. data/lib/rubygems/commands/uninstall_command.rb +1 -1
  90. data/lib/rubygems/commands/unpack_command.rb +3 -3
  91. data/lib/rubygems/config_file.rb +1 -1
  92. data/lib/rubygems/core_ext/kernel_require.rb +2 -7
  93. data/lib/rubygems/dependency.rb +1 -0
  94. data/lib/rubygems/dependency_installer.rb +4 -2
  95. data/lib/rubygems/exceptions.rb +5 -1
  96. data/lib/rubygems/ext/builder.rb +1 -1
  97. data/lib/rubygems/gemcutter_utilities.rb +5 -2
  98. data/lib/rubygems/indexer.rb +6 -5
  99. data/lib/rubygems/install_update_options.rb +1 -1
  100. data/lib/rubygems/installer.rb +38 -10
  101. data/lib/rubygems/package.rb +54 -7
  102. data/lib/rubygems/package/file_source.rb +2 -2
  103. data/lib/rubygems/package/old.rb +1 -1
  104. data/lib/rubygems/package/tar_header.rb +17 -10
  105. data/lib/rubygems/package/tar_writer.rb +4 -3
  106. data/lib/rubygems/remote_fetcher.rb +1 -1
  107. data/lib/rubygems/request_set.rb +28 -17
  108. data/lib/rubygems/request_set/lockfile.rb +1 -1
  109. data/lib/rubygems/requirement.rb +14 -3
  110. data/lib/rubygems/resolver/api_specification.rb +5 -0
  111. data/lib/rubygems/security.rb +7 -2
  112. data/lib/rubygems/security/trust_dir.rb +1 -1
  113. data/lib/rubygems/server.rb +16 -4
  114. data/lib/rubygems/source.rb +2 -2
  115. data/lib/rubygems/specification.rb +22 -14
  116. data/lib/rubygems/ssl_certs/{index.rubygems.org → rubygems.org}/GlobalSignRootCA.pem +0 -0
  117. data/lib/rubygems/ssl_certs/rubygems.org/GlobalSignRootCA_R3.pem +21 -0
  118. data/lib/rubygems/stub_specification.rb +2 -0
  119. data/lib/rubygems/test_case.rb +36 -12
  120. data/lib/rubygems/test_utilities.rb +2 -2
  121. data/lib/rubygems/user_interaction.rb +9 -2
  122. data/lib/rubygems/util.rb +2 -1
  123. data/lib/rubygems/util/licenses.rb +35 -4
  124. data/lib/rubygems/validator.rb +3 -3
  125. data/lib/rubygems/version.rb +7 -1
  126. data/lib/ubygems.rb +3 -0
  127. data/test/rubygems/test_bundled_ca.rb +7 -4
  128. data/test/rubygems/test_gem.rb +62 -24
  129. data/test/rubygems/test_gem_bundler_version_finder.rb +8 -7
  130. data/test/rubygems/test_gem_command_manager.rb +2 -2
  131. data/test/rubygems/test_gem_commands_build_command.rb +2 -0
  132. data/test/rubygems/test_gem_commands_cleanup_command.rb +1 -1
  133. data/test/rubygems/test_gem_commands_install_command.rb +38 -0
  134. data/test/rubygems/test_gem_commands_owner_command.rb +25 -0
  135. data/test/rubygems/test_gem_commands_push_command.rb +25 -5
  136. data/test/rubygems/test_gem_commands_setup_command.rb +46 -21
  137. data/test/rubygems/test_gem_commands_signin_command.rb +1 -1
  138. data/test/rubygems/test_gem_commands_uninstall_command.rb +3 -3
  139. data/test/rubygems/test_gem_dependency.rb +1 -1
  140. data/test/rubygems/test_gem_dependency_installer.rb +1 -1
  141. data/test/rubygems/test_gem_doctor.rb +2 -2
  142. data/test/rubygems/test_gem_ext_builder.rb +6 -6
  143. data/test/rubygems/test_gem_ext_rake_builder.rb +0 -4
  144. data/test/rubygems/test_gem_gemcutter_utilities.rb +4 -4
  145. data/test/rubygems/test_gem_indexer.rb +1 -2
  146. data/test/rubygems/test_gem_install_update_options.rb +4 -0
  147. data/test/rubygems/test_gem_installer.rb +114 -4
  148. data/test/rubygems/test_gem_package.rb +178 -21
  149. data/test/rubygems/test_gem_package_old.rb +1 -1
  150. data/test/rubygems/test_gem_package_tar_header.rb +21 -0
  151. data/test/rubygems/test_gem_rdoc.rb +2 -0
  152. data/test/rubygems/test_gem_remote_fetcher.rb +7 -3
  153. data/test/rubygems/test_gem_request.rb +5 -2
  154. data/test/rubygems/test_gem_request_connection_pools.rb +6 -7
  155. data/test/rubygems/test_gem_request_set.rb +7 -7
  156. data/test/rubygems/test_gem_request_set_lockfile.rb +4 -4
  157. data/test/rubygems/test_gem_request_set_lockfile_parser.rb +1 -1
  158. data/test/rubygems/test_gem_request_set_lockfile_tokenizer.rb +1 -1
  159. data/test/rubygems/test_gem_requirement.rb +6 -0
  160. data/test/rubygems/test_gem_resolver_api_specification.rb +24 -0
  161. data/test/rubygems/test_gem_resolver_git_specification.rb +1 -1
  162. data/test/rubygems/test_gem_resolver_installer_set.rb +1 -1
  163. data/test/rubygems/test_gem_security_policy.rb +3 -3
  164. data/test/rubygems/test_gem_server.rb +177 -12
  165. data/test/rubygems/test_gem_source.rb +3 -3
  166. data/test/rubygems/test_gem_source_git.rb +1 -1
  167. data/test/rubygems/test_gem_specification.rb +64 -31
  168. data/test/rubygems/test_gem_stream_ui.rb +2 -2
  169. data/test/rubygems/test_gem_stub_specification.rb +7 -7
  170. data/test/rubygems/test_gem_text.rb +5 -0
  171. data/test/rubygems/test_gem_util.rb +25 -0
  172. data/test/rubygems/test_gem_version.rb +40 -2
  173. data/test/rubygems/test_require.rb +15 -21
  174. data/util/ci +1 -0
  175. data/util/generate_spdx_license_list.rb +15 -6
  176. data/util/update_bundled_ca_certificates.rb +1 -3
  177. metadata +14 -13
  178. data/lib/rubygems/ssl_certs/rubygems.global.ssl.fastly.net/DigiCertHighAssuranceEVRootCA.pem +0 -23
  179. data/lib/rubygems/ssl_certs/rubygems.org/AddTrustExternalCARoot.pem +0 -25
@@ -9,7 +9,8 @@ Gem::Specification.new do |s|
9
9
  s.version = Bundler::VERSION
10
10
  s.license = "MIT"
11
11
  s.authors = [
12
- "André Arko", "Samuel Giddins", "Chris Morris", "James Wen", "Tim Moore",
12
+ "André Arko", "Samuel Giddins", "Colby Swandale", "Hiroshi Shibata",
13
+ "David Rodríguez", "Grey Baker", "Stephanie Morillo", "Chris Morris", "James Wen", "Tim Moore",
13
14
  "André Medeiros", "Jessica Lynn Suttles", "Terence Lee", "Carl Lerche",
14
15
  "Yehuda Katz"
15
16
  ]
@@ -48,6 +49,8 @@ Gem::Specification.new do |s|
48
49
  s.files += Dir.glob("man/**/*")
49
50
  # Include the CHANGELOG.md, LICENSE.md, README.md manually
50
51
  s.files += %w[CHANGELOG.md LICENSE.md README.md]
52
+ # include the gemspec itself because warbler breaks w/o it
53
+ s.files += %w[bundler.gemspec]
51
54
 
52
55
  s.bindir = "exe"
53
56
  s.executables = %w[bundle bundler]
@@ -136,7 +136,7 @@ module Bundler
136
136
  end
137
137
  end
138
138
 
139
- def frozen?
139
+ def frozen_bundle?
140
140
  frozen = settings[:deployment]
141
141
  frozen ||= settings[:frozen] unless feature_flag.deployment_means_frozen?
142
142
  frozen
@@ -159,16 +159,18 @@ module Bundler
159
159
  def user_home
160
160
  @user_home ||= begin
161
161
  home = Bundler.rubygems.user_home
162
+ bundle_home = home ? File.join(home, ".bundle") : nil
162
163
 
163
164
  warning = if home.nil?
164
165
  "Your home directory is not set."
165
166
  elsif !File.directory?(home)
166
167
  "`#{home}` is not a directory."
167
- elsif !File.writable?(home)
168
+ elsif !File.writable?(home) && (!File.directory?(bundle_home) || !File.writable?(bundle_home))
168
169
  "`#{home}` is not writable."
169
170
  end
170
171
 
171
172
  if warning
173
+ Kernel.send(:require, "etc")
172
174
  user_home = tmp_home_path(Etc.getlogin, warning)
173
175
  Bundler.ui.warn "#{warning}\nBundler will use `#{user_home}' as your home directory temporarily.\n"
174
176
  user_home
@@ -189,7 +191,7 @@ module Bundler
189
191
  end
190
192
  tmp_home_path.join(login).tap(&:mkpath)
191
193
  end
192
- rescue => e
194
+ rescue RuntimeError => e
193
195
  raise e.exception("#{warning}\nBundler also failed to create a temporary home directory at `#{path}':\n#{e}")
194
196
  end
195
197
 
@@ -359,8 +361,8 @@ EOF
359
361
  @requires_sudo = settings.allow_sudo? && sudo_present && sudo_needed
360
362
  end
361
363
 
362
- def mkdir_p(path)
363
- if requires_sudo?
364
+ def mkdir_p(path, options = {})
365
+ if requires_sudo? && !options[:no_sudo]
364
366
  sudo "mkdir -p '#{path}'" unless File.exist?(path)
365
367
  else
366
368
  SharedHelpers.filesystem_access(path, :write) do |p|
@@ -407,12 +409,14 @@ EOF
407
409
  end
408
410
 
409
411
  def read_file(file)
410
- File.open(file, "rb", &:read)
412
+ SharedHelpers.filesystem_access(file, :read) do
413
+ File.open(file, "r:UTF-8", &:read)
414
+ end
411
415
  end
412
416
 
413
417
  def load_marshal(data)
414
418
  Marshal.load(data)
415
- rescue => e
419
+ rescue StandardError => e
416
420
  raise MarshalError, "#{e.class}: #{e.message}"
417
421
  end
418
422
 
@@ -427,7 +431,7 @@ EOF
427
431
 
428
432
  def load_gemspec_uncached(file, validate = false)
429
433
  path = Pathname.new(file)
430
- contents = path.read
434
+ contents = read_file(file)
431
435
  spec = if contents.start_with?("---") # YAML header
432
436
  eval_yaml_gemspec(path, contents)
433
437
  else
@@ -4,6 +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 = "2020-12-09".freeze
8
+ @git_commit_sha = "8a789f00bf".freeze
7
9
  @release = false
8
10
  # end ivars
9
11
 
@@ -23,9 +25,24 @@ module Bundler
23
25
 
24
26
  # The SHA for the git commit the bundler gem was built from.
25
27
  def self.git_commit_sha
26
- @git_commit_sha ||= Dir.chdir(File.expand_path("..", __FILE__)) do
27
- `git rev-parse --short HEAD`.strip.freeze
28
+ return @git_commit_sha if @git_commit_sha
29
+
30
+ # If Bundler has been installed without its .git directory and without a
31
+ # commit instance variable then we can't determine its commits SHA.
32
+ git_dir = File.join(File.expand_path("../../..", __FILE__), ".git")
33
+ if File.directory?(git_dir)
34
+ return @git_commit_sha = Dir.chdir(git_dir) { `git rev-parse --short HEAD`.strip.freeze }
35
+ end
36
+
37
+ # If Bundler is a submodule in RubyGems, get the submodule commit
38
+ git_sub_dir = File.join(File.expand_path("../../../..", __FILE__), ".git")
39
+ if File.directory?(git_sub_dir)
40
+ return @git_commit_sha = Dir.chdir(git_sub_dir) do
41
+ `git ls-tree --abbrev=8 HEAD bundler`.split(/\s/).fetch(2, "").strip.freeze
42
+ end
28
43
  end
44
+
45
+ @git_commit_sha ||= "unknown"
29
46
  end
30
47
 
31
48
  # Whether this is an official release build of Bundler.
@@ -717,6 +717,8 @@ module Bundler
717
717
  command_name = current_command.name
718
718
  return if PARSEABLE_COMMANDS.include?(command_name)
719
719
 
720
+ return unless SharedHelpers.md5_available?
721
+
720
722
  latest = Fetcher::CompactIndex.
721
723
  new(nil, Source::Rubygems::Remote.new(URI("https://rubygems.org")), nil).
722
724
  send(:compact_index_client).
@@ -739,7 +741,7 @@ module Bundler
739
741
  end
740
742
 
741
743
  Bundler.ui.warn "The latest bundler is #{latest}, but you are currently running #{current}.\n#{suggestion}"
742
- rescue
744
+ rescue RuntimeError
743
745
  nil
744
746
  end
745
747
  end
@@ -26,7 +26,7 @@ module Bundler
26
26
  not_installed.each {|s| Bundler.ui.error " * #{s.name} (#{s.version})" }
27
27
  Bundler.ui.warn "Install missing gems with `bundle install`"
28
28
  exit 1
29
- elsif !Bundler.default_lockfile.file? && Bundler.frozen?
29
+ elsif !Bundler.default_lockfile.file? && Bundler.frozen_bundle?
30
30
  Bundler.ui.error "This bundle has been frozen, but there is no #{Bundler.default_lockfile.relative_path_from(SharedHelpers.pwd)} present"
31
31
  exit 1
32
32
  else
@@ -6,7 +6,7 @@ module Bundler
6
6
  class CLI::Exec
7
7
  attr_reader :options, :args, :cmd
8
8
 
9
- RESERVED_SIGNALS = %w[SEGV BUS ILL FPE VTALRM KILL STOP].freeze
9
+ TRAPPED_SIGNALS = %w[INT].freeze
10
10
 
11
11
  def initialize(options, args)
12
12
  @options = options
@@ -70,15 +70,14 @@ module Bundler
70
70
  ui = Bundler.ui
71
71
  Bundler.ui = nil
72
72
  require "bundler/setup"
73
- signals = Signal.list.keys - RESERVED_SIGNALS
74
- signals.each {|s| trap(s, "DEFAULT") }
73
+ TRAPPED_SIGNALS.each {|s| trap(s, "DEFAULT") }
75
74
  Kernel.load(file)
76
75
  rescue SystemExit, SignalException
77
76
  raise
78
77
  rescue Exception => e # rubocop:disable Lint/RescueException
79
78
  Bundler.ui = ui
80
79
  Bundler.ui.error "bundler: failed to load command: #{cmd} (#{file})"
81
- backtrace = e.backtrace.take_while {|bt| !bt.start_with?(__FILE__) }
80
+ backtrace = e.backtrace ? e.backtrace.take_while {|bt| !bt.start_with?(__FILE__) } : []
82
81
  abort "#{e.class}: #{e.message}\n #{backtrace.join("\n ")}"
83
82
  end
84
83
 
@@ -90,6 +89,7 @@ module Bundler
90
89
  possibilities = [
91
90
  "#!/usr/bin/env ruby\n",
92
91
  "#!/usr/bin/env jruby\n",
92
+ "#!/usr/bin/env truffleruby\n",
93
93
  "#!#{Gem.ruby}\n",
94
94
  ]
95
95
 
@@ -83,7 +83,7 @@ module Bundler
83
83
  config[:test] = test_framework
84
84
  config[:test_framework_version] = TEST_FRAMEWORK_VERSIONS[test_framework]
85
85
 
86
- templates.merge!(".travis.yml.tt" => ".travis.yml")
86
+ templates.merge!("travis.yml.tt" => ".travis.yml")
87
87
 
88
88
  case test_framework
89
89
  when "rspec"
@@ -105,7 +105,7 @@ module Bundler
105
105
  if ask_and_set(:mit, "Do you want to license your code permissively under the MIT license?",
106
106
  "This means that any other developer or company will be legally allowed to use your code " \
107
107
  "for free as long as they admit you created it. You can read more about the MIT license " \
108
- "at http://choosealicense.com/licenses/mit.")
108
+ "at https://choosealicense.com/licenses/mit.")
109
109
  config[:mit] = true
110
110
  Bundler.ui.info "MIT License enabled in config"
111
111
  templates.merge!("LICENSE.txt.tt" => "LICENSE.txt")
@@ -118,7 +118,7 @@ module Bundler
118
118
  "of enforcing it, so be sure that you are prepared to do that. Be sure that your email " \
119
119
  "address is specified as a contact in the generated code of conduct so that people know " \
120
120
  "who to contact in case of a violation. For suggestions about " \
121
- "how to enforce codes of conduct, see http://bit.ly/coc-enforcement.")
121
+ "how to enforce codes of conduct, see https://bit.ly/coc-enforcement.")
122
122
  config[:coc] = true
123
123
  Bundler.ui.info "Code of conduct enabled in config"
124
124
  templates.merge!("CODE_OF_CONDUCT.md.tt" => "CODE_OF_CONDUCT.md")
@@ -158,6 +158,9 @@ module Bundler
158
158
 
159
159
  # Open gemspec in editor
160
160
  open_editor(options["edit"], target.join("#{name}.gemspec")) if options[:edit]
161
+
162
+ Bundler.ui.info "Gem '#{name}' was successfully created. " \
163
+ "For more information on making a RubyGem visit https://bundler.io/guides/creating_gem.html"
161
164
  rescue Errno::EEXIST => e
162
165
  raise GenericSystemCallError.new(e, "There was a conflict while creating the new gem.")
163
166
  end
@@ -13,6 +13,11 @@ module Bundler
13
13
  exit 1
14
14
  end
15
15
 
16
+ unless File.writable?(Dir.pwd)
17
+ Bundler.ui.error "Can not create #{gemfile} as the current directory is not writable."
18
+ exit 1
19
+ end
20
+
16
21
  if options[:gemspec]
17
22
  gemspec = File.expand_path(options[:gemspec])
18
23
  unless File.exist?(gemspec)
@@ -36,11 +41,7 @@ module Bundler
36
41
  private
37
42
 
38
43
  def gemfile
39
- @gemfile ||= begin
40
- Bundler.default_gemfile
41
- rescue GemfileNotFound
42
- Bundler.feature_flag.init_gems_rb? ? "gems.rb" : "Gemfile"
43
- end
44
+ @gemfile ||= Bundler.feature_flag.init_gems_rb? ? "gems.rb" : "Gemfile"
44
45
  end
45
46
  end
46
47
  end
@@ -23,7 +23,7 @@ module Bundler
23
23
 
24
24
  check_trust_policy
25
25
 
26
- if options[:deployment] || options[:frozen] || Bundler.frozen?
26
+ if options[:deployment] || options[:frozen] || Bundler.frozen_bundle?
27
27
  unless Bundler.default_lockfile.exist?
28
28
  flag = "--deployment flag" if options[:deployment]
29
29
  flag ||= "--frozen flag" if options[:frozen]
@@ -63,7 +63,7 @@ module Bundler
63
63
  definition.validate_runtime!
64
64
 
65
65
  installer = Installer.install(Bundler.root, definition, options)
66
- Bundler.load.cache if Bundler.app_cache.exist? && !options["no-cache"] && !Bundler.frozen?
66
+ Bundler.load.cache if Bundler.app_cache.exist? && !options["no-cache"] && !Bundler.frozen_bundle?
67
67
 
68
68
  Bundler.ui.confirm "Bundle complete! #{dependencies_count_for(definition)}, #{gems_installed_for(definition)}."
69
69
  Bundler::CLI::Common.output_without_groups_message
@@ -213,7 +213,7 @@ module Bundler
213
213
  end
214
214
 
215
215
  def check_for_deployment_mode
216
- return unless Bundler.frozen?
216
+ return unless Bundler.frozen_bundle?
217
217
  suggested_command = if Bundler.settings.locations("frozen")[:global]
218
218
  "bundle config --delete frozen"
219
219
  elsif Bundler.settings.locations("deployment").keys.&([:global, :local]).any?
@@ -38,8 +38,8 @@ module Bundler
38
38
  Bundler::CLI::Common.ensure_all_gems_in_lockfile!(gems)
39
39
 
40
40
  if groups.any?
41
- specs = Bundler.definition.specs_for groups
42
- gems.concat(specs.map(&:name))
41
+ deps = Bundler.definition.dependencies.select {|d| (d.groups & groups).any? }
42
+ gems.concat(deps.map(&:name))
43
43
  end
44
44
 
45
45
  Bundler.definition(:gems => gems, :sources => sources, :ruby => options[:ruby],
@@ -68,13 +68,15 @@ module Bundler
68
68
 
69
69
  if locked_gems = Bundler.definition.locked_gems
70
70
  gems.each do |name|
71
- locked_version = locked_gems.specs.find {|s| s.name == name }.version
71
+ locked_version = locked_gems.specs.find {|s| s.name == name }
72
+ locked_version &&= locked_version.version
73
+ next unless locked_version
72
74
  new_version = Bundler.definition.specs[name].first
73
75
  new_version &&= new_version.version
74
76
  if !new_version
75
77
  Bundler.ui.warn "Bundler attempted to update #{name} but it was removed from the bundle"
76
78
  elsif new_version < locked_version
77
- Bundler.ui.warn "Bundler attempted to update #{name} but its version regressed from #{locked_version} to #{new_version}"
79
+ Bundler.ui.warn "Note: #{name} version regressed from #{locked_version} to #{new_version}"
78
80
  elsif new_version == locked_version
79
81
  Bundler.ui.warn "Bundler attempted to update #{name} but its version stayed the same"
80
82
  end
@@ -33,7 +33,9 @@ module Bundler
33
33
 
34
34
  # first try to fetch any new bytes on the existing file
35
35
  if retrying.nil? && local_path.file?
36
- FileUtils.cp local_path, local_temp_path
36
+ SharedHelpers.filesystem_access(local_temp_path) do
37
+ FileUtils.cp local_path, local_temp_path
38
+ end
37
39
  headers["If-None-Match"] = etag_for(local_temp_path)
38
40
  headers["Range"] =
39
41
  if local_temp_path.size.nonzero?
@@ -78,6 +80,13 @@ module Bundler
78
80
 
79
81
  update(local_path, remote_path, :retrying)
80
82
  end
83
+ rescue Errno::EACCES
84
+ raise Bundler::PermissionError,
85
+ "Bundler does not have write access to create a temp directory " \
86
+ "within #{Dir.tmpdir}. Bundler must have write access to your " \
87
+ "systems temp directory to function properly. "
88
+ rescue Zlib::GzipFile::Error
89
+ raise Bundler::HTTPError
81
90
  end
82
91
 
83
92
  def etag_for(path)
@@ -18,6 +18,7 @@ module Bundler
18
18
  2.3
19
19
  2.4
20
20
  2.5
21
+ 2.6
21
22
  ].freeze
22
23
 
23
24
  KNOWN_MAJOR_VERSIONS = KNOWN_MINOR_VERSIONS.map {|v| v.split(".", 2).first }.uniq.freeze
@@ -31,11 +32,13 @@ module Bundler
31
32
  mswin64
32
33
  rbx
33
34
  ruby
35
+ truffleruby
34
36
  x64_mingw
35
37
  ].freeze
36
38
 
37
39
  def ruby?
38
- !mswin? && (!defined?(RUBY_ENGINE) || RUBY_ENGINE == "ruby" || RUBY_ENGINE == "rbx" || RUBY_ENGINE == "maglev")
40
+ !mswin? && (!defined?(RUBY_ENGINE) || RUBY_ENGINE == "ruby" ||
41
+ RUBY_ENGINE == "rbx" || RUBY_ENGINE == "maglev" || RUBY_ENGINE == "truffleruby")
39
42
  end
40
43
 
41
44
  def mri?
@@ -54,6 +57,10 @@ module Bundler
54
57
  defined?(RUBY_ENGINE) && RUBY_ENGINE == "maglev"
55
58
  end
56
59
 
60
+ def truffleruby?
61
+ defined?(RUBY_ENGINE) && RUBY_ENGINE == "truffleruby"
62
+ end
63
+
57
64
  def mswin?
58
65
  Bundler::WINDOWS
59
66
  end
@@ -77,6 +77,7 @@ module Bundler
77
77
  @lockfile_contents = String.new
78
78
  @locked_bundler_version = nil
79
79
  @locked_ruby_version = nil
80
+ @locked_specs_incomplete_for_platform = false
80
81
 
81
82
  if lockfile && File.exist?(lockfile)
82
83
  @lockfile_contents = Bundler.read_file(lockfile)
@@ -113,15 +114,15 @@ module Bundler
113
114
  end
114
115
  @unlocking ||= @unlock[:ruby] ||= (!@locked_ruby_version ^ !@ruby_version)
115
116
 
116
- add_current_platform unless Bundler.frozen?
117
+ add_current_platform unless Bundler.frozen_bundle?
117
118
 
118
119
  converge_path_sources_to_gemspec_sources
119
120
  @path_changes = converge_paths
120
121
  @source_changes = converge_sources
121
122
 
122
123
  unless @unlock[:lock_shared_dependencies]
123
- eager_unlock = expand_dependencies(@unlock[:gems])
124
- @unlock[:gems] = @locked_specs.for(eager_unlock).map(&:name)
124
+ eager_unlock = expand_dependencies(@unlock[:gems], true)
125
+ @unlock[:gems] = @locked_specs.for(eager_unlock, [], false, false, false).map(&:name)
125
126
  end
126
127
 
127
128
  @gem_version_promoter = create_gem_version_promoter
@@ -175,7 +176,7 @@ module Bundler
175
176
  raise GemNotFound, "Your bundle is locked to #{locked_gem}, but that version could not " \
176
177
  "be found in any of the sources listed in your Gemfile. If you haven't changed sources, " \
177
178
  "that means the author of #{locked_gem} has removed it. You'll need to update your bundle " \
178
- "to a different version of #{locked_gem} that hasn't been removed in order to install."
179
+ "to a version other than #{locked_gem} that hasn't been removed in order to install."
179
180
  end
180
181
  unless specs["bundler"].any?
181
182
  bundler = sources.metadata_source.specs.search(Gem::Dependency.new("bundler", VERSION)).last
@@ -245,17 +246,22 @@ module Bundler
245
246
  def resolve
246
247
  @resolve ||= begin
247
248
  last_resolve = converge_locked_specs
248
- if Bundler.frozen?
249
- Bundler.ui.debug "Frozen, using resolution from the lockfile"
250
- last_resolve
251
- elsif !unlocking? && nothing_changed?
252
- Bundler.ui.debug("Found no changes, using resolution from the lockfile")
253
- last_resolve
254
- else
255
- # Run a resolve against the locally available gems
256
- Bundler.ui.debug("Found changes from the lockfile, re-resolving dependencies because #{change_reason}")
257
- last_resolve.merge Resolver.resolve(expanded_dependencies, index, source_requirements, last_resolve, gem_version_promoter, additional_base_requirements_for_resolve, platforms)
258
- end
249
+ resolve =
250
+ if Bundler.frozen_bundle?
251
+ Bundler.ui.debug "Frozen, using resolution from the lockfile"
252
+ last_resolve
253
+ elsif !unlocking? && nothing_changed?
254
+ Bundler.ui.debug("Found no changes, using resolution from the lockfile")
255
+ last_resolve
256
+ else
257
+ # Run a resolve against the locally available gems
258
+ Bundler.ui.debug("Found changes from the lockfile, re-resolving dependencies because #{change_reason}")
259
+ last_resolve.merge Resolver.resolve(expanded_dependencies, index, source_requirements, last_resolve, gem_version_promoter, additional_base_requirements_for_resolve, platforms)
260
+ end
261
+
262
+ # filter out gems that _can_ be installed on multiple platforms, but don't need
263
+ # to be
264
+ resolve.for(expand_dependencies(dependencies, true), [], false, false, false)
259
265
  end
260
266
  end
261
267
 
@@ -295,7 +301,7 @@ module Bundler
295
301
  end
296
302
 
297
303
  sources.all_sources.each do |source|
298
- source.double_check_for(unmet_dependency_names, :override_dupes)
304
+ source.double_check_for(unmet_dependency_names)
299
305
  end
300
306
 
301
307
  break if idxcount == idx.size
@@ -336,10 +342,11 @@ module Bundler
336
342
  end
337
343
  end
338
344
 
339
- preserve_unknown_sections ||= !updating_major && (Bundler.frozen? || !(unlocking? || @unlocking_bundler))
340
- return if lockfiles_equal?(@lockfile_contents, contents, preserve_unknown_sections)
345
+ preserve_unknown_sections ||= !updating_major && (Bundler.frozen_bundle? || !(unlocking? || @unlocking_bundler))
346
+
347
+ return if file && File.exist?(file) && lockfiles_equal?(@lockfile_contents, contents, preserve_unknown_sections)
341
348
 
342
- if Bundler.frozen?
349
+ if Bundler.frozen_bundle?
343
350
  Bundler.ui.error "Cannot write a changed lockfile while frozen."
344
351
  return
345
352
  end
@@ -530,7 +537,7 @@ module Bundler
530
537
  private :sources
531
538
 
532
539
  def nothing_changed?
533
- !@source_changes && !@dependency_changes && !@new_platform && !@path_changes && !@local_changes
540
+ !@source_changes && !@dependency_changes && !@new_platform && !@path_changes && !@local_changes && !@locked_specs_incomplete_for_platform
534
541
  end
535
542
 
536
543
  def unlocking?
@@ -557,6 +564,7 @@ module Bundler
557
564
  [@new_platform, "you added a new platform to your gemfile"],
558
565
  [@path_changes, "the gemspecs for path gems changed"],
559
566
  [@local_changes, "the gemspecs for git local gems changed"],
567
+ [@locked_specs_incomplete_for_platform, "the lockfile does not have all gems needed for the current platform"],
560
568
  ].select(&:first).map(&:last).join(", ")
561
569
  end
562
570
 
@@ -682,7 +690,7 @@ module Bundler
682
690
  end
683
691
 
684
692
  def converge_dependencies
685
- frozen = Bundler.frozen?
693
+ frozen = Bundler.frozen_bundle?
686
694
  (@dependencies + @locked_deps.values).each do |dep|
687
695
  locked_source = @locked_deps[dep.name]
688
696
  # This is to make sure that if bundler is installing in deployment mode and
@@ -803,7 +811,9 @@ module Bundler
803
811
  end
804
812
 
805
813
  resolve = SpecSet.new(converged)
806
- resolve = resolve.for(expand_dependencies(deps, true), @unlock[:gems], false, false, false)
814
+ expanded_deps = expand_dependencies(deps, true)
815
+ @locked_specs_incomplete_for_platform = !resolve.for(expanded_deps, @unlock[:gems], true, true)
816
+ resolve = resolve.for(expanded_deps, @unlock[:gems], false, false, false)
807
817
  diff = nil
808
818
 
809
819
  # Now, we unlock any sources that do not have anymore gems pinned to it
@@ -965,10 +975,10 @@ module Bundler
965
975
 
966
976
  def additional_base_requirements_for_resolve
967
977
  return [] unless @locked_gems && Bundler.feature_flag.only_update_to_newer_versions?
968
- dependencies_by_name = dependencies.group_by(&:name)
978
+ dependencies_by_name = dependencies.inject({}) {|memo, dep| memo.update(dep.name => dep) }
969
979
  @locked_gems.specs.reduce({}) do |requirements, locked_spec|
970
980
  name = locked_spec.name
971
- next requirements if @locked_deps[name] != dependencies_by_name[name]
981
+ next requirements if @locked_gems.dependencies[name] != dependencies_by_name[name]
972
982
  dep = Gem::Dependency.new(name, ">= #{locked_spec.version}")
973
983
  requirements[name] = DepProxy.new(dep, locked_spec.platform)
974
984
  requirements