rubygems-update 2.7.6 → 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 (148) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +2 -23
  3. data/History.txt +116 -0
  4. data/Manifest.txt +3 -3
  5. data/Rakefile +12 -2
  6. data/bundler/CHANGELOG.md +130 -0
  7. data/bundler/README.md +5 -1
  8. data/bundler/bundler.gemspec +2 -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 +5 -2
  15. data/bundler/lib/bundler/cli/init.rb +5 -0
  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 +3 -3
  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 +33 -23
  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 +10 -9
  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 +11 -2
  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/Executable +1 -1
  55. data/bundler/lib/bundler/templates/newgem/newgem.gemspec.tt +8 -2
  56. data/bundler/lib/bundler/templates/newgem/travis.yml.tt +2 -0
  57. data/bundler/lib/bundler/ui/shell.rb +3 -1
  58. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb +11 -1
  59. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb +7 -2
  60. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb +1 -1
  61. data/bundler/lib/bundler/version.rb +1 -1
  62. data/bundler/man/bundle-binstubs.ronn +3 -3
  63. data/bundler/man/bundle-check.ronn +3 -3
  64. data/bundler/man/bundle-config.ronn +13 -9
  65. data/bundler/man/bundle-doctor.ronn +33 -0
  66. data/bundler/man/bundle-exec.ronn +3 -3
  67. data/bundler/man/bundle-gem.ronn +1 -1
  68. data/bundler/man/bundle-init.ronn +15 -4
  69. data/bundler/man/bundle-inject.ronn +3 -3
  70. data/bundler/man/bundle-install.ronn +12 -3
  71. data/bundler/man/bundle-lock.ronn +1 -1
  72. data/bundler/man/bundle-outdated.ronn +1 -1
  73. data/bundler/man/bundle-package.ronn +3 -3
  74. data/bundler/man/bundle-show.ronn +3 -2
  75. data/bundler/man/bundle-update.ronn +18 -14
  76. data/bundler/man/bundle-viz.ronn +1 -1
  77. data/bundler/man/bundle.ronn +27 -27
  78. data/bundler/man/gemfile.5.ronn +24 -9
  79. data/lib/rubygems.rb +24 -11
  80. data/lib/rubygems/bundler_version_finder.rb +9 -22
  81. data/lib/rubygems/command_manager.rb +6 -4
  82. data/lib/rubygems/commands/install_command.rb +7 -0
  83. data/lib/rubygems/commands/owner_command.rb +4 -1
  84. data/lib/rubygems/commands/push_command.rb +37 -4
  85. data/lib/rubygems/commands/setup_command.rb +3 -3
  86. data/lib/rubygems/commands/uninstall_command.rb +1 -1
  87. data/lib/rubygems/commands/unpack_command.rb +1 -1
  88. data/lib/rubygems/core_ext/kernel_require.rb +2 -7
  89. data/lib/rubygems/dependency.rb +1 -0
  90. data/lib/rubygems/dependency_installer.rb +4 -2
  91. data/lib/rubygems/exceptions.rb +5 -1
  92. data/lib/rubygems/gemcutter_utilities.rb +5 -2
  93. data/lib/rubygems/indexer.rb +1 -1
  94. data/lib/rubygems/install_update_options.rb +1 -1
  95. data/lib/rubygems/installer.rb +29 -6
  96. data/lib/rubygems/package.rb +20 -2
  97. data/lib/rubygems/package/tar_header.rb +3 -1
  98. data/lib/rubygems/package/tar_writer.rb +2 -3
  99. data/lib/rubygems/remote_fetcher.rb +1 -1
  100. data/lib/rubygems/request_set.rb +28 -17
  101. data/lib/rubygems/requirement.rb +14 -3
  102. data/lib/rubygems/resolver/api_specification.rb +5 -0
  103. data/lib/rubygems/security.rb +6 -1
  104. data/lib/rubygems/server.rb +3 -3
  105. data/lib/rubygems/source.rb +1 -1
  106. data/lib/rubygems/specification.rb +7 -10
  107. data/lib/rubygems/ssl_certs/{index.rubygems.org → rubygems.org}/GlobalSignRootCA.pem +0 -0
  108. data/lib/rubygems/ssl_certs/rubygems.org/GlobalSignRootCA_R3.pem +21 -0
  109. data/lib/rubygems/test_case.rb +22 -4
  110. data/lib/rubygems/test_utilities.rb +1 -1
  111. data/lib/rubygems/user_interaction.rb +9 -2
  112. data/lib/rubygems/util/licenses.rb +35 -4
  113. data/lib/rubygems/version.rb +7 -1
  114. data/lib/ubygems.rb +3 -0
  115. data/test/rubygems/test_bundled_ca.rb +7 -4
  116. data/test/rubygems/test_gem.rb +45 -10
  117. data/test/rubygems/test_gem_bundler_version_finder.rb +8 -7
  118. data/test/rubygems/test_gem_command_manager.rb +2 -2
  119. data/test/rubygems/test_gem_commands_build_command.rb +2 -0
  120. data/test/rubygems/test_gem_commands_install_command.rb +37 -0
  121. data/test/rubygems/test_gem_commands_push_command.rb +20 -0
  122. data/test/rubygems/test_gem_commands_setup_command.rb +6 -1
  123. data/test/rubygems/test_gem_commands_signin_command.rb +1 -1
  124. data/test/rubygems/test_gem_commands_uninstall_command.rb +1 -1
  125. data/test/rubygems/test_gem_dependency.rb +1 -1
  126. data/test/rubygems/test_gem_ext_rake_builder.rb +0 -4
  127. data/test/rubygems/test_gem_install_update_options.rb +2 -0
  128. data/test/rubygems/test_gem_installer.rb +109 -3
  129. data/test/rubygems/test_gem_package.rb +90 -5
  130. data/test/rubygems/test_gem_package_tar_header.rb +2 -1
  131. data/test/rubygems/test_gem_remote_fetcher.rb +6 -2
  132. data/test/rubygems/test_gem_request.rb +5 -2
  133. data/test/rubygems/test_gem_requirement.rb +6 -0
  134. data/test/rubygems/test_gem_resolver_api_specification.rb +24 -0
  135. data/test/rubygems/test_gem_resolver_installer_set.rb +1 -1
  136. data/test/rubygems/test_gem_security_policy.rb +3 -3
  137. data/test/rubygems/test_gem_server.rb +12 -12
  138. data/test/rubygems/test_gem_specification.rb +27 -13
  139. data/test/rubygems/test_gem_stream_ui.rb +2 -2
  140. data/test/rubygems/test_gem_text.rb +5 -0
  141. data/test/rubygems/test_gem_util.rb +4 -2
  142. data/test/rubygems/test_gem_version.rb +29 -2
  143. data/util/ci +1 -0
  144. data/util/generate_spdx_license_list.rb +15 -6
  145. data/util/update_bundled_ca_certificates.rb +1 -3
  146. metadata +12 -12
  147. data/lib/rubygems/ssl_certs/rubygems.global.ssl.fastly.net/DigiCertHighAssuranceEVRootCA.pem +0 -23
  148. data/lib/rubygems/ssl_certs/rubygems.org/AddTrustExternalCARoot.pem +0 -25
@@ -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
 
@@ -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)
@@ -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],
@@ -76,7 +76,7 @@ module Bundler
76
76
  if !new_version
77
77
  Bundler.ui.warn "Bundler attempted to update #{name} but it was removed from the bundle"
78
78
  elsif new_version < locked_version
79
- 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}"
80
80
  elsif new_version == locked_version
81
81
  Bundler.ui.warn "Bundler attempted to update #{name} but its version stayed the same"
82
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
 
@@ -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
@@ -10,11 +10,11 @@ module Bundler
10
10
  end
11
11
 
12
12
  def hash
13
- @hash ||= dep.hash
13
+ @hash ||= [dep, __platform].hash
14
14
  end
15
15
 
16
16
  def ==(other)
17
- return if other.nil?
17
+ return false if other.class != self.class
18
18
  dep == other.dep && __platform == other.__platform
19
19
  end
20
20
 
@@ -30,6 +30,7 @@ module Bundler
30
30
  :mri_24 => Gem::Platform::RUBY,
31
31
  :mri_25 => Gem::Platform::RUBY,
32
32
  :rbx => Gem::Platform::RUBY,
33
+ :truffleruby => Gem::Platform::RUBY,
33
34
  :jruby => Gem::Platform::JAVA,
34
35
  :jruby_18 => Gem::Platform::JAVA,
35
36
  :jruby_19 => Gem::Platform::JAVA,
@@ -8,7 +8,8 @@ rescue LoadError
8
8
  end
9
9
 
10
10
  module Bundler
11
- if defined? Bundler::Deprecate
11
+ # If Bundler::Deprecate is an autoload constant, we need to define it
12
+ if defined?(Bundler::Deprecate) && !autoload?(:Deprecate)
12
13
  # nothing to do!
13
14
  elsif defined? ::Deprecate
14
15
  Deprecate = ::Deprecate
@@ -123,7 +123,7 @@ module Bundler
123
123
  @required_ruby_version = Gem::Requirement.new(v)
124
124
  end
125
125
  end
126
- rescue => e
126
+ rescue StandardError => e
127
127
  raise GemspecError, "There was an error parsing the metadata for the gem #{name} (#{version}): #{e.class}\n#{e}\nThe metadata was #{data.inspect}"
128
128
  end
129
129
 
@@ -61,10 +61,10 @@ module Bundler
61
61
  end
62
62
 
63
63
  def self.read_file(filename)
64
- File.read(filename.to_s).strip
64
+ Bundler.read_file(filename.to_s).strip
65
65
  rescue Errno::ENOENT
66
66
  "<No #{filename} found>"
67
- rescue => e
67
+ rescue RuntimeError => e
68
68
  "#{e.class}: #{e.message}"
69
69
  end
70
70
 
@@ -88,7 +88,7 @@ module Bundler
88
88
 
89
89
  def self.version_of(script)
90
90
  return "not installed" unless Bundler.which(script)
91
- `#{script} --version`
91
+ `#{script} --version`.chomp
92
92
  end
93
93
 
94
94
  def self.chruby_version
@@ -110,11 +110,13 @@ module Bundler
110
110
  out << [" Gem Path", ENV.fetch("GEM_PATH") { Gem.path.join(File::PATH_SEPARATOR) }]
111
111
  out << [" User Path", Gem.user_dir]
112
112
  out << [" Bin Dir", Gem.bindir]
113
- out << ["OpenSSL"] if defined?(OpenSSL)
114
- out << [" Compiled", OpenSSL::OPENSSL_VERSION] if defined?(OpenSSL::OPENSSL_VERSION)
115
- out << [" Loaded", OpenSSL::OPENSSL_LIBRARY_VERSION] if defined?(OpenSSL::OPENSSL_LIBRARY_VERSION)
116
- out << [" Cert File", OpenSSL::X509::DEFAULT_CERT_FILE] if defined?(OpenSSL::X509::DEFAULT_CERT_FILE)
117
- out << [" Cert Dir", OpenSSL::X509::DEFAULT_CERT_DIR] if defined?(OpenSSL::X509::DEFAULT_CERT_DIR)
113
+ if defined?(OpenSSL)
114
+ out << ["OpenSSL"]
115
+ out << [" Compiled", OpenSSL::OPENSSL_VERSION] if defined?(OpenSSL::OPENSSL_VERSION)
116
+ out << [" Loaded", OpenSSL::OPENSSL_LIBRARY_VERSION] if defined?(OpenSSL::OPENSSL_LIBRARY_VERSION)
117
+ out << [" Cert File", OpenSSL::X509::DEFAULT_CERT_FILE] if defined?(OpenSSL::X509::DEFAULT_CERT_FILE)
118
+ out << [" Cert Dir", OpenSSL::X509::DEFAULT_CERT_DIR] if defined?(OpenSSL::X509::DEFAULT_CERT_DIR)
119
+ end
118
120
  out << ["Tools"]
119
121
  out << [" Git", git_version]
120
122
  out << [" RVM", ENV.fetch("rvm_version") { version_of("rvm") }]