123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- #!/bin/bash
- # test wepy new demo
- # Start in tasks/ even if run from root directory
- cd "$(dirname "$0")"
- function cleanup() {
- echo 'Cleaning up.'
- }
- # Error messages are redirected to stderr
- function handle_error() {
- echo "$(basename $0): ERROR! An error was encountered executing line $1." 1>&2;
- cleanup
- echo 'Exiting with error.' 1>&2;
- exit 1
- }
- function handle_exit() {
- cleanup
- echo 'Exiting without error.' 1>&2;
- exit
- }
- # Exit the script with a helpful error message when any error is encountered
- trap 'set +x; handle_error $LINENO $BASH_COMMAND' ERR
- # Cleanup before exit on any termination signal
- trap 'set +x; handle_exit' SIGQUIT SIGTERM SIGINT SIGKILL SIGHUP
- # Echo every command being executed
- set -x
- # Go to root
- cd ..
- root_path=$PWD
- npm link packages/cli
- wepy -v
- wepy list
- mkdir -p /tmp/templates/
- cd /tmp/templates/
- buildcases="${root_path}/test/build-cases"
- for bc in ${buildcases}/*; do
- name=$(basename $bc .sh)
- "$root_path"/test/build-cases/"$name".sh
- cd "/tmp/templates/${name}"
- node "$root_path"/packages/cli/bin/wepy.js build
- done
- # Test build demos
- cd /tmp/templates
- # node "$root_path"/packages/cli/bin/wepy.js init wepyjs/wepy-wechat-demo wepy-wechat-demo
- git clone https://github.com/wepyjs/wepy-wechat-demo.git --branch 2.0
- cd wepy-wechat-demo
- npm install
- npm run build
- cd ..
- # Cleanup
- cleanup
|