forked from runwhen-contrib/codecollection-devtools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ro
executable file
·32 lines (32 loc) · 1.52 KB
/
ro
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/bash
# ======================================================================================
# Synopsis: Shorthand for robot run command that outputs logs to a standard location for viewing at localhost:3000
# ======================================================================================
function ro (){
ROBOT_FILE_EXECUTING=${!#}
if [ "$ROBOT_FILE_EXECUTING" = ".." ]; then
echo "Parent directory execution not supported"
exit 1
fi
# if user runs on pwd, could be either sli, runbook, or multiple, so we default to "codebundle"
if [ "$ROBOT_FILE_EXECUTING" = "." ]; then
ROBOTFILE_DIR_NAME=$PWD
CODEBUNDLE_NAME=$(basename $ROBOTFILE_DIR_NAME)
OUTPUT_DIR=$ROBOT_LOG_DIR/$CODEBUNDLE_NAME
TYPE="codebundle"
# if the user runs ro against a directory and not a specific robot file
elif [ -d "$ROBOT_FILE_EXECUTING" ] && ! echo "$ROBOT_FILE_EXECUTING" | grep -q ".robot"; then
ROBOTFILE_DIR_NAME=$ROBOT_FILE_EXECUTING
CODEBUNDLE_NAME=$(basename $ROBOTFILE_DIR_NAME)
OUTPUT_DIR=$ROBOT_LOG_DIR/$CODEBUNDLE_NAME
TYPE="codebundle"
# assume absolute path
else
ROBOTFILE_DIR_NAME=$(dirname $ROBOT_FILE_EXECUTING)
CODEBUNDLE_NAME=$(basename $ROBOTFILE_DIR_NAME)
OUTPUT_DIR=$ROBOT_LOG_DIR/$CODEBUNDLE_NAME
TYPE=$(basename $ROBOT_FILE_EXECUTING .robot)
fi
robot --loglevel trace --outputdir $OUTPUT_DIR --log $TYPE-log.html --output $TYPE-output.xml --report $TYPE-report.html "${@:1}"
}
ro "$@"