Add require_app_clone

This commit is contained in:
Luke Murphy 2020-11-01 17:04:58 +01:00
parent 0d24a8e5cc
commit 5806e40c1c
No known key found for this signature in database
GPG Key ID: 5E2EF5A63E3718CC
1 changed files with 14 additions and 10 deletions

24
abra
View File

@ -306,6 +306,18 @@ require_stack() {
fi
}
require_app_clone() {
APP="$1"
APP_DIR="$ABRA_DIR/apps/$APP"
if [ ! -d "$APP_DIR" ]; then
warning "'$APP' not found, fetching via git.."
if ! git clone "$GIT_URL/$APP.git" "$ABRA_DIR/apps/$APP"; then
error "Could not retrieve '$APP', this app doesn't exist?"
fi
fi
}
# FIXME 3wc: update or remove
if [ -z "$ABRA_ENV" ] && [ -f .envrc ] && type direnv > /dev/null 2>&1 && ! direnv status | grep -q 'Found RC allowed true'; then
error "direnv is blocked, run direnv allow"
@ -431,6 +443,8 @@ sub_app_new (){
SERVER=$abra___server
DOMAIN=$abra___domain
require_app_clone "$APP"
if [ -z "$SERVER" ]; then
echo "Where would you like to put $APP?"
@ -450,16 +464,6 @@ sub_app_new (){
APP_DIR="$ABRA_DIR/apps/$APP"
if [ ! -d "$APP_DIR" ]; then
# FIXME 3wc: move to require_app_clone or something
warning "'$APP' not found, fetching via git.."
if ! git clone "$GIT_URL/$APP.git" "$ABRA_DIR/apps/$APP"; then
error "Could not retrieve '$APP', this app doesn't exist?"
fi
fi
if [ -z "$DOMAIN" ]; then
read -rp "Domain name: " DOMAIN
fi