11#! /bin/bash
22
3- # Directorio a buscar
43CATALOG_PATH=" ../catalog"
54TMP_FOLDER=" ./tmp"
65
76# Remove previous execution data
87rm -rf " $TMP_FOLDER "
9-
10- # Create Output Folder if not exist
118mkdir -p " $TMP_FOLDER "
129
10+ # Function to place "API usage" code of node files in the correct place
1311process_node_js_file () {
1412 awk '
1513 function process_node_js_file(file) {
@@ -79,6 +77,7 @@ process_node_js_file() {
7977 ' " $1 "
8078 }
8179
80+ # Function to place "API usage" code of python files in the correct place
8281process_python_file () {
8382awk '
8483function process_python_file(file) {
@@ -137,6 +136,7 @@ BEGIN {
137136' " $1 "
138137 }
139138
139+ # Loop through samplecode_ files
140140for samplecode_file in $( find " $CATALOG_PATH " -maxdepth 3 -type f -name " samplecode_*.md" ) ; do
141141# Extract the part of the file name between samplecode_ and .md
142142 filename=$( basename " $samplecode_file " )
@@ -200,15 +200,16 @@ for samplecode_file in $(find "$CATALOG_PATH" -maxdepth 3 -type f -name "samplec
200200 print >> fileName
201201 }
202202 ' " $samplecode_file "
203-
204- # Fix node files to reorder code
203+ # At this point, we have a folder for each programming language and all the code blocks
204+ # that have the same title have been put together.
205+ # Reordering the code in the auth code node files
205206 for file in " $TMP_FOLDER /js/$name " /Auth_code* Node.js.js; do
206207 if [ -f " $file " ]; then
207208 process_node_js_file " $file "
208209 fi
209210 done
210211
211- # Fix authcode python files
212+ # Reordering the code in the auth code python files
212213 for file in " $TMP_FOLDER /py/$name " /Auth_code* Python.py; do
213214 if [ -f " $file " ]; then
214215 process_python_file " $file "
@@ -217,7 +218,7 @@ for samplecode_file in $(find "$CATALOG_PATH" -maxdepth 3 -type f -name "samplec
217218 echo " Processing $name ==> $samplecode_file "
218219done
219220
220- # Execute test
221+ # Execute test and linter
221222echo " ################### Python test ##################################"
222223python python_test.py
223224echo " ################### Node test ##################################"
0 commit comments