You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

59 lines
940 B

  1. #!/bin/bash
  2. SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
  3. POSITIONAL_ARGS=()
  4. MCLOUD=0
  5. while [[ $# -gt 0 ]]; do
  6. case $1 in
  7. --mcloud)
  8. MCLOUD=1
  9. shift # past argument
  10. ;;
  11. -*|--*)
  12. echo "Unknown option $1"
  13. exit 1
  14. ;;
  15. *)
  16. echo "No support positional arguments"
  17. exit 1
  18. ;;
  19. esac
  20. done
  21. export SCRIPT_DIR
  22. ignore() {
  23. DIR="${SCRIPT_DIR}/../wp-content/${1}"
  24. FILE="${DIR}/.gitignore"
  25. if [[ ! -d $DIR ]]; then
  26. mkdir $DIR
  27. fi
  28. if [[ ! -f $DIR ]]; then
  29. echo "*" > $FILE
  30. echo "!.gitignore" >> $FILE
  31. fi
  32. git add -f $FILE
  33. }
  34. ignore uploads
  35. ignore upgrade
  36. if [[ $MCLOUD -eq 1 ]]; then
  37. ignore mcloud-reports
  38. ignore mcloud-view-cache
  39. fi
  40. # Create git ignore in quick script dir
  41. QUICK_DIR_GIT_IGNORE="${SCRIPT_DIR}/.gitignore"
  42. if [[ ! -f $QUICK_DIR_GIT_IGNORE ]]; then
  43. echo "/*.sh" > $QUICK_DIR_GIT_IGNORE
  44. fi
  45. git add -f $QUICK_DIR_GIT_IGNORE