-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsetup.sh
91 lines (72 loc) · 2.06 KB
/
setup.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
#! /bin/bash
PROJECT_NAME="maya-workflowtools"
PACKAGE_NAME="workflowtools"
if [[ ! "$MAYA_MODULES_INSTALL_PATH" ]]; then
if [[ "$(uname)" == "Darwin" ]]; then
MAYA_MODULES_INSTALL_PATH="$HOME/Library/Preferences/Autodesk/maya/modules"
elif [[ "$(expr substr $(uname -s) 1 5)" == "Linux" ]]; then
MAYA_MODULES_INSTALL_PATH="$HOME/maya/modules"
elif [[ "$(expr substr $(uname -s) 1 5)" == "MINGW" ]]; then
IS_WINDOWS=1
MAYA_MODULES_INSTALL_PATH="$HOME/Documents/maya/modules"
fi
fi
build() {
mkdir -p build
cp -R src/$PACKAGE_NAME build/
cp src/$PACKAGE_NAME.mod build/
cp LICENSE build/$PACKAGE_NAME
}
release() {
clean
build
VERSION=`git describe --tags --abbrev=0`
cd build
zip -rX ${PROJECT_NAME}_${VERSION}.zip *
echo ${PROJECT_NAME}_${VERSION}.zip
}
clean() {
rm -Rf build
}
dev() {
uninstall
clean
link `pwd`/src/$PACKAGE_NAME.mod $MAYA_MODULES_INSTALL_PATH/$PACKAGE_NAME.mod
link `pwd`/src/$PACKAGE_NAME $MAYA_MODULES_INSTALL_PATH/$PACKAGE_NAME
}
install() {
uninstall
clean
build
cp -v build/$PACKAGE_NAME.mod $MAYA_MODULES_INSTALL_PATH/$PACKAGE_NAME.mod
cp -Rv build/$PACKAGE_NAME $MAYA_MODULES_INSTALL_PATH/$PACKAGE_NAME
}
uninstall() {
rm -v $MAYA_MODULES_INSTALL_PATH/$PACKAGE_NAME.mod
rm -Rv $MAYA_MODULES_INSTALL_PATH/$PACKAGE_NAME
}
ALL_COMMANDS="build, clean, dev, install, uninstall"
# Template setup.sh utils
# -----------------------
# simple cross-platform symlink util
link() {
# use mklink if on windows
if [[ -n "$WINDIR" ]]; then
# determine if the link is a directory
# also convert '/' to '\'
if [[ -d "$1" ]]; then
cmd <<< "mklink /D \"`cygpath -w \"$2\"`\" \"`cygpath -w \"$1\"`\"" > /dev/null
else
cmd <<< "mklink \"`cygpath -w \"$2\"`\" \"`cygpath -w \"$1\"`\"" > /dev/null
fi
else
ln -sf "$1" "$2"
fi
}
# run command by name
if [[ "$1" ]]; then
cd $(dirname "$0")
$1
else
echo -e "usage: setup.sh [COMMAND]\n $ALL_COMMANDS"
fi