forked from CyberSource/cybersource-rest-samples-node
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsample_code_runner.sh
25 lines (23 loc) · 875 Bytes
/
sample_code_runner.sh
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
#!/bin/bash
FILECOUNT=0
find Samples -print | grep -i -e "\.js$" > list.txt
echo > output.log
set -e
sample_count=1
while IFS="" read -r p || [ -n "$p" ]
do
if [[ "$p" =~ $(echo ^\($(sed 's/[[:blank:]]//g' sampleCodeIgnoreList.txt | paste -sd '|' /dev/stdin)\)$) ]]; then
printf '\n\n#### SKIPPED - %s ####\n' "$p"
printf '\n\n#### SKIPPED - %s ####\n' "$p" >> output.log
else
printf '\n\n**** RUNNING - %s ****\n' "$p"
printf '\n\n%s. **** RUNNING - %s ****\n' "$sample_count" "$p" >> output.log
node "$p" >> output.log
printf '\n\n**** END RUNNING - %s ****\n' "$p" >> output.log
FILECOUNT=$((FILECOUNT+1))
sample_count=$((sample_count+1))
fi
done < list.txt
printf '\n\n**** %s Sample Codes ran successfully ****\n' "$FILECOUNT"
printf '\n\n**** %s Sample Codes ran successfully ****\n' "$sample_count" >> output.log
rm -f list.txt