torch 908 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #!/bin/bash
  2. set -e
  3. root=$(cd $(dirname ${0})/..; pwd)
  4. node_modules=${root}/node_modules
  5. src=${root}/src
  6. tools=${root}/tools
  7. third_party=${root}/third_party
  8. identifier=torch
  9. bold() {
  10. echo "$(tty -s && tput bold)$1$(tty -s && tput sgr0)"
  11. }
  12. git_sync() {
  13. mkdir -p "${third_party}"
  14. if [ -d "${third_party}/${1}" ]; then
  15. git -C "${third_party}/${1}" fetch --quiet -p
  16. git -C "${third_party}/${1}" reset --quiet --hard origin/master
  17. else
  18. git -C "${third_party}" clone --quiet --recursive ${2} ${1}
  19. fi
  20. git -C "${third_party}" submodule update --quiet --init
  21. }
  22. clean() {
  23. bold "torch clean"
  24. rm -rf ${third_party}/${identifier}
  25. }
  26. sync() {
  27. bold "torch sync"
  28. git_sync torch https://github.com/torch/torch7.git
  29. }
  30. while [ "$#" != 0 ]; do
  31. command="$1" && shift
  32. case "${command}" in
  33. "clean") clean;;
  34. "sync") sync;;
  35. esac
  36. done