package-parts 830 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #!/bin/bash
  2. #
  3. # package-parts - Package parts of a product
  4. #
  5. function packageParts() {
  6. unset CDPATH
  7. local PARTS="api, app, ui, web"
  8. while [[ $# -gt 0 ]] ; do
  9. arg="$1"
  10. case ${arg} in
  11. --parts)
  12. PARTS="${2}"
  13. shift ; shift
  14. ;;
  15. *)
  16. break
  17. ;;
  18. esac
  19. done
  20. PARTS=$(echo ${PARTS} | tr ',' ' ')
  21. for part in ${PARTS} ; do
  22. [ ! -d "${part}" ] && continue
  23. echo -e "\nPackage ${part} $*"
  24. cd "./${part}"
  25. if [ -f gulpfile.ts ] ; then
  26. gulp package $*
  27. elif [ -f main.me ] ; then
  28. me package
  29. elif [ -f Makefile ] ; then
  30. make package
  31. fi
  32. [ $? != 0 ] && exit 2
  33. cd ..
  34. done
  35. }
  36. packageParts $*