File tree Expand file tree Collapse file tree 2 files changed +14
-9
lines changed
Expand file tree Collapse file tree 2 files changed +14
-9
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,8 @@ MAINTAINER Sam Hausmann
44# install necessary packages
55RUN apt-get -y update && apt-get install -y git && apt-get install -y vim && apt-get install -y curl
66
7+ RUN npm install -g grunt-cli && npm install -g eslint
8+
79ENV API_KEY api_key
810
911RUN mkdir /nodejs-dev
Original file line number Diff line number Diff line change 22
33ping_url=" https://api.rosette.com/rest/v1/"
44retcode=0
5+ errors=( " Exception" " processingFailure" " badRequest" " ParseError" " ValueError" " SyntaxError" )
56
67# ------------------- Functions -------------------------------------
78
@@ -15,6 +16,10 @@ function HELP {
1516 exit 1
1617}
1718
19+ if [ ! -z ${ALT_URL} ]; then
20+ ping_url=${ALT_URL}
21+ fi
22+
1823# Checks if Rosette API key is valid
1924function checkAPI() {
2025 match=$( curl " ${ping_url} ping" -H " X-RosetteAPI-Key: ${API_KEY} " | grep -o " forbidden" )
@@ -54,11 +59,11 @@ function runExample() {
5459 fi
5560 echo " ${result} "
5661 echo -e " \n---------- ${1} end -------------"
57- if [[ $result == * " Exception " * ]] ; then
58- retcode=1
59- elif [[ $result == * " processingFailure " * ]] ; then
60- retcode=1
61- fi
62+ for err in " ${errors[@]} " ; do
63+ if [[ ${result} == * " ${err} " * ]] ; then
64+ retcode=1
65+ fi
66+ done
6267}
6368
6469
@@ -87,15 +92,11 @@ validateURL
8792cp -r -n /source/. .
8893
8994# Run unit tests
90- npm install -g grunt-cli
91- npm install -g eslint
9295npm install
9396grunt test
9497# run eslint
9598eslint lib/* .js
9699
97-
98-
99100# Run the examples
100101if [ ! -z ${API_KEY} ]; then
101102 checkAPI
@@ -104,8 +105,10 @@ if [ ! -z ${API_KEY} ]; then
104105 npm install argparse
105106 npm install temporary
106107 if [ ! -z ${FILENAME} ]; then
108+ echo -e " \nRunning example against: ${ping_url} \n"
107109 runExample ${FILENAME}
108110 else
111+ echo -e " \nRunning examples against: ${ping_url} \n"
109112 for file in * .js; do
110113 runExample $file
111114 done
You can’t perform that action at this time.
0 commit comments