Merge pull request #279 from DemonWav/tmux

Add tmux support to Paper test and add test to paper command help.
This commit is contained in:
Zach Brown 2016-05-12 13:09:51 -05:00
commit 3b4f1c9497
2 changed files with 51 additions and 31 deletions

36
paper
View file

@ -145,26 +145,28 @@ case "$1" in
echo "'setup' command. View below for details. For essential building and patching, you do not need to do the setup." echo "'setup' command. View below for details. For essential building and patching, you do not need to do the setup."
echo "" echo ""
echo " Normal commands:" echo " Normal commands:"
echo " * rb, rbp, rebuild | Rebuild patches, can be called from anywhere." echo " * rb, rebuild | Rebuild patches, can be called from anywhere."
echo " * p, patch | Apply all patches to the project without building it. Can be run from anywhere." echo " * p, patch | Apply all patches to the project without building it. Can be run from anywhere."
echo " * j, jar | Apply all patches and build the project, paperclip.jar will be output. Can be run from anywhere." echo " * j, jar | Apply all patches and build the project, paperclip.jar will be output. Can be run from anywhere."
echo " * m, mcdev | Setup decompiled sources for non-modified NMS files to be imported into an IDE. Can be run from anywhere." echo " * m, mcdev | Setup decompiled sources for non-modified NMS files to be imported into an IDE. Can be run from anywhere."
echo " * t, testserver | Run the test server with the set of plugins Paper uses as a basis for server tests."
echo "" echo ""
echo " These commands require the setup command before use:" echo " These commands require the setup command before use:"
echo " * r, root | Change directory to the root of the project." echo " * r, root | Change directory to the root of the project."
echo " * a. api | Move to the Paper-API directory." echo " * a. api | Move to the Paper-API directory."
echo " * s, server | Move to the Paper-Server directory." echo " * s, server | Move to the Paper-Server directory."
echo " * e, edit | Use to edit a specific patch, give it the argument \"server\" or \"api\"" echo " * td, testdirectory | Move to the test-server directory."
echo " | respectively to edit the correct project. Use the argument \"continue\" after" echo " * e, edit | Use to edit a specific patch, give it the argument \"server\" or \"api\""
echo " | the changes have been made to finish and rebuild patches. Can be called from anywhere." echo " | respectively to edit the correct project. Use the argument \"continue\" after"
echo " | the changes have been made to finish and rebuild patches. Can be called from anywhere."
echo "" echo ""
echo " * setup | Add an alias to $RCPATH to allow full functionality of this script. Run as:" echo " * setup | Add an alias to $RCPATH to allow full functionality of this script. Run as:"
echo " | . ./paper setup" echo " | . ./paper setup"
echo " | After you run this command you'll be able to just run 'paper' from anywhere." echo " | After you run this command you'll be able to just run 'paper' from anywhere."
echo " | The default name for the resulting alias is 'paper', you can give an argument to override" echo " | The default name for the resulting alias is 'paper', you can give an argument to override"
echo " | this default, such as:" echo " | this default, such as:"
echo " | . ./paper setup example" echo " | . ./paper setup example"
echo " | Which will allow you to run 'example' instead." echo " | Which will allow you to run 'example' instead."
;; ;;
esac esac

View file

@ -1,4 +1,5 @@
#!/bin/bash #!/usr/bin/env bash
set -e set -e
PS1="$" PS1="$"
basedir="$(cd "$1" && pwd -P)" basedir="$(cd "$1" && pwd -P)"
@ -83,24 +84,38 @@ baseargs="$baseargs -XX:+UnlockExperimentalVMOptions -XX:G1NewSizePercent=30 -XX
baseargs="$baseargs -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005" baseargs="$baseargs -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005"
cmd="java ${PAPER_TEST_BASE_JVM_ARGS:-$baseargs} ${PAPER_TEST_EXTRA_JVM_ARGS} -jar $jar" cmd="java ${PAPER_TEST_BASE_JVM_ARGS:-$baseargs} ${PAPER_TEST_EXTRA_JVM_ARGS} -jar $jar"
screen_command="screen -DURS papertest $cmd"
tmux_command="tmux new-session -A -s Paper -n 'Paper Test' -c '$(pwd)' '$cmd'"
# #
# MULTIPLEXER CHOICE # MULTIPLEXER CHOICE
# #
multiplex=${PAPER_TEST_MULTIPLEXER:-screen} multiplex=${PAPER_TEST_MULTIPLEXER}
if [ "$multiplex" == "tmux" ]; then
echo "tmux is currently not supported. Please submit a PR to add tmux support if you need it.";
multiplex="screen"
fi
if [ "$multiplex" == "tmux" ] && [ ! -z "$(which tmux)" ]; then if [ "$multiplex" == "screen" ]; then
echo "tmux not supported" if command -v "screen" >/dev/null 2>&1 ; then
elif [ ! -z "$(which screen)" ]; then # default screen last as final fallback cmd="$screen_command"
cmd="screen -DURS papertest $cmd" else
echo "screen not found"
exit 1
fi
elif [ "$multiplex" == "tmux" ] ; then
if command -v "tmux" >/dev/null 2>&1 ; then
cmd="$tmux_command"
else
echo "tmux not found"
exit 1
fi
else else
echo "Screen not found - It is strongly recommended to install screen" if command -v "screen" >/dev/null 2>&1 ; then
sleep 3 cmd="$screen_command"
elif command -v "tmux" >/dev/null 2>&1 ; then
cmd="$tmux_command"
else
echo "screen or tmux not found - it is strongly recommended to install either"
echo "No terminal multiplexer will be used"
fi
fi fi
# #
@ -108,7 +123,10 @@ fi
# #
if [ ! -z "$PAPER_TEST_COMMAND_WRAPPER" ]; then if [ ! -z "$PAPER_TEST_COMMAND_WRAPPER" ]; then
$PAPER_TEST_COMMAND_WRAPPER $cmd $PAPER_TEST_COMMAND_WRAPPER $cmd
else else
$cmd 2>&1 | tee -a ${PAPER_TEST_OUTPUT_LOG:-logs/output.log} echo "Running command: $cmd"
echo "In directory: $(pwd)"
sleep 1
/usr/bin/env bash -c "$cmd"
fi fi