lib/bundler/definition.rb in bundler-2.5.1 vs lib/bundler/definition.rb in bundler-2.5.2

- old
+ new

@@ -494,11 +494,19 @@ attr_reader :sources 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? !unlocking? && nothing_changed? end @@ -651,11 +659,12 @@ [@new_platform, "you added a new platform to your gemfile"], [@path_changes, "the gemspecs for path gems changed"], [@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 def pretty_dep(dep) SharedHelpers.pretty_dependency(dep) @@ -706,39 +715,38 @@ end.map(&:first) !sources_with_changes.each {|source| @unlock[:sources] << source.name }.empty? 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" end&.name end if invalid.any? @locked_specs.delete(invalid) - @invalid_lockfile_dep = invalid.first.name + @locked_spec_with_invalid_deps = invalid.first.name end end def converge_paths sources.path_sources.any? do |source|