-
-
Save danbri/0c26bd3dedfcc66e73fb5f2b4c682e3e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Copyright Google 2022 -See LICENSE for Apache2 license terms. | |
# Rough hack that creates a transient filetree designed for static serving. | |
# e.g. python3 -m http.server | |
# or even: php -S localhost:8000 | |
# | |
# Goal is to set up these filepaths, e.g. | |
# http://localhost:8000/tests | |
# http://localhost:8000/hierarchy | |
# http://localhost:8000/services/map | |
# http://localhost:8000/shacl/subclasses | |
# http://localhost:8000/shacl/shapes | |
# http://localhost:8000/shex/shapes | |
mkdir -p ./_serving | |
cp basic_demo.html ./_serving/ | |
cp -r static/ ./_serving/ | |
rm -rf _serving/static/js/libs/schemarama.bundle.* | |
cp ./static/js/libs/schemarama.bundle.* ./_serving/static/js/libs/ | |
# check the JS came through without symlinks | |
## echo "Origin:" | |
## ls -l static/js/libs/schemarama.bundle*.js | |
## echo "Target:" | |
## ls -l _serving/static/js/libs/ | |
# schemarama.bundle.js -> ../../../../core/dist/schemarama.bundle.js | |
# schemarama.bundle.min.js -> ../../../../core/dist/schemarama.bundle.min.js | |
# /shacl/shapes | |
mkdir -p ./_serving/shacl | |
cp ./validation/shacl/full.shacl ./_serving/shacl/shapes | |
# /shex/shapes | |
mkdir -p ./_serving/shex | |
cp ./validation/shex/full.shexj ./_serving/shex/shapes | |
# /shacl/subclasses | |
mkdir -p ./_serving/shacl | |
cp ./validation/shacl/subclasses.ttl ./_serving/shacl/subclasses | |
# /hierarchy | |
# Note: this should be same as config.py version | |
cat << EOF > ./_serving/hierarchy | |
{ | |
'service': 'Schema', | |
'nested': [ | |
{ | |
'service': 'ServiceA' | |
}, | |
{ | |
'service': 'ServiceB', | |
'nested': [ | |
{ | |
'service': 'ServiceBProduct1' | |
}, | |
{ | |
'service': 'ServiceBProduct2' | |
}, | |
{ | |
'service': 'ServiceBProduct3' | |
} | |
] | |
}, | |
{ | |
'service': 'ServiceC' | |
}, | |
{ | |
'service': 'ServiceD' | |
} | |
] | |
} | |
EOF | |
# /services/map | |
mkdir -p ./_serving/services/ | |
cp ./validation/shapeToService.json ./_serving/services/map | |
# /tests | |
# Start with none. | |
cat << EOF > ./_serving/tests | |
{ | |
"tests": [ | |
"{\"@context\": \"https://schema.org/\", \"@id\": \"http://example.org/recipe\", \"@type\": \"Recipe\", \"name\": \"Mom's World Famous Banana Bread\", \"cookTime\": \"wwwwwwPT1H\"}", | |
"second example here e.g. microdata..." | |
] | |
} | |
EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment