-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall_templates.sh
executable file
·76 lines (60 loc) · 1.79 KB
/
install_templates.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
#!/bin/bash
echo 'Installing project template for AIR Native Extensions (ANE) for iOS'
BASE_TEMPLATE_PATH="$HOME/Library/Developer/Xcode/Templates"
PROJECT_TEMPLATE_DST_DIR="$BASE_TEMPLATE_PATH/Project Templates/AIR ObjCPlusPlus Native Extension/"
force=
forceCopy=
uninstall=
usage(){
cat << EOF
usage: $0 [options]
Install/update project templates for AIR Native Extension
OPTIONS:
-f force overwrite if a previous version of the AIR Native Extension project templates exist
-h this help
-u uninstall Xcode 4 AIR Native Extension project templates. (CAUTION: This removes everything in "$PROJECT_TEMPLATE_DST_DIR". Use with extreme care)
EOF
}
while getopts "fhu" OPTION; do
case "$OPTION" in
f)
force=1
forceCopy="-f"
;;
h)
usage
exit 0
;;
u)
uninstall=1
;;
esac
done
uninstall_xcode4_ane_project_templates(){
if [[ -d $PROJECT_TEMPLATE_DST_DIR ]]; then
echo "Removing project templates: \"${PROJECT_TEMPLATE_DST_DIR}\""
rm -rf "$PROJECT_TEMPLATE_DST_DIR"
fi
}
install_xcode4_ane_project_templates(){
if [[ -d "$PROJECT_TEMPLATE_DST_DIR" ]]; then
if [[ $force ]]; then
echo "Overwriting the files in: \"${PROJECT_TEMPLATE_DST_DIR}\""
else
echo "Project templates already installed. To force a re-install use the '-f' parameter."
exit 1
fi
else
echo "Creating destination directory: \"${PROJECT_TEMPLATE_DST_DIR}\"..."
mkdir -p "$PROJECT_TEMPLATE_DST_DIR"
fi
echo "Copying Project Templates..."
cp -r $forceCopy "./AIR Native Extension for iOS.xctemplate" "$PROJECT_TEMPLATE_DST_DIR"
cp -r $forceCopy "./Basic.xctemplate" "$PROJECT_TEMPLATE_DST_DIR"
cp -r $forceCopy "./iOSBasic.xctemplate" "$PROJECT_TEMPLATE_DST_DIR"
}
if [[ $uninstall ]]; then
uninstall_xcode4_ane_project_templates
else
install_xcode4_ane_project_templates
fi