Skip to content

Commit

Permalink
refactor: sh interpreter
Browse files Browse the repository at this point in the history
  • Loading branch information
tpluscode committed Nov 28, 2023
1 parent 6b3d23e commit bb9988c
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions test/profiles.sh
Original file line number Diff line number Diff line change
@@ -1,36 +1,36 @@
#!/usr/bin/env bash
#!/usr/bin/env sh

SCRIPT_PATH="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
FAILED=0

SHACL_PLAYGROUND_URL="https://shacl-playground.zazuko.com/"
SHORTENER="https://s.zazuko.com/api/v1/shorten/"

function urlencode() {
urlencode() {
set +x

local string="$1"
local strlen=${#string}
local encoded=""
local pos c o
string="$1"
strlen=${#string}
encoded=""
pos c o

for (( pos=0 ; pos<strlen ; pos++ )); do
c=${string:$pos:1}
case "$c" in
[-_.~a-zA-Z0-9] ) o="${c}" ;;
* ) printf -v o '%%%02x' "'$c"
esac
encoded+="${o}"
encoded="${encoded}${o}"
done
echo "${encoded}"
}

function getPlaygroundUrl() {
local playgroundUrl="$SHACL_PLAYGROUND_URL#page=2&shapesGraph=$(urlencode "$1")&dataGraph=$(urlencode "$2")&dataGraphFormat=text%2Fturtle"
getPlaygroundUrl() {
playgroundUrl="$SHACL_PLAYGROUND_URL#page=2&shapesGraph=$(urlencode "$1")&dataGraph=$(urlencode "$2")&dataGraphFormat=text%2Fturtle"
curl -s $SHORTENER --data-raw "url=$playgroundUrl"
}

function reportFailure() {
reportFailure() {
playground=$(getPlaygroundUrl "$1" "$2")
echo "❌ FAIL - check report on $playground"
}
Expand Down

0 comments on commit bb9988c

Please sign in to comment.