Skip to content

Commit b5307ea

Browse files
committed
Adding/updating bash scripts to generate all code
1 parent 2e0d8b7 commit b5307ea

File tree

3 files changed

+86
-0
lines changed

3 files changed

+86
-0
lines changed

script/generatecontrollersfromtemplate.sh

100644100755
File mode changed.

script/generateobjectsfromxsd.sh

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
#!/bin/bash
2+
3+
# Script to generate the python contract from XSD
4+
# Requires pyxb module to be installed and available in path
5+
6+
dt=`date '+%m/%d/%Y %H:%M:%S'`
7+
echo Starting pyxbgen on ${dt}
8+
which python > > /dev/null
9+
if [ $? -eq 0 ]
10+
then
11+
echo Found python
12+
else
13+
echo Unable to find python. Make sure python is installed.
14+
exit 1
15+
fi
16+
17+
which pyxbgen > /tmp/pyxbgenpath.txt
18+
if [ $? -eq 0 ]
19+
then
20+
echo Found pyxbgen
21+
else
22+
echo Unable to find pyxbgen. Make sure pyxb package is installed.
23+
exit 1
24+
fi
25+
26+
XSDPATH=https://apitest.authorize.net/xml/v1/schema/AnetApiSchema.xsd
27+
#XSDPATH=https://api.authorize.net/xml/v1/schema/AnetApiSchema.xsd
28+
CONTRACTSDIR=authorizenet
29+
CONTRACTSFILE=apicontractsv1
30+
PYXBGENPATH=`which pyxbgen`
31+
TEMPFILE=binding
32+
33+
echo Using pyxb from "${PYXBGENPATH}"
34+
if [ -e "${TEMPFILE}.py" ]; then
35+
rm ${TEMPFILE}.py
36+
fi
37+
38+
python "${PYXBGENPATH}" -u ${XSDPATH} -m ${TEMPFILE}
39+
if [ $? -eq 0 ]
40+
then
41+
if [ -e "${CONTRACTSDIR}/${CONTRACTSFILE}.old" ]
42+
then
43+
rm "${CONTRACTSDIR}/${CONTRACTSFILE}.old"
44+
fi
45+
if [ -e "${CONTRACTSDIR}/${CONTRACTSFILE}.py" ]
46+
then
47+
rm "${CONTRACTSDIR}/${CONTRACTSFILE}.py"
48+
fi
49+
mv "${TEMPFILE}.py" "${CONTRACTSDIR}/${CONTRACTSFILE}.py"
50+
echo Bindings have been successfully generated from XSD in the file "${CONTRACTSDIR}/${CONTRACTSFILE}.py"
51+
echo Old contracts have been moved to .old
52+
else
53+
echo Error generating bindings from XSD. Review the errors and rerun the script.
54+
exit 1
55+
fi
56+
57+
exit 0
58+

script/masterupdate.sh

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/bin/bash
2+
3+
echo Started at `date`
4+
echo This script will update the generated code
5+
echo
6+
7+
currdir=`pwd`
8+
cmdlist="generateobjectsfromxsd.sh generatecontrollersfromtemplate.sh"
9+
for cmd in $cmdlist ; do
10+
echo Executing Script "$cmd"
11+
if [ ! -f $currdir/script/$cmd ];then
12+
echo "Script $currdir/script/$cmd not found"
13+
exit 1
14+
fi
15+
$currdir/script/$cmd
16+
ERRORCODE=$?
17+
if [ $ERRORCODE -ne 0 ];then
18+
echo "########################################################################"
19+
echo "Encountered error during execution of $cmd"
20+
echo "See logs or output above."
21+
echo "Exiting, Update ***NOT*** complete."
22+
exit $ERRORCODE
23+
fi
24+
done
25+
echo Exiting, Update completed successfully.
26+
echo Compile, run tests and commit to git-hub.
27+
echo Completed at `date`
28+

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy