zugpferd 0.3.3 → 0.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bin/setup-schemas +28 -20
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 62856c1301920bbea44b64a360effeee49572cc5d0563a3585a57821f97a855d
|
|
4
|
+
data.tar.gz: e1a60440693e9a66f089a5469643d5b9089f1e9e97d2387a415a1fea82420e02
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f0f5da629eeeda2b93ec71a4398ea9cdec486742bf43a8871d663afe06498eea56ad4356e98638fbeb613aaca77e8301f48e62ffc1056c277be3f14651b570bf
|
|
7
|
+
data.tar.gz: 8b26ca18cd6dd8c1ecffc18d465e71796e152ec3ca29e25600627804b119dab8cf962e211937c1eb9ae8e6dcf11e75a5e423a129b6e843f622e84c3381841a79
|
data/bin/setup-schemas
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
2
|
set -euo pipefail
|
|
3
3
|
|
|
4
|
-
VENDOR_DIR="$(
|
|
4
|
+
VENDOR_DIR="$(pwd)/vendor"
|
|
5
5
|
SCHEMAS_DIR="$VENDOR_DIR/schemas"
|
|
6
6
|
TMP_DIR=$(mktemp -d)
|
|
7
7
|
trap 'rm -rf "$TMP_DIR"' EXIT
|
|
8
8
|
|
|
9
9
|
CURL_UA="Mozilla/5.0"
|
|
10
|
+
ZUGPFERD_REPO="https://github.com/alexzeitler/zugpferd"
|
|
10
11
|
|
|
11
12
|
# --- Saxon HE (for Schematron validation) ---
|
|
12
13
|
|
|
@@ -45,9 +46,8 @@ if [ ! -d "$UBL_DIR/xsd/maindoc" ]; then
|
|
|
45
46
|
echo " Downloading UBL-2.1.zip..."
|
|
46
47
|
curl -fsSL -A "$CURL_UA" "http://docs.oasis-open.org/ubl/os-UBL-2.1/UBL-2.1.zip" \
|
|
47
48
|
-o "$TMP_DIR/UBL-2.1.zip"
|
|
48
|
-
mkdir -p "$UBL_DIR
|
|
49
|
-
unzip -qo "$TMP_DIR/UBL-2.1.zip" "
|
|
50
|
-
cp -r "$TMP_DIR/os-UBL-2.1/xsd/"* "$UBL_DIR/xsd/"
|
|
49
|
+
mkdir -p "$UBL_DIR"
|
|
50
|
+
unzip -qo "$TMP_DIR/UBL-2.1.zip" "xsd/*" -d "$UBL_DIR"
|
|
51
51
|
else
|
|
52
52
|
echo " UBL XSD already present"
|
|
53
53
|
fi
|
|
@@ -61,23 +61,31 @@ CII_DIR="$SCHEMAS_DIR/cii"
|
|
|
61
61
|
|
|
62
62
|
if [ ! -f "$CII_DIR/CrossIndustryInvoice_100pD16B.xsd" ]; then
|
|
63
63
|
echo " Downloading D16B SCRDM (Subset) CII..."
|
|
64
|
-
CII_URL="
|
|
65
|
-
curl -fsSL -A "$CURL_UA" "$CII_URL" -o "$TMP_DIR/cii-outer.zip"
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
if [ -
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
64
|
+
CII_URL="$ZUGPFERD_REPO/releases/download/v0.3.3/D16B_SCRDM__Subset__CII.zip"
|
|
65
|
+
curl -fsSL -A "$CURL_UA" "$CII_URL" -o "$TMP_DIR/cii-outer.zip"
|
|
66
|
+
|
|
67
|
+
mkdir -p "$CII_DIR"
|
|
68
|
+
unzip -qo "$TMP_DIR/cii-outer.zip" -d "$TMP_DIR/cii-outer"
|
|
69
|
+
# The outer ZIP contains nested ZIPs — extract the uncoupled one
|
|
70
|
+
UNCOUPLED_ZIP=$(find "$TMP_DIR/cii-outer" -name "*uncoupled.zip" -type f | head -1)
|
|
71
|
+
if [ -n "$UNCOUPLED_ZIP" ]; then
|
|
72
|
+
unzip -qo "$UNCOUPLED_ZIP" -d "$TMP_DIR/cii-uncoupled"
|
|
73
|
+
# XSDs are nested deep — move them flat into CII_DIR
|
|
74
|
+
XSD_DIR=$(find "$TMP_DIR/cii-uncoupled" -name "CrossIndustryInvoice_100pD16B.xsd" -type f -exec dirname {} \; | head -1)
|
|
75
|
+
if [ -n "$XSD_DIR" ]; then
|
|
76
|
+
cp -r "$XSD_DIR"/* "$CII_DIR/"
|
|
77
|
+
# Copy codelist XSDs (relative imports from main XSD)
|
|
78
|
+
CODELIST_DIR=$(find "$TMP_DIR/cii-uncoupled" -type d -name "codelist" | head -1)
|
|
79
|
+
if [ -n "$CODELIST_DIR" ]; then
|
|
80
|
+
cp -r "$CODELIST_DIR" "$CII_DIR/"
|
|
81
|
+
fi
|
|
78
82
|
else
|
|
79
|
-
echo "
|
|
83
|
+
echo " ERROR: Could not find CrossIndustryInvoice_100pD16B.xsd in extracted archive"
|
|
84
|
+
exit 1
|
|
80
85
|
fi
|
|
86
|
+
else
|
|
87
|
+
echo " ERROR: Could not find uncoupled ZIP inside CII archive"
|
|
88
|
+
exit 1
|
|
81
89
|
fi
|
|
82
90
|
else
|
|
83
91
|
echo " CII XSD already present"
|
|
@@ -122,7 +130,7 @@ XR_DIR="$SCHEMAS_DIR/schematron/xrechnung"
|
|
|
122
130
|
|
|
123
131
|
if [ ! -f "$XR_DIR/schematron/ubl/XRechnung-UBL-validation.xsl" ]; then
|
|
124
132
|
echo " Downloading xrechnung-$XRECHNUNG_SPEC_VERSION-schematron-$XRECHNUNG_SCHEMATRON_VERSION.zip..."
|
|
125
|
-
curl -fsSL -A "$CURL_UA" "https://github.com/itplr-kosit/xrechnung-schematron/releases/download/
|
|
133
|
+
curl -fsSL -A "$CURL_UA" "https://github.com/itplr-kosit/xrechnung-schematron/releases/download/v$XRECHNUNG_SCHEMATRON_VERSION/xrechnung-$XRECHNUNG_SPEC_VERSION-schematron-$XRECHNUNG_SCHEMATRON_VERSION.zip" \
|
|
126
134
|
-o "$TMP_DIR/xrechnung-schematron.zip"
|
|
127
135
|
mkdir -p "$XR_DIR"
|
|
128
136
|
unzip -qo "$TMP_DIR/xrechnung-schematron.zip" -d "$XR_DIR"
|