class PactBroker::Versions::BranchService

Public Class Methods

branch_deletion_notices(pacticipant, exclude:) click to toggle source

Returns a list of notices to display to the user in the terminal @param [PactBroker::Domain::Pacticipant] pacticipant @param [Array<String>] exclude the list of branches to NOT delete @return [Array<PactBroker::Contracts::Notice>]

# File lib/pact_broker/versions/branch_service.rb, line 22
def branch_deletion_notices(pacticipant, exclude:)
  count = branch_repository.count_branches_to_delete(pacticipant, exclude: exclude)
  remaining = branch_repository.remaining_branches_after_future_deletion(pacticipant, exclude: exclude).sort_by(&:created_at).collect(&:name).join(", ")
  [PactBroker::Contracts::Notice.success(message("messages.branch.bulk_delete", count: count, pacticipant_name: pacticipant.name, remaining: remaining))]
end