#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"

tar_receive_app() {
  declare desc="tar receive-app plugin trigger"
  local trigger="tar_receive_app"
  local APP="$1"; local REV="$2"

  # Don't trigger tar build if there is no tarball.
  if [[ ! -f "$DOKKU_ROOT/$APP/src.tar" ]]; then
    true
  else
    dokku tar:build "$APP"
  fi
}

tar_receive_app "$@"
