-
Notifications
You must be signed in to change notification settings - Fork 0
/
createproject.sh
executable file
·50 lines (39 loc) · 1.09 KB
/
createproject.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
#Generate a new project from your HTML5 Boilerplate repo clone
#by: Rick Waldron & Michael Cetrulo
##first run
# $ cd html5-boilerplate/build
# $ chmod +x createproject.sh && ./createproject.sh
##usage
# $ cd html5-boilerplate/build
# $ ./createproject.sh
# find project root (also ensure script is ran from within repo)
src=$(git rev-parse --show-toplevel) || {
echo "try running the script from within html5-boilerplate directories." >&2
exit 1
}
[[ -d $src ]] || {
echo "fatal: could not determine html5-boilerplate's root directory." >&2
echo "try updating git." >&2
exit 1
}
# get a name for new project
while [[ -z $name ]]
do
echo "To create a new html5-boilerplate project, enter a new directory name:"
read name || exit
done
dst=$src/../$name
if [[ -d $dst ]]
then
echo "$dst exists"
else
#create new project
mkdir -- "$dst" || exit 1
#sucess message
echo "Created Directory: $dst"
cd -- "$src"
cp -vr -- css js img build test *.html *.xml *.txt *.png *.ico .htaccess "$dst"
#sucess message
echo "Created Project: $dst"
fi