pack.sh 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. #!/bin/bash
  2. #
  3. # pack.sh
  4. #
  5. # pack tarballs for release
  6. #
  7. # @author Christopher Han <xiphux@gmail.com>
  8. # @copyright Copyright (c) 2010 Christopher Han
  9. # @package GitPHP
  10. # @package util
  11. #
  12. STAGEDIR="staging"
  13. PKGDIR="gitphp"
  14. # Prepare the staging directory
  15. rm -Rf "${STAGEDIR}"
  16. mkdir -p "${STAGEDIR}"
  17. # Get a working snapshot of the HEAD
  18. git archive --format=tar --prefix=${PKGDIR}/ HEAD | tar -C "${STAGEDIR}" -xvf -
  19. # Get the version
  20. cd "${STAGEDIR}"
  21. VERSION="`cat ${PKGDIR}/include/version.php | grep '^\$gitphp_version = ' | cut -d '\"' -f 2`"
  22. if [ -z "${VERSION}" ]; then
  23. echo "Could not determine version"
  24. exit 1
  25. fi
  26. # Make the snapshot versioned
  27. PKGVERDIR="${PKGDIR}-${VERSION}"
  28. mv -v "${PKGDIR}" "${PKGVERDIR}"
  29. cd "${PKGVERDIR}"
  30. # Remove the gitignore files
  31. find . -iname '.gitignore' -exec rm {} ';'
  32. # Build the translations
  33. ./util/msgfmt.sh
  34. # Minify javascript
  35. ./util/minify.sh
  36. # Remove requirejs compressor after we've used it, no need to redistribute it
  37. rm -Rf lib/requirejs
  38. rm -Rf lib/closure
  39. rm -Rf lib/rhino
  40. # Remove the utility scripts
  41. rm -rf ./util
  42. # Remove test classes
  43. rm -rf ./test
  44. cd ..
  45. # Roll the tarballs
  46. rm -f ${PKGVERDIR}.zip
  47. rm -f ${PKGVERDIR}.tar.bz2
  48. rm -f ${PKGVERDIR}.tar.gz
  49. zip -r9 ${PKGVERDIR}.zip ${PKGVERDIR}
  50. tar -cf ${PKGVERDIR}.tar ${PKGVERDIR}/
  51. bzip2 -kv9 ${PKGVERDIR}.tar
  52. gzip -v9 ${PKGVERDIR}.tar
  53. # Remove the working copy
  54. rm -rf ${PKGVERDIR}