-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathspecify.sh
executable file
·45 lines (44 loc) · 2.11 KB
/
specify.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
#!/bin/sh
echo "Specifying project name"
read -p "What is the lower case namespace of your project (eg fzyskeleton): " LCVAL
find . -type f -print0 | xargs -0 sed -i '' -e "s/fzyskeleton/$LCVAL/g"
read -p "What is the title case namespace of your project (eg FzySkeleton): " TCVAL
find . -type f -print0 | xargs -0 sed -i '' -e "s/FzySkeleton/$TCVAL/g"
read -n 1 -p "Set remote database connection variables for development?" setDevDB
if [[ "$setDevDB" == "y" || "$setDevDB" == "Y" ]]; then
while true; do
read -p "Development DB name: " DEVDB
read -p "Development DB user: " DEVUSER
read -p "Development DB pass: " DEVPASS
read -p "Development DB host: " DEVHOST
echo -e "DB: $DEVDB\nUser: $DEVUSER\nPass: $DEVPASS\nHOST: $DEVHOST\n"
read -n 1 -p "Confirm [y/n]: " isCorrect
if [[ "$isCorrect" == "y" || "$isCorrect" == "Y" ]]; then
echo "Configuring development connection..."
sed -i '' -e "s/DEVDBNAME/$DEVDB/g" ./src/sync-qa-db.sh
sed -i '' -e "s/DEVDBUSER/$DEVUSER/g" ./src/sync-qa-db.sh
sed -i '' -e "s/DEVDBPASS/$DEVPASS/g" ./src/sync-qa-db.sh
sed -i '' -e "s/DEVDBHOST/$DEVHOST/g" ./src/sync-qa-db.sh
break
fi
done
fi
read -n 1 -p "Set remote database connection variables for staging?" setQaDB
if [[ "$setQaDB" == "y" || "$setQaDB" == "Y" ]]; then
while true; do
read -p "Staging DB name: " QADB
read -p "Staging DB user: " QAUSER
read -p "Staging DB pass: " QAPASS
read -p "Staging DB host: " QAHOST
echo -e "DB: $DEVDB\nUser: $DEVUSER\nPass: $DEVPASS\nHOST: $DEVHOST\n"
read -n 1 -p "Confirm [y/n]: " isCorrect
if [[ "$isCorrect" == "y" || "$isCorrect" == "Y" ]]; then
echo "Configuring staging connection..."
sed -i '' -e "s/QADBNAME/$QADB/g" ./src/sync-qa-db.sh
sed -i '' -e "s/QADBUSER/$QAUSER/g" ./src/sync-qa-db.sh
sed -i '' -e "s/QADBPASS/$QAPASS/g" ./src/sync-qa-db.sh
sed -i '' -e "s/QADBHOST/$QAHOST/g" ./src/sync-qa-db.sh
break
fi
done
fi