diff --git a/precommit b/precommit new file mode 100755 index 0000000..5e00fd2 --- /dev/null +++ b/precommit @@ -0,0 +1,16 @@ +#!/bin/sh +# +# Run this usually from a pre-commit hook... +# +. "$(dirname "$(readlink -f "$0")")/libcommon/utils/init.sh" + +[ ! -f plugin.yml ] && fatal "No plugin.yml" +[ -f README.md ] && $gd3tool gen -w src + +if [ -d resource/messages ] ; then + $mcgen gen resources/messages src $([ -d libcommon/src ] && echo libcommon/src) + $mcgen enc resources/messages +fi + +$mkver src +phplint src || fatal "Failed lint" diff --git a/t/main/cfg.sh b/t/main/cfg.sh new file mode 100755 index 0000000..920f030 --- /dev/null +++ b/t/main/cfg.sh @@ -0,0 +1,22 @@ +#!/bin/sh +# +download_url="https://github.com/Muirfield/ManyWorlds/archive/master.zip" + + +pre() { + wget -O $MPDIR/plugins/test.zip $download_url +} + +post() { + rm -f $MPDIR/plugins/*.zip +} + +case "$1" in + pre) + pre "$@" + ;; + post) + post "$@" + ;; +esac + \ No newline at end of file diff --git a/t/main/try.pms b/t/main/try.pms new file mode 100644 index 0000000..ea508f5 --- /dev/null +++ b/t/main/try.pms @@ -0,0 +1,8 @@ +# +# Check if MW loaded. We assume MW is in the attached zip... +# +@ $cmdmap = $server->getCommandMap() +@ $oldcmd = $cmdmap->getCommand("mw") +@ if (!$oldcmd) return + +mw help diff --git a/test b/test new file mode 100755 index 0000000..470da9a --- /dev/null +++ b/test @@ -0,0 +1,25 @@ +#!/bin/sh +# +. "$(dirname "$(readlink -f "$0")")/libcommon/utils/init.sh" +. $utlib/pm.sh +. $utlib/unitest.sh + +trap 'exit $retcode' EXIT + +[ ! -f plugin.yml ] && fatal "No plugin.yml" +[ -f README.md ] && $gd3tool gen -w src + +$mkver src +phplint src || fatal "Failed lint" + +install_pocketmine +testgroup="$(default_tests t "$@")" +[ -z "$testgroup" ] && exit + +pm_plugins +$mkplugin -o $MPDIR/plugins libcommon/ +$mkplugin -o $MPDIR/plugins . + +runtests $testgroup + +show_results