api-tuner 0.2.5 → 0.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/bin/tuner.sh +32 -6
  2. package/package.json +1 -1
package/bin/tuner.sh CHANGED
@@ -24,6 +24,7 @@ function version() {
24
24
  echo " --help Show this help message"
25
25
  }
26
26
 
27
+ PARALLEL=true
27
28
  SILENT=false
28
29
  BASE_IRI=""
29
30
  DEBUG=false
@@ -50,6 +51,10 @@ while [ $# -gt 0 ]; do
50
51
  shift
51
52
  shift
52
53
  ;;
54
+ --no-parallel)
55
+ PARALLEL=false
56
+ shift
57
+ ;;
53
58
  --version)
54
59
  version
55
60
  exit 0
@@ -87,9 +92,30 @@ if [ "$SILENT" != true ]; then
87
92
  fi
88
93
 
89
94
  set -o pipefail
90
- for path in "${PATHS[@]}"; do
91
- (
92
- node "${SCRIPT_PATH}/../lib/parse-test-case.js" --base-iri "$BASE_IRI" -- "${path}" \
93
- | $eye $ARGS "${SCRIPT_PATH}"/../rules/*.n3 ${LIBS[@]:+${LIBS[*]}} -
94
- ) ;
95
- done | $SUMMARY
95
+ process_path() {
96
+ local path="$1"
97
+ if [ "$SILENT" != true ] & [ $PARALLEL == false ]; then
98
+ echo "" >&2
99
+ echo "⚡️ RUNNING <file://$(realpath "$path")>" >&2
100
+ fi
101
+ node "${SCRIPT_PATH}/../lib/parse-test-case.js" --base-iri "$BASE_IRI" -- "${path}" \
102
+ | $eye $ARGS "${SCRIPT_PATH}"/../rules/*.n3 ${LIBS[@]:+${LIBS[*]}} - \
103
+ 2> >(while read -r line; do
104
+ echo "$line" | sed -E 's/^"INFO" TRACE "(.*)"/ℹ️ \1/; s/^"DEBUG" TRACE "(.*)"/🐞 \1/' >&2
105
+ done)
106
+ }
107
+
108
+
109
+ # if parallel
110
+ if [ "$PARALLEL" = true ]; then
111
+ # run in parallel
112
+ for path in "${PATHS[@]}"; do
113
+ process_path "$path" &
114
+ done
115
+ wait
116
+ else
117
+ # run sequentially
118
+ for path in "${PATHS[@]}"; do
119
+ process_path "$path"
120
+ done
121
+ fi | $SUMMARY
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "api-tuner",
3
- "version": "0.2.5",
3
+ "version": "0.2.6",
4
4
  "main": "index.js",
5
5
  "type": "module",
6
6
  "license": "MIT",