|
|
@@ -0,0 +1,45 @@
|
|
|
+#!/bin/bash
|
|
|
+
|
|
|
+set -e
|
|
|
+
|
|
|
+root=$(cd $(dirname ${0})/..; pwd)
|
|
|
+node_modules=${root}/node_modules
|
|
|
+src=${root}/src
|
|
|
+tools=${root}/tools
|
|
|
+third_party=${root}/third_party
|
|
|
+
|
|
|
+identifier=torch
|
|
|
+
|
|
|
+bold() {
|
|
|
+ echo "$(tty -s && tput bold)$1$(tty -s && tput sgr0)"
|
|
|
+}
|
|
|
+
|
|
|
+git_sync() {
|
|
|
+ mkdir -p "${third_party}"
|
|
|
+ if [ -d "${third_party}/${1}" ]; then
|
|
|
+ git -C "${third_party}/${1}" fetch -p --quiet
|
|
|
+ git -C "${third_party}/${1}" reset --quiet --hard origin/master
|
|
|
+ else
|
|
|
+ echo "Clone ${2}..."
|
|
|
+ git -C "${third_party}" clone --recursive ${2}
|
|
|
+ fi
|
|
|
+ git -C "${third_party}" submodule update --init
|
|
|
+}
|
|
|
+
|
|
|
+clean() {
|
|
|
+ bold "torch clean"
|
|
|
+ rm -rf ${third_party}/${identifier}
|
|
|
+}
|
|
|
+
|
|
|
+sync() {
|
|
|
+ bold "torch sync"
|
|
|
+ git_sync torch https://github.com/torch/torch7.git
|
|
|
+}
|
|
|
+
|
|
|
+while [ "$#" != 0 ]; do
|
|
|
+ command="$1" && shift
|
|
|
+ case "${command}" in
|
|
|
+ "clean") clean;;
|
|
|
+ "sync") sync;;
|
|
|
+ esac
|
|
|
+done
|