-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.sh
executable file
·49 lines (37 loc) · 1.33 KB
/
setup.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/usr/bin/env bash
# SETUP wp-sync-deploy
#
# COMMAND:
#
# `./wp-sync-deploy/setup.sh`
#
# The directory relative to the script
SCRIPT_DIR=$(realpath $(dirname $0))
# Source functions for logging
source "$SCRIPT_DIR/lib/functions.sh"
ENV_EXAMPLE_FILE="./wp-sync-deploy/.env.wp-sync-deploy.example"
ENV_FILE=".env.wp-sync-deploy"
TASKS_EXAMPLE_FILE="./wp-sync-deploy/wp-sync-deploy.tasks.example.php"
TASKS_FILE="wp-sync-deploy.tasks.php"
# Ask before running the setup
log "🚀 Setup ${BLUE}wp-sync-deploy${NC} at this location?"
log " ${GREEN}$(pwd)${NC}"
read -r -p "[y/n] " PROMPT_RESPONSE
# Exit if not confirmed
[[ "$PROMPT_RESPONSE" != "y" ]] && exit 1
log "🚀 Installing ${GREEN}wp-sync-deploy${NC} ... \n"
# Copy and rename the wp-sync-deploy.example.env to the working directory
if [ ! -e $ENV_FILE ]; then
cp $ENV_EXAMPLE_FILE $ENV_FILE
logSuccess "File ${GREEN}$ENV_FILE${NC} created! "
else
logSuccess "File ${GREEN}$ENV_FILE${NC} already exists. "
fi
# Copy and rename the wp-sync-deploy.tasks.example.php to the working directory
if [ ! -e $TASKS_FILE ]; then
cp $TASKS_EXAMPLE_FILE $TASKS_FILE
logSuccess "File ${GREEN}$TASKS_FILE${NC} created!"
else
logSuccess "File ${GREEN}$TASKS_FILE${NC} already exists. "
fi
log "\n🚀 Setup complete! Remember to adjust both files as required for your specific setup."