-
Notifications
You must be signed in to change notification settings - Fork 1
/
createfutileproj
executable file
·117 lines (103 loc) · 2.86 KB
/
createfutileproj
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
109
110
111
112
113
114
115
116
#!/bin/bash
# Creates a new futile project based on these templates.
clone=
futile_path=
proj_path=
function cloneFutile
{
echo "Cloning Futile from github to $futile_path"
git clone git@github.com:MattRix/Futile.git $futile_path
}
function copyFutile
{
echo "Copying Futile files from $futile_path"
if [ -d $futile_path ]; then
cp -R $futile_path/FutileProject/Assets/Futile $proj_path/Unity/Assets/Futile
else
echo "Error: Path provided for futile wasn't valid. Abort."
exit 1
fi
}
function copyUnityTemplate
{
echo "Copying project files..."
echo " Copying Unity project..."
if [ -d Unity ]; then
cp -R Unity $proj_path/Unity
else
echo "Error: Couldn't find Unity folder. Abort."
exit 1
fi
echo " Copying Texture Atlas files..."
if [ -d SourceImages ]; then
cp -R SourceImages $proj_path/SourceImages
echo " Building default atlases and fonts..."
echo
$proj_path/SourceImages/MakeAllAtlases $proj_path/SourceImages
echo
else
echo "Error: Couldn't find SourceImages folder. Abort."
exit 1
fi
}
function usage
{
echo "Usage:"
echo "createfutileproj [-c futile_path] [-f futile_path] directory_name"
echo " Note: use one of -c OR -f, not both."
echo
echo " -c, --clone futile_path"
echo " Clone Futile from github to a location (not the project directory) before copying relevant files to the project."
echo
echo " -f, --futile futile_path"
echo " Use a local copy of Futile. This should point to the root Futile folder in the local repo (the one that contains FutileProject)."
echo
echo " directory_name"
echo " Where you want to create the new project. NOTE: This does not create a new dir, it puts the files IN the directory specified."
echo
}
# Parse the input params
if [ $# -gt 0 ]; then
# Look for other params
while [ "$1" != "" ]; do
case $1 in
-f | --futile ) shift
futile_path=$1
;;
-c | --clone ) clone=1
shift
futile_path=$1
;;
-h | --help ) usage
exit
;;
* ) proj_path=$1
;;
esac
shift
done
fi
# You must have either -c or -f
if [ "$clone" != "1" -a "$futile_path" == "" ]; then
usage
exit 1
fi
if [ -d $proj_path ]; then
echo "Project directory is valid"
copyUnityTemplate
if [ "$clone" = "1" -a "$futile_path" != "" ]; then
cloneFutile
copyFutile
elif [ "$futile_path" != "" ]; then
copyFutile
fi
echo
echo "*********************************************************"
echo " REMEMBER: You must drag the Futile and Main scripts onto the root game object!"
echo "*********************************************************"
echo
else
echo "Error: The directory passed does not exist. You must create the directory before creating the project in it. Abort."
exit 1
fi
exit 0