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 2016-05-12 13:09:51 -05:00
commit 153c12dfb3
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 ""
echo " Normal commands:"
echo " * rb, rbp, 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 " * 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 " * 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 " * 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 " * t, testserver | Run the test server with the set of plugins Paper uses as a basis for server tests."
echo ""
echo " These commands require the setup command before use:"
echo " * r, root | Change directory to the root of the project."
echo " * a. api | Move to the Paper-API 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 " | 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 " * r, root | Change directory to the root of the project."
echo " * a. api | Move to the Paper-API directory."
echo " * s, server | Move to the Paper-Server directory."
echo " * td, testdirectory | Move to the test-server directory."
echo " * e, edit | Use to edit a specific patch, give it the argument \"server\" or \"api\""
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 " * setup | Add an alias to $RCPATH to allow full functionality of this script. Run as:"
echo " | . ./paper setup"
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 " | this default, such as:"
echo " | . ./paper setup example"
echo " | Which will allow you to run 'example' instead."
echo " * setup | Add an alias to $RCPATH to allow full functionality of this script. Run as:"
echo " | . ./paper setup"
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 " | this default, such as:"
echo " | . ./paper setup example"
echo " | Which will allow you to run 'example' instead."
;;
esac

View File

@ -1,4 +1,5 @@
#!/bin/bash
#!/usr/bin/env bash
set -e
PS1="$"
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"
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
#
multiplex=${PAPER_TEST_MULTIPLEXER:-screen}
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
multiplex=${PAPER_TEST_MULTIPLEXER}
if [ "$multiplex" == "tmux" ] && [ ! -z "$(which tmux)" ]; then
echo "tmux not supported"
elif [ ! -z "$(which screen)" ]; then # default screen last as final fallback
cmd="screen -DURS papertest $cmd"
if [ "$multiplex" == "screen" ]; then
if command -v "screen" >/dev/null 2>&1 ; then
cmd="$screen_command"
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
echo "Screen not found - It is strongly recommended to install screen"
sleep 3
if command -v "screen" >/dev/null 2>&1 ; then
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
#
@ -108,7 +123,10 @@ fi
#
if [ ! -z "$PAPER_TEST_COMMAND_WRAPPER" ]; then
$PAPER_TEST_COMMAND_WRAPPER $cmd
$PAPER_TEST_COMMAND_WRAPPER $cmd
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