github.com/argoproj/argo-events@v1.9.1/hack/library.sh (about)

     1  #!/bin/bash
     2  
     3  readonly REPO_ROOT="$(git rev-parse --show-toplevel)"
     4  
     5  # Display a box banner.
     6  # Parameters: $1 - character to use for the box.
     7  #             $2 - banner message.
     8  function make_banner() {
     9    local msg="$1$1$1$1 $2 $1$1$1$1"
    10    local border="${msg//[-0-9A-Za-z _.,:\/()]/$1}"
    11    echo -e "${border}\n${msg}\n${border}"
    12  }
    13  
    14  # Simple header for logging purposes.
    15  function header() {
    16    local upper="$(echo $1 | tr a-z A-Z)"
    17    make_banner "+" "${upper}"
    18  }
    19  
    20  # Simple subheader for logging purposes.
    21  function subheader() {
    22    make_banner "-" "$1"
    23  }
    24  
    25  # Simple warning banner for logging purposes.
    26  function warning() {
    27    make_banner "!" "$1"
    28  }
    29  
    30  function make_fake_paths() {
    31    FAKE_GOPATH="$(mktemp -d)"
    32    trap 'rm -rf ${FAKE_GOPATH}' EXIT
    33    FAKE_REPOPATH="${FAKE_GOPATH}/src/github.com/argoproj/argo-events"
    34    mkdir -p "$(dirname "${FAKE_REPOPATH}")" && ln -s "${REPO_ROOT}" "${FAKE_REPOPATH}"
    35  }
    36  
    37  ensure_vendor() {	
    38    go mod vendor
    39  }	
    40  
    41  ensure_pandoc() {
    42    if [ "`command -v pandoc`" = "" ]; then
    43      warning "Please install pandoc with - brew install pandoc"
    44      exit 1
    45    fi
    46  }
    47  
    48  ensure_protobuf() {
    49    if [ "`command -v protoc`" = "" ]; then
    50      warning "Please install protobuf with - brew install protobuf"
    51      exit 1
    52    fi
    53  }
    54  
    55  ensure_mockery() {
    56    if [ "`command -v mockery`" = "" ]; then
    57      warning "Please install mockery with - brew install vektra/tap/mockery"
    58      exit 1
    59    fi
    60  }
    61