Skip to content

Commit

Permalink
simplified and improved external dependency management
Browse files Browse the repository at this point in the history
  • Loading branch information
EsGeh authored and EsGeh committed May 23, 2019
1 parent 05524c5 commit f23c54f
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 28 deletions.
5 changes: 1 addition & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@
/doc/generated

# these files are created/removed by ./scripts/{un,}install.sh
/tei/
/schema/tei_all.rnc
/schema/tei_all.rng
/schema/tei
/dependencies/

items/
CONVERT
Expand Down
1 change: 1 addition & 0 deletions schema/tei
8 changes: 4 additions & 4 deletions scripts/example2odd.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#!/bin/bash

BASE_DIR=$(dirname $0)/..
TEI_DIR=$BASE_DIR/tei
DEP_DIR=$BASE_DIR/dependencies

INPUT_DIR="$BASE_DIR/corpus"
OUTPUT_DIR="$BASE_DIR/schema/odd"
STYLESHEET="$BASE_DIR/tei/Stylesheets/tools/oddbyexample.xsl"
STYLESHEET="$DEP_DIR/Stylesheets/tools/oddbyexample.xsl"
NAME_PATTERN='*'
SUFFIX='.odd'
COMBINATIONS='all'
Expand Down Expand Up @@ -92,7 +92,7 @@ if [[ "$COMBINATIONS" = 'single' || "$COMBINATIONS" = 'both' ]]; then
echo "file: $file"

read -d '' cmd << EOF
java -jar "$TEI_DIR/Stylesheets/lib/saxon9he.jar"
java -jar "$DEP_DIR/Stylesheets/lib/saxon9he.jar"
"$STYLESHEET"
-o:"$OUTPUT_DIR/$output_file"
-it:main
Expand All @@ -115,7 +115,7 @@ fi
if [[ "$COMBINATIONS" = 'all' || "$COMBINATIONS" = 'both' ]]; then
echo "applying on the whole corpus..."
read -d '' cmd << EOF
java -jar "$TEI_DIR/Stylesheets/lib/saxon9he.jar"
java -jar "$DEP_DIR/Stylesheets/lib/saxon9he.jar"
"$STYLESHEET"
-o:"$OUTPUT_DIR/autogen_all$SUFFIX"
-it:main
Expand Down
5 changes: 2 additions & 3 deletions scripts/exit.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
#!/bin/bash

BASE_DIR=$(dirname $0)/..
TEI_DIR=$BASE_DIR/tei
DEP_DIR=$BASE_DIR/dependencies

rm -rf "$TEI_DIR"
rm -rf "$DEP_DIR"
$BASE_DIR/scripts/clean_output.sh
rm -rf $BASE_DIR/schema/tei
21 changes: 10 additions & 11 deletions scripts/init.sh
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
#!/bin/bash

BASE_DIR=$(dirname $0)/..
TEI_DIR=$BASE_DIR/tei
DEP_DIR=$BASE_DIR/dependencies

mkdir -vp "$DEP_DIR"

# download TEI repositories:
mkdir -vp "$TEI_DIR"
cd "$TEI_DIR"

git clone https://github.com/TEIC/TEI.git
cd "$DEP_DIR"
git clone https://github.com/TEIC/TEI.git
git clone https://github.com/TEIC/Stylesheets.git
cd ..

# download some schemata from TEI:
mkdir -p $BASE_DIR/schema/tei/rnc
mkdir -p $BASE_DIR/schema/tei/rng
mkdir -p $BASE_DIR/schema/tei/odd
curl -L http://www.tei-c.org/Vault/P5/current/xml/tei/custom/schema/relaxng/tei_all.rnc > $BASE_DIR/schema/tei/rnc/tei_all.rnc
curl -L http://www.tei-c.org/Vault/P5/current/xml/tei/custom/schema/relaxng/tei_all.rng > $BASE_DIR/schema/tei/rng/tei_all.rng
curl -L http://www.tei-c.org/Vault/P5/current/xml/tei/odd/p5subset.xml > $BASE_DIR/schema/tei/odd/p5subset.xml
mkdir -p tei-schema/rnc
mkdir -p tei-schema/rng
mkdir -p tei-schema/odd
curl -L http://www.tei-c.org/Vault/P5/current/xml/tei/custom/schema/relaxng/tei_all.rnc > "tei-schema/rnc/tei_all.rnc"
curl -L http://www.tei-c.org/Vault/P5/current/xml/tei/custom/schema/relaxng/tei_all.rng > "tei-schema/rng/tei_all.rng"
curl -L http://www.tei-c.org/Vault/P5/current/xml/tei/odd/p5subset.xml > "tei-schema/odd/p5subset.xml"

$(realpath $BASE_DIR)/scripts/updateOutput.sh
4 changes: 2 additions & 2 deletions scripts/local_stylesheet.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

BASE_DIR=$(dirname $0)/..
TEI_DIR=$BASE_DIR/tei
DEP_DIR=$BASE_DIR/dependencies

#######################################
# variables
Expand Down Expand Up @@ -127,7 +127,7 @@ do
output=${output%.*}$SUFFIX
# echo "output: $output"
read -d '' cmd << EOF
java -jar "$TEI_DIR/Stylesheets/lib/saxon9he.jar"
java -jar "$DEP_DIR/Stylesheets/lib/saxon9he.jar"
"$BASE_DIR/stylesheets/$STYLESHEET"
-s:"$file"
-o:"$OUTPUT_DIR/$output"
Expand Down
6 changes: 3 additions & 3 deletions scripts/tei_stylesheet.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

BASE_DIR=$(dirname $0)/..
TEI_DIR=$BASE_DIR/tei
DEP_DIR=$BASE_DIR/dependencies

#######################################
# variables
Expand All @@ -10,7 +10,7 @@ TEI_DIR=$BASE_DIR/tei
input_dir_default="$BASE_DIR/schema/odd"
input_dirs=()
output_dir="$BASE_DIR/schema/generated"
script_dirs=( "$TEI_DIR/Stylesheets/bin" "$BASE_DIR/stylesheets" )
script_dirs=( "$DEP_DIR/Stylesheets/bin" "$BASE_DIR/stylesheets" )
name_pattern='*'
cmd="teitornc"
options=
Expand Down Expand Up @@ -45,7 +45,7 @@ function print_help {
echo " teitornc: create relax-ng schemas"
echo " teitohtml: create html docu"
echo "all values:"
for f in $(ls $TEI_DIR/Stylesheets/bin); do
for f in $(ls $DEP_DIR/Stylesheets/bin); do
echo " $f"
done
}
Expand Down
3 changes: 2 additions & 1 deletion scripts/validate_xml.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/bash

BASE_DIR=$(dirname $0)/..
DEP_DIR=$BASE_DIR/dependencies

input_dir="$BASE_DIR/corpus"
schema_dir="$BASE_DIR/schema/s2/generated/rnc"
Expand Down Expand Up @@ -58,7 +59,7 @@ while read schema_file; do
while read input_file; do
echo -en " with '$input_file'..."
log="$(mktemp)"
java -jar ./tei/Stylesheets/lib/lib/jing.jar \
java -jar $DEP_DIR/Stylesheets/lib/lib/jing.jar \
-c \
"$schema_file" \
"$input_file" \
Expand Down

0 comments on commit f23c54f

Please sign in to comment.