summaryrefslogtreecommitdiff
path: root/lib/bundler/definition.rb
diff options
context:
space:
mode:
authorHiroshi SHIBATA <hsbt@ruby-lang.org>2023-12-22 07:01:12 +0900
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2023-12-22 07:24:04 +0900
commit82496f2b389278a569fa7680ee6faa55a97410d7 (patch)
treeacce0c98431a9f617be3d5c971b4c684155c5b94 /lib/bundler/definition.rb
parentfc549b2b3a65a95a734ee8679293a30284f84622 (diff)
Merge RubyGems-3.5.2 and Bundler-2.5.2
Diffstat (limited to 'lib/bundler/definition.rb')
-rw-r--r--lib/bundler/definition.rb30
1 files changed, 19 insertions, 11 deletions
diff --git a/lib/bundler/definition.rb b/lib/bundler/definition.rb
index 5dc711ffde..9b905db1f9 100644
--- a/lib/bundler/definition.rb
+++ b/lib/bundler/definition.rb
@@ -496,7 +496,15 @@ module Bundler
private :sources
def nothing_changed?
- !@source_changes && !@dependency_changes && !@new_platform && !@path_changes && !@local_changes && !@missing_lockfile_dep && !@unlocking_bundler && !@invalid_lockfile_dep
+ !@source_changes &&
+ !@dependency_changes &&
+ !@new_platform &&
+ !@path_changes &&
+ !@local_changes &&
+ !@missing_lockfile_dep &&
+ !@unlocking_bundler &&
+ !@locked_spec_with_missing_deps &&
+ !@locked_spec_with_invalid_deps
end
def no_resolve_needed?
@@ -653,7 +661,8 @@ module Bundler
[@local_changes, "the gemspecs for git local gems changed"],
[@missing_lockfile_dep, "your lock file is missing \"#{@missing_lockfile_dep}\""],
[@unlocking_bundler, "an update to the version of Bundler itself was requested"],
- [@invalid_lockfile_dep, "your lock file has an invalid dependency \"#{@invalid_lockfile_dep}\""],
+ [@locked_spec_with_missing_deps, "your lock file includes \"#{@locked_spec_with_missing_deps}\" but not some of its dependencies"],
+ [@locked_spec_with_invalid_deps, "your lockfile does not satisfy dependencies of \"#{@locked_spec_with_invalid_deps}\""],
].select(&:first).map(&:last).join(", ")
end
@@ -708,26 +717,25 @@ module Bundler
end
def check_lockfile
- @invalid_lockfile_dep = nil
@missing_lockfile_dep = nil
- locked_names = @locked_specs.map(&:name)
+ @locked_spec_with_invalid_deps = nil
+ @locked_spec_with_missing_deps = nil
+
missing = []
invalid = []
@locked_specs.each do |s|
- s.dependencies.each do |dep|
- next if dep.name == "bundler"
+ validation = @locked_specs.validate_deps(s)
- missing << s unless locked_names.include?(dep.name)
- invalid << s if @locked_specs.none? {|spec| dep.matches_spec?(spec) }
- end
+ missing << s if validation == :missing
+ invalid << s if validation == :invalid
end
if missing.any?
@locked_specs.delete(missing)
- @missing_lockfile_dep = missing.first.name
+ @locked_spec_with_missing_deps = missing.first.name
elsif !@dependency_changes
@missing_lockfile_dep = current_dependencies.find do |d|
@locked_specs[d.name].empty? && d.name != "bundler"
@@ -737,7 +745,7 @@ module Bundler
if invalid.any?
@locked_specs.delete(invalid)
- @invalid_lockfile_dep = invalid.first.name
+ @locked_spec_with_invalid_deps = invalid.first.name
end
end