class Bundler::Definition

def change_reason

def change_reason
  if unlocking?
    unlock_targets = if @gems_to_unlock.any?
      ["gems", @gems_to_unlock]
    elsif @sources_to_unlock.any?
      ["sources", @sources_to_unlock]
    end
    unlock_reason = if unlock_targets
      "#{unlock_targets.first}: (#{unlock_targets.last.join(", ")})"
    else
      @unlock[:ruby] ? "ruby" : ""
    end
    return "bundler is unlocking #{unlock_reason}"
  end
  [
    [@source_changes, "the list of sources changed"],
    [@dependency_changes, "the dependencies in your gemfile changed"],
    [@current_platform_missing, "your lockfile does not include the current platform"],
    [@new_platforms.any?, "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"],
    [@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