File tree Expand file tree Collapse file tree 3 files changed +86
-0
lines changed Expand file tree Collapse file tree 3 files changed +86
-0
lines changed Original file line number Diff line number Diff line change
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
+
Original file line number Diff line number Diff line change
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
+
You can’t perform that action at this time.
0 commit comments