Drupal investigation

package 1012B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #!/usr/bin/env bash
  2. set -ev
  3. cd "${BASH_SOURCE%/*}/.."
  4. USAGE="usage: bin/package [-v PACKAGE_VERSION]"
  5. while getopts ":v:h" opt; do
  6. case $opt in
  7. v)
  8. PKG_VERSION=$OPTARG
  9. ;;
  10. h)
  11. echo $USAGE >&2
  12. exit
  13. ;;
  14. \?)
  15. echo "Invalid option: -$OPTARG" >&2
  16. echo $USAGE >&2
  17. exit 1
  18. ;;
  19. :)
  20. echo "Option -$OPTARG requires an argument" >&2
  21. echo $USAGE >&2
  22. exit 1
  23. ;;
  24. esac
  25. done
  26. ./bin/build || exit 1
  27. chmod +x *.phar
  28. echo "Creating tarballs"
  29. mkdir -p dist || exit 1
  30. if [ -z "$PKG_VERSION" ]; then
  31. PKG_VERSION=$(git describe --tag --exact-match)
  32. if [[ $(php --version) = PHP\ 5.3* ]]; then
  33. PKG_VERSION=${PKG_VERSION}-php53
  34. fi
  35. fi
  36. # Support BSD tar because OS X :(
  37. TAR_FLAGS='--transform="flags=r;s/.*/psysh/"'
  38. if [[ $(tar --version) = bsdtar* ]]; then
  39. TAR_FLAGS='-s /.*/psysh/'
  40. fi
  41. tar $TAR_FLAGS -czf dist/psysh-${PKG_VERSION}.tar.gz psysh.phar
  42. tar $TAR_FLAGS -czf dist/psysh-${PKG_VERSION}-compat.tar.gz psysh-compat.phar