Skip to content

Commit bec56f5

Browse files
committed
Only generate template and example data when needed
1 parent 90b3915 commit bec56f5

File tree

1 file changed

+23
-19
lines changed

1 file changed

+23
-19
lines changed

scripts/set-up-repo.sh

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -20,25 +20,29 @@ if [ "$SHACL_URL" != "" -a "$AP_URL" != "" ]; then
2020
echo "Adding AP and SHACL links to README"
2121
$SCRIPTS_DIR/update-readme.sh $ap_url $shacl_url
2222

23-
cd $WORK_DIR
24-
$SCRIPTS_DIR/clone-ap-data-to-dashboard.sh || exit 1
25-
26-
echo "Copying shacl file in-shacl directory"
27-
cp $ROOT_DIR/in-shacl/* $WORK_DIR/ap-data-to-dashboard/in-shacl || exit 1
28-
29-
cd $WORK_DIR
30-
echo "Installing ap-data-to-dashboard"
31-
$SCRIPTS_DIR/install-ap-data-to-dashboard.sh &> /dev/null || exit 1
32-
33-
echo "Generating template and example data"
34-
cd ap-data-to-dashboard
35-
node src/shacl-to-template.js || exit 1
36-
37-
echo "Moving template and example data"
38-
cp in-shacl/template.xlsx $ROOT_DIR/template.xlsx
39-
cp in-shacl/template.schema.json $ROOT_DIR/in-shacl/template.schema.json
40-
rm -rf $ROOT_DIR/example-data && mkdir $ROOT_DIR/example-data
41-
cp in-shacl/dummy* $ROOT_DIR/example-data
23+
if [ -f "$ROOT_DIR/template.xlsx" ]; then
24+
echo "Template and example data already exist"
25+
else
26+
cd $WORK_DIR
27+
$SCRIPTS_DIR/clone-ap-data-to-dashboard.sh || exit 1
28+
29+
echo "Copying shacl file in-shacl directory"
30+
cp $ROOT_DIR/in-shacl/* $WORK_DIR/ap-data-to-dashboard/in-shacl || exit 1
31+
32+
cd $WORK_DIR
33+
echo "Installing ap-data-to-dashboard"
34+
$SCRIPTS_DIR/install-ap-data-to-dashboard.sh &> /dev/null || exit 1
35+
36+
echo "Generating template and example data"
37+
cd ap-data-to-dashboard
38+
node src/shacl-to-template.js || exit 1
39+
40+
echo "Moving template and example data"
41+
cp in-shacl/template.xlsx $ROOT_DIR/template.xlsx
42+
cp in-shacl/template.schema.json $ROOT_DIR/in-shacl/template.schema.json
43+
rm -rf $ROOT_DIR/example-data && mkdir $ROOT_DIR/example-data
44+
cp in-shacl/dummy* $ROOT_DIR/example-data
45+
fi
4246
else
4347
echo "ERROR: AP url or SHACL url is not defined. Please update the file \"urls.env\"."
4448
exit 1

0 commit comments

Comments
 (0)