-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathstart.sh
108 lines (96 loc) · 2.47 KB
/
start.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
#! /bin/bash
while [[ $# -gt 1 ]]
do
key="$1"
case $key in
-e|--extname)
EXTNAME="$2"
shift # past argument
;;
-v|--vendor)
VENDOR="$2"
shift # past argument
;;
-p|--package)
PACKAGE="$2"
shift # past argument
;;
-b|--branch)
BRANCH="$2"
shift # past argument
;;
*)
# unknown option
;;
esac
shift # past argument or value
done
mkdir -p packages
DIR=./packages/$EXTNAME
vendor=`echo ${VENDOR:0:1} | tr '[a-z]' '[A-Z]'`${VENDOR:1}
package=`echo ${PACKAGE:0:1} | tr '[a-z]' '[A-Z]'`${PACKAGE:1}
branch=$BRANCH
RED='\033[0;31m'
GREEN='\033[0;32m'
NC='\033[0m' # No Color
if [ -d "$DIR" ]
then
printf ${RED}
echo "Directory/extension '$DIR' exists already!"
printf ${NC}
else
if [ -z ${VENDOR} ];
then
printf ${RED}
echo "Please enter Vendor Name (first character uppercase): "
printf ${NC}
while [[ $VENDOR = "" ]]; do
read VENDOR
done
vendor=`echo ${VENDOR:0:1} | tr '[a-z]' '[A-Z]'`${VENDOR:1}
fi
if [ -z ${PACKAGE} ];
then
printf ${RED}
echo "Please enter Package Name (first character uppercase): "
printf ${NC}
while [[ $PACKAGE = "" ]]; do
read PACKAGE
done
package=`echo ${PACKAGE:0:1} | tr '[a-z]' '[A-Z]'`${PACKAGE:1}
fi
if [ -z ${BRANCH} ];
then
printf ${RED}
echo "Please enter Branch to start from: "
printf ${NC}
while [[ $BRANCH = "" ]]; do
read BRANCH
done
branch=$BRANCH
fi
printf ${GREEN}
echo
echo "Your Extension will be placed in: $DIR"
echo "Your Vendor will be: $vendor"
echo "Your Package Name will be: $package"
echo "You start from Branch: $branch"
echo
printf ${NC}
echo ${DIR}
git clone https://github.com/Startpiloten/startpilot.git $DIR --depth=1
echo "change origin"
cd $DIR
git pull origin $branch
echo "$DIR created."
rm -rf .git && grep -rl "startpilot" ./* -R | xargs sed -i '' "s/startpilot/${PWD##*/}/g" && grep -rl "Startpilot" ./* -R | xargs sed -i '' "s/Startpilot/${PWD##*/}/"
grep -rl "Vendor" ./* -R | xargs sed -i '' "s/Vendor/${vendor##*/}/g"
grep -rl "Yourext" ./* -R | xargs sed -i '' "s/Yourext/${package##*/}/g"
pwd
cd Resources/Build/ && npm install && npm run webpack:build:live
printf ${GREEN}
echo
echo "Your extension is now in $DIR."
echo
printf ${NC}
fi