@@ -337,11 +337,7 @@ def resolve
337337 end
338338 end
339339 else
340- if lockfile_exists?
341- Bundler . ui . debug "Found changes from the lockfile, re-resolving dependencies because #{ change_reason } "
342- else
343- Bundler . ui . debug "Resolving dependencies because there's no lockfile"
344- end
340+ Bundler . ui . debug resolve_needed_reason
345341
346342 start_resolution
347343 end
@@ -537,9 +533,7 @@ def lockfile_changes_summary(update_refused_reason)
537533
538534 return unless added . any? || deleted . any? || changed . any? || resolve_needed?
539535
540- reason = resolve_needed? ? change_reason : "some dependencies were deleted from your gemfile"
541-
542- msg = String . new ( "#{ reason . capitalize . strip } , but " )
536+ msg = String . new ( "#{ change_reason . capitalize . strip } , but " )
543537 msg << "the lockfile " unless msg . start_with? ( "Your lockfile" )
544538 msg << "can't be updated because #{ update_refused_reason } "
545539 msg << "\n \n You have added to the Gemfile:\n " << added . join ( "\n " ) if added . any?
@@ -796,22 +790,47 @@ def find_most_specific_locked_platform
796790 @most_specific_locked_platform
797791 end
798792
799- def change_reason
800- if unlocking ?
801- unlock_targets = if @gems_to_unlock . any ?
802- [ "gems" , @gems_to_unlock ]
803- elsif @sources_to_unlock . any?
804- [ "sources" , @sources_to_unlock ]
793+ def resolve_needed_reason
794+ if lockfile_exists ?
795+ if unlocking ?
796+ "Re-resolving dependencies because #{ unlocking_reason } "
797+ else
798+ "Found changes from the lockfile, re-resolving dependencies because #{ lockfile_changed_reason } "
805799 end
800+ else
801+ "Resolving dependencies because there's no lockfile"
802+ end
803+ end
806804
807- unlock_reason = if unlock_targets
808- "#{ unlock_targets . first } : (#{ unlock_targets . last . join ( ", " ) } )"
805+ def change_reason
806+ if resolve_needed?
807+ if unlocking?
808+ unlocking_reason
809809 else
810- @unlocking_ruby ? "ruby" : ""
810+ lockfile_changed_reason
811811 end
812+ else
813+ "some dependencies were deleted from your gemfile"
814+ end
815+ end
812816
813- return "bundler is unlocking #{ unlock_reason } "
817+ def unlocking_reason
818+ unlock_targets = if @gems_to_unlock . any?
819+ [ "gems" , @gems_to_unlock ]
820+ elsif @sources_to_unlock . any?
821+ [ "sources" , @sources_to_unlock ]
814822 end
823+
824+ unlock_reason = if unlock_targets
825+ "#{ unlock_targets . first } : (#{ unlock_targets . last . join ( ", " ) } )"
826+ else
827+ @unlocking_ruby ? "ruby" : ""
828+ end
829+
830+ "bundler is unlocking #{ unlock_reason } "
831+ end
832+
833+ def lockfile_changed_reason
815834 [
816835 [ @source_changes , "the list of sources changed" ] ,
817836 [ @dependency_changes , "the dependencies in your gemfile changed" ] ,
0 commit comments