Skip to content

Commit

Permalink
initial commit for #24 - tagui runner options
Browse files Browse the repository at this point in the history
new chrome option for visible chrome
new headless option for headless chrome
  • Loading branch information
kensoh authored Jun 20, 2017
1 parent fc8692e commit 2901816
Show file tree
Hide file tree
Showing 2 changed files with 140 additions and 17 deletions.
44 changes: 35 additions & 9 deletions src/tagui
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,41 @@ if [ -f "$(pwd)/casperjs/bin/casperjs" ]; then CASPERJS_EXECUTABLE="$(pwd)/caspe
if [ -f "$(pwd)/phantomjs/bin/phantomjs" ]; then export PHANTOMJS_EXECUTABLE="$(pwd)/phantomjs/bin/phantomjs"; fi
if [ -f "$(pwd)/slimerjs/slimerjs" ]; then export SLIMERJS_EXECUTABLE="$(pwd)/slimerjs/slimerjs"; fi

# check firefox parameter to run on visible firefox browser through slimerjs
if [ "$2" = "firefox" ]; then set -- "$1" "--engine=slimerjs" "${@:3}"; fi
if [ "$3" = "firefox" ]; then set -- "${@:1:2}" "--engine=slimerjs" "${@:4}"; fi
if [ "$4" = "firefox" ]; then set -- "${@:1:3}" "--engine=slimerjs" "${@:5}"; fi
if [ "$5" = "firefox" ]; then set -- "${@:1:4}" "--engine=slimerjs" "${@:6}"; fi
if [ "$6" = "firefox" ]; then set -- "${@:1:5}" "--engine=slimerjs" "${@:7}"; fi
if [ "$7" = "firefox" ]; then set -- "${@:1:6}" "--engine=slimerjs" "${@:8}"; fi
if [ "$8" = "firefox" ]; then set -- "${@:1:7}" "--engine=slimerjs" "${@:9}"; fi
if [ "$9" = "firefox" ]; then set -- "${@:1:8}" "--engine=slimerjs"; fi
# set default web browser to be used to phantomjs
tagui_web_browser="phantomjs"

# check chrome parameter to run on in-built integration with visible chrome
if [ "$2" = "chrome" ]; then set -- "$1" "${@:3}"; tagui_web_browser="chrome"; fi
if [ "$3" = "chrome" ]; then set -- "${@:1:2}" "${@:4}"; tagui_web_browser="chrome"; fi
if [ "$4" = "chrome" ]; then set -- "${@:1:3}" "${@:5}"; tagui_web_browser="chrome"; fi
if [ "$5" = "chrome" ]; then set -- "${@:1:4}" "${@:6}"; tagui_web_browser="chrome"; fi
if [ "$6" = "chrome" ]; then set -- "${@:1:5}" "${@:7}"; tagui_web_browser="chrome"; fi
if [ "$7" = "chrome" ]; then set -- "${@:1:6}" "${@:8}"; tagui_web_browser="chrome"; fi
if [ "$8" = "chrome" ]; then set -- "${@:1:7}" "${@:9}"; tagui_web_browser="chrome"; fi
if [ "$9" = "chrome" ]; then set -- "${@:1:8}"; tagui_web_browser="chrome"; fi

# check headless parameter to run on in-built integration with headless chrome
if [ "$2" = "headless" ]; then set -- "$1" "${@:3}"; tagui_web_browser="headless"; fi
if [ "$3" = "headless" ]; then set -- "${@:1:2}" "${@:4}"; tagui_web_browser="headless"; fi
if [ "$4" = "headless" ]; then set -- "${@:1:3}" "${@:5}"; tagui_web_browser="headless"; fi
if [ "$5" = "headless" ]; then set -- "${@:1:4}" "${@:6}"; tagui_web_browser="headless"; fi
if [ "$6" = "headless" ]; then set -- "${@:1:5}" "${@:7}"; tagui_web_browser="headless"; fi
if [ "$7" = "headless" ]; then set -- "${@:1:6}" "${@:8}"; tagui_web_browser="headless"; fi
if [ "$8" = "headless" ]; then set -- "${@:1:7}" "${@:9}"; tagui_web_browser="headless"; fi
if [ "$9" = "headless" ]; then set -- "${@:1:8}"; tagui_web_browser="headless"; fi

# check firefox parameter to run on visible firefox browser through slimerjs
if [ "$2" = "firefox" ]; then set -- "$1" "--engine=slimerjs" "${@:3}"; tagui_web_browser="firefox"; fi
if [ "$3" = "firefox" ]; then set -- "${@:1:2}" "--engine=slimerjs" "${@:4}"; tagui_web_browser="firefox"; fi
if [ "$4" = "firefox" ]; then set -- "${@:1:3}" "--engine=slimerjs" "${@:5}"; tagui_web_browser="firefox"; fi
if [ "$5" = "firefox" ]; then set -- "${@:1:4}" "--engine=slimerjs" "${@:6}"; tagui_web_browser="firefox"; fi
if [ "$6" = "firefox" ]; then set -- "${@:1:5}" "--engine=slimerjs" "${@:7}"; tagui_web_browser="firefox"; fi
if [ "$7" = "firefox" ]; then set -- "${@:1:6}" "--engine=slimerjs" "${@:8}"; tagui_web_browser="firefox"; fi
if [ "$8" = "firefox" ]; then set -- "${@:1:7}" "--engine=slimerjs" "${@:9}"; tagui_web_browser="firefox"; fi
if [ "$9" = "firefox" ]; then set -- "${@:1:8}" "--engine=slimerjs"; tagui_web_browser="firefox"; fi

# export web browser variable for use in parsing flow
export tagui_web_browser=$tagui_web_browser

# check debug parameter to show run-time backend messages from phantomjs
if [ "$2" = "debug" ]; then set -- "$1" "--verbose" "${@:3}"; fi
Expand Down
113 changes: 105 additions & 8 deletions src/tagui.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,112 @@ set arg7=%7
set arg8=%8
set arg9=%9

rem set default web browser to be used to phantomjs
set tagui_web_browser=phantomjs

rem check chrome parameter to run on in-built integration with visible chrome
if "%arg2%"=="chrome" (
set arg2=
set tagui_web_browser=chrome
)
if "%arg3%"=="chrome" (
set arg3=
set tagui_web_browser=chrome
)
if "%arg4%"=="chrome" (
set arg4=
set tagui_web_browser=chrome
)
if "%arg5%"=="chrome" (
set arg5=
set tagui_web_browser=chrome
)
if "%arg6%"=="chrome" (
set arg6=
set tagui_web_browser=chrome
)
if "%arg7%"=="chrome" (
set arg7=
set tagui_web_browser=chrome
)
if "%arg8%"=="chrome" (
set arg8=
set tagui_web_browser=chrome
)
if "%arg9%"=="chrome" (
set arg9=
set tagui_web_browser=chrome
)

rem check headless parameter to run on in-built integration with headless chrome
if "%arg2%"=="headless" (
set arg2=
set tagui_web_browser=headless
)
if "%arg3%"=="headless" (
set arg3=
set tagui_web_browser=headless
)
if "%arg4%"=="headless" (
set arg4=
set tagui_web_browser=headless
)
if "%arg5%"=="headless" (
set arg5=
set tagui_web_browser=headless
)
if "%arg6%"=="headless" (
set arg6=
set tagui_web_browser=headless
)
if "%arg7%"=="headless" (
set arg7=
set tagui_web_browser=headless
)
if "%arg8%"=="headless" (
set arg8=
set tagui_web_browser=headless
)
if "%arg9%"=="headless" (
set arg9=
set tagui_web_browser=headless
)

rem check firefox parameter to run on visible firefox browser through slimerjs
if "%arg2%"=="firefox" set arg2=--engine=slimerjs
if "%arg3%"=="firefox" set arg3=--engine=slimerjs
if "%arg4%"=="firefox" set arg4=--engine=slimerjs
if "%arg5%"=="firefox" set arg5=--engine=slimerjs
if "%arg6%"=="firefox" set arg6=--engine=slimerjs
if "%arg7%"=="firefox" set arg7=--engine=slimerjs
if "%arg8%"=="firefox" set arg8=--engine=slimerjs
if "%arg9%"=="firefox" set arg9=--engine=slimerjs
if "%arg2%"=="firefox" (
set arg2=--engine=slimerjs
set tagui_web_browser=firefox
)
if "%arg3%"=="firefox" (
set arg3=--engine=slimerjs
set tagui_web_browser=firefox
)
if "%arg4%"=="firefox" (
set arg4=--engine=slimerjs
set tagui_web_browser=firefox
)
if "%arg5%"=="firefox" (
set arg5=--engine=slimerjs
set tagui_web_browser=firefox
)
if "%arg6%"=="firefox" (
set arg6=--engine=slimerjs
set tagui_web_browser=firefox
)
if "%arg7%"=="firefox" (
set arg7=--engine=slimerjs
set tagui_web_browser=firefox
)
if "%arg8%"=="firefox" (
set arg8=--engine=slimerjs
set tagui_web_browser=firefox
)
if "%arg9%"=="firefox" (
set arg9=--engine=slimerjs
set tagui_web_browser=firefox
)

rem export web browser variable not needed for windows batch file

rem check debug parameter to show run-time backend messages from phantomjs
if "%arg2%"=="debug" set arg2=--verbose
Expand Down

0 comments on commit 2901816

Please sign in to comment.