|
| 1 | +#!/bin/bash |
| 2 | +set -euxo pipefail |
| 3 | + |
| 4 | +XSD_DIR="$(dirname $0)" |
| 5 | + |
| 6 | +source "$XSD_DIR/dmn-namespace-utils.sh" |
| 7 | + |
| 8 | +find_dmn13_files() { |
| 9 | + grep -Hirl $DMN13 --exclude='*.biodi.dmn' --exclude='test-xsd*' --exclude='dmn-namespace-utils.sh' --exclude='migrate-to-new-namespaces.sh' --exclude='DMN13.xsd' --exclude-dir=.git --exclude-dir=target |
| 10 | +} |
| 11 | + |
| 12 | +#find_dmn13_files |
| 13 | + |
| 14 | +# (grep -Hirl 'http://www.omg.org/spec/DMN/20151101/dmn.xsd' --exclude='*.biodi.dmn' --exclude='test-xsd*' --exclude='migrate-to-new-namespaces.sh' --exclude='DMN12.xsd' && find -iname '*.xsd') | xargs sed -i \ |
| 15 | +# -e 's#http://www.omg.org/spec/DMN/20151101/dmn.xsd#http://www.omg.org/spec/DMN/20180521/MODEL/#' \ |
| 16 | +# -e 's#http://www.omg.org/spec/DMN/20151101/DMNDI#http://www.omg.org/spec/DMN/20180521/DMNDI/#' \ |
| 17 | +# -e 's#http://www.omg.org/spec/DMN/20151101/DI#http://www.omg.org/spec/DMN/20180521/DI/#' \ |
| 18 | +# -e 's#http://www.omg.org/spec/DMN/20151101/DC#http://www.omg.org/spec/DMN/20180521/DC/#' \ |
| 19 | +# -e 's#http://www.omg.org/spec/FEEL/20140401#http://www.omg.org/spec/DMN/20180521/FEEL/#' |
| 20 | + |
| 21 | +# (grep -Hirl 'http://www.omg.org/spec/DMN/20151101/dmn.xsd' --exclude '*.biodi.dmn' --exclude='test-xsd*' && find -iname '*.xsd') | xargs sed -i \ |
| 22 | +# -e 's#http://www.omg.org/spec/DMN/20151101/dmn.xsd#http://www.omg.org/spec/DMN/20180521/DMN12.xsd#' \ |
| 23 | +# -e 's#http://www.omg.org/spec/DMN/20151101/DMNDI#http://www.omg.org/spec/DMN/20180521/DMNDI12.xsd#' \ |
| 24 | +# -e 's#http://www.omg.org/spec/DMN/20151101/DI#http://www.omg.org/spec/DMN/20180521/DI.xsd#' \ |
| 25 | +# -e 's#http://www.omg.org/spec/DMN/20151101/DC#http://www.omg.org/spec/DMN/20180521/DC.xsd#' |
| 26 | + |
| 27 | +# grep -Hirl 'http://www.omg.org/spec/FEEL/20140401' --exclude=DMN11.xsd --exclude='migrate-to-new-namespaces.sh' |
| 28 | +# grep -Hirl 'http://www.omg.org/spec/FEEL/20140401' --exclude=DMN11.xsd --exclude='migrate-to-new-namespaces.sh' | xargs sed -i -e 's#http://www.omg.org/spec/FEEL/20140401#http://www.omg.org/spec/DMN/20180521/FEEL/#' |
| 29 | + |
| 30 | +upgrade_dmn_13_to_dmn_14() { |
| 31 | + sed \ |
| 32 | + -e "s#$DMN13#$DMN14#g" \ |
| 33 | + -e "s#$FEEL13#$FEEL14#g" \ |
| 34 | + "$1" |
| 35 | +} |
| 36 | + |
| 37 | +# recursively search all DMN files in the current directory and perform a schema validation with the DMN 1.1 and 1.2 schemas |
| 38 | +declare -i NUMBER_OF_FILES=0 |
| 39 | +while IFS= read -r -d '' DMN_FILE; do |
| 40 | + NUMBER_OF_FILES+=1 |
| 41 | + #echo "$NUMBER_OF_FILES: $DMN_FILE" |
| 42 | + upgrade_dmn_13_to_dmn_14 "$DMN_FILE" | sponge "$DMN_FILE" |
| 43 | +done < <(find . '(' -iname '*.dmn*.xml' -o -iname '*.dmn' ')' -type f -print0) |
0 commit comments