zugpferd 0.3.2 → 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 +37 -27
- 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,11 +1,14 @@
|
|
|
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
|
+
CURL_UA="Mozilla/5.0"
|
|
10
|
+
ZUGPFERD_REPO="https://github.com/alexzeitler/zugpferd"
|
|
11
|
+
|
|
9
12
|
# --- Saxon HE (for Schematron validation) ---
|
|
10
13
|
|
|
11
14
|
echo "==> Downloading Saxon HE..."
|
|
@@ -18,7 +21,7 @@ MAVEN="https://repo1.maven.org/maven2"
|
|
|
18
21
|
|
|
19
22
|
if [ ! -f "$SAXON_DIR/saxon-he-$SAXON_VERSION.jar" ]; then
|
|
20
23
|
echo " Downloading saxon-he-$SAXON_VERSION.jar..."
|
|
21
|
-
curl -fsSL "$MAVEN/net/sf/saxon/Saxon-HE/$SAXON_VERSION/Saxon-HE-$SAXON_VERSION.jar" \
|
|
24
|
+
curl -fsSL -A "$CURL_UA" "$MAVEN/net/sf/saxon/Saxon-HE/$SAXON_VERSION/Saxon-HE-$SAXON_VERSION.jar" \
|
|
22
25
|
-o "$SAXON_DIR/saxon-he-$SAXON_VERSION.jar"
|
|
23
26
|
else
|
|
24
27
|
echo " saxon-he-$SAXON_VERSION.jar already present"
|
|
@@ -26,7 +29,7 @@ fi
|
|
|
26
29
|
|
|
27
30
|
if [ ! -f "$SAXON_DIR/xmlresolver-$XMLRESOLVER_VERSION.jar" ]; then
|
|
28
31
|
echo " Downloading xmlresolver-$XMLRESOLVER_VERSION.jar..."
|
|
29
|
-
curl -fsSL "$MAVEN/org/xmlresolver/xmlresolver/$XMLRESOLVER_VERSION/xmlresolver-$XMLRESOLVER_VERSION.jar" \
|
|
32
|
+
curl -fsSL -A "$CURL_UA" "$MAVEN/org/xmlresolver/xmlresolver/$XMLRESOLVER_VERSION/xmlresolver-$XMLRESOLVER_VERSION.jar" \
|
|
30
33
|
-o "$SAXON_DIR/xmlresolver-$XMLRESOLVER_VERSION.jar"
|
|
31
34
|
else
|
|
32
35
|
echo " xmlresolver-$XMLRESOLVER_VERSION.jar already present"
|
|
@@ -41,11 +44,10 @@ UBL_DIR="$SCHEMAS_DIR/ubl"
|
|
|
41
44
|
|
|
42
45
|
if [ ! -d "$UBL_DIR/xsd/maindoc" ]; then
|
|
43
46
|
echo " Downloading UBL-2.1.zip..."
|
|
44
|
-
curl -fsSL "http://docs.oasis-open.org/ubl/os-UBL-2.1/UBL-2.1.zip" \
|
|
47
|
+
curl -fsSL -A "$CURL_UA" "http://docs.oasis-open.org/ubl/os-UBL-2.1/UBL-2.1.zip" \
|
|
45
48
|
-o "$TMP_DIR/UBL-2.1.zip"
|
|
46
|
-
mkdir -p "$UBL_DIR
|
|
47
|
-
unzip -qo "$TMP_DIR/UBL-2.1.zip" "
|
|
48
|
-
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"
|
|
49
51
|
else
|
|
50
52
|
echo " UBL XSD already present"
|
|
51
53
|
fi
|
|
@@ -59,23 +61,31 @@ CII_DIR="$SCHEMAS_DIR/cii"
|
|
|
59
61
|
|
|
60
62
|
if [ ! -f "$CII_DIR/CrossIndustryInvoice_100pD16B.xsd" ]; then
|
|
61
63
|
echo " Downloading D16B SCRDM (Subset) CII..."
|
|
62
|
-
CII_URL="
|
|
63
|
-
curl -fsSL "$CII_URL" -o "$TMP_DIR/cii-outer.zip"
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
if [ -
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
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
|
|
76
82
|
else
|
|
77
|
-
echo "
|
|
83
|
+
echo " ERROR: Could not find CrossIndustryInvoice_100pD16B.xsd in extracted archive"
|
|
84
|
+
exit 1
|
|
78
85
|
fi
|
|
86
|
+
else
|
|
87
|
+
echo " ERROR: Could not find uncoupled ZIP inside CII archive"
|
|
88
|
+
exit 1
|
|
79
89
|
fi
|
|
80
90
|
else
|
|
81
91
|
echo " CII XSD already present"
|
|
@@ -92,7 +102,7 @@ CEN_BASE="https://github.com/ConnectingEurope/eInvoicing-EN16931/releases/downlo
|
|
|
92
102
|
CEN_UBL_DIR="$SCHEMAS_DIR/schematron/cen/ubl"
|
|
93
103
|
if [ ! -f "$CEN_UBL_DIR/xslt/EN16931-UBL-validation.xslt" ]; then
|
|
94
104
|
echo " Downloading en16931-ubl-$CEN_VERSION.zip..."
|
|
95
|
-
curl -fsSL "$CEN_BASE/en16931-ubl-$CEN_VERSION.zip" -o "$TMP_DIR/cen-ubl.zip"
|
|
105
|
+
curl -fsSL -A "$CURL_UA" "$CEN_BASE/en16931-ubl-$CEN_VERSION.zip" -o "$TMP_DIR/cen-ubl.zip"
|
|
96
106
|
mkdir -p "$CEN_UBL_DIR"
|
|
97
107
|
unzip -qo "$TMP_DIR/cen-ubl.zip" -d "$CEN_UBL_DIR"
|
|
98
108
|
else
|
|
@@ -102,7 +112,7 @@ fi
|
|
|
102
112
|
CEN_CII_DIR="$SCHEMAS_DIR/schematron/cen/cii"
|
|
103
113
|
if [ ! -f "$CEN_CII_DIR/xslt/EN16931-CII-validation.xslt" ]; then
|
|
104
114
|
echo " Downloading en16931-cii-$CEN_VERSION.zip..."
|
|
105
|
-
curl -fsSL "$CEN_BASE/en16931-cii-$CEN_VERSION.zip" -o "$TMP_DIR/cen-cii.zip"
|
|
115
|
+
curl -fsSL -A "$CURL_UA" "$CEN_BASE/en16931-cii-$CEN_VERSION.zip" -o "$TMP_DIR/cen-cii.zip"
|
|
106
116
|
mkdir -p "$CEN_CII_DIR"
|
|
107
117
|
unzip -qo "$TMP_DIR/cen-cii.zip" -d "$CEN_CII_DIR"
|
|
108
118
|
else
|
|
@@ -120,7 +130,7 @@ XR_DIR="$SCHEMAS_DIR/schematron/xrechnung"
|
|
|
120
130
|
|
|
121
131
|
if [ ! -f "$XR_DIR/schematron/ubl/XRechnung-UBL-validation.xsl" ]; then
|
|
122
132
|
echo " Downloading xrechnung-$XRECHNUNG_SPEC_VERSION-schematron-$XRECHNUNG_SCHEMATRON_VERSION.zip..."
|
|
123
|
-
curl -fsSL "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" \
|
|
124
134
|
-o "$TMP_DIR/xrechnung-schematron.zip"
|
|
125
135
|
mkdir -p "$XR_DIR"
|
|
126
136
|
unzip -qo "$TMP_DIR/xrechnung-schematron.zip" -d "$XR_DIR"
|
|
@@ -154,14 +164,14 @@ GS_RAW="https://raw.githubusercontent.com/ArtifexSoftware/ghostpdl/$GS_REF"
|
|
|
154
164
|
|
|
155
165
|
if [ ! -f "$ZUGFERD_DIR/zugferd.ps" ]; then
|
|
156
166
|
echo " Downloading zugferd.ps..."
|
|
157
|
-
curl -fsSL "$GS_RAW/lib/zugferd.ps" -o "$ZUGFERD_DIR/zugferd.ps"
|
|
167
|
+
curl -fsSL -A "$CURL_UA" "$GS_RAW/lib/zugferd.ps" -o "$ZUGFERD_DIR/zugferd.ps"
|
|
158
168
|
else
|
|
159
169
|
echo " zugferd.ps already present"
|
|
160
170
|
fi
|
|
161
171
|
|
|
162
172
|
if [ ! -f "$ZUGFERD_DIR/default_rgb.icc" ]; then
|
|
163
173
|
echo " Downloading default_rgb.icc..."
|
|
164
|
-
curl -fsSL "$GS_RAW/iccprofiles/default_rgb.icc" -o "$ZUGFERD_DIR/default_rgb.icc"
|
|
174
|
+
curl -fsSL -A "$CURL_UA" "$GS_RAW/iccprofiles/default_rgb.icc" -o "$ZUGFERD_DIR/default_rgb.icc"
|
|
165
175
|
else
|
|
166
176
|
echo " default_rgb.icc already present"
|
|
167
177
|
fi
|