This repository has been archived by the owner on Jan 19, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 28
/
Build.sh
executable file
·111 lines (95 loc) · 2.71 KB
/
Build.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
109
110
111
#!/bin/bash
ScriptPath=$(cd "$(dirname "$0")"; pwd)
ScriptName=$(basename "${ScriptPath}")
OUTPUTDIR=build
SkinPath=$ScriptPath
TexturePackerPath=/Applications/TexturePacker
OutputPath=$SkinPath/$OUTPUTDIR
IgnoreRegex=".*((build|media)(\/.*)?|\.(db|psd|backup|sh|bat|DS_Store|sublime-project|sublime-workspace|command|workflow|app))"
Usage()
{
cat <<-ENDOFMESSAGE
$0 [OPTION] REQ1 REQ2
options:
-o -output Path to output to
-r -regex Regex for ignored files
-s -skin Path to the skin to build
-p -path Path to TexturePacker installation
-h --help display this message
ENDOFMESSAGE
exit 1
}
Die()
{
echo "$*"
exit 1
}
GetOpts() {
branch="master"
argv=
while [ $# -gt 0 ]
do
opt=$1
shift
case ${opt} in
-p|--packer)
if [ $# -eq 0 -o "${1:0:1}" = "-" ]; then
Die "The ${opt} option requires an argument."
fi
TexturePackerPath="$1"
shift
;;
-s|--skin)
if [ $# -eq 0 -o "${1:0:1}" = "-" ]; then
Die "The ${opt} option requires an argument."
fi
SkinPath="$1"
shift
;;
-o|--output)
if [ $# -eq 0 -o "${1:0:1}" = "-" ]; then
Die "The ${opt} option requires an argument."
fi
OutputPath="$1"
shift
;;
-r|--regex)
if [ $# -eq 0 -o "${1:0:1}" = "-" ]; then
Die "The ${opt} option requires an argument."
fi
IgnoreRegex="$1"
shift
;;
-h|--help)
Usage;;
*)
if [ "${opt:0:1}" = "-" ]; then
Die "${opt}: unknown option."
fi
argv+=${opt};;
esac
done
}
GetOpts $*
SkinName=$(basename "${SkinPath}")
echo "TexturePackerPath ${TexturePackerPath}"
echo "SkinPath ${SkinPath}"
echo "OutputPath ${OutputPath}"
echo "ScriptPath ${ScriptPath}"
echo "argv ${argv}"
echo "Skin Name ${SkinName}"
echo Creating reFocus Build Folder
echo Creating ${SkinName} Directory...
rm -fr "$OutputPath"
mkdir "$OutputPath"
mkdir "$OutputPath/$SkinName"
echo Copying ${SkinName} resources...
cd "${SkinPath}"
find -E ./ -type f ! -iregex ${IgnoreRegex} | rsync --files-from=- ./ "$OutputPath/$SkinName"
cd -
echo Creating XBT File...
cd "${TexturePackerPath}"
mkdir "$OutputPath/$SkinName/media"
./TexturePacker -dupecheck -input "${SkinPath}/media/" -output "$OutputPath/$SkinName/media/Textures.xbt"
cd -
echo Build Complete - Scroll Up to check for errors.