FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
sdk-python/script/generatecontrollersfromtemplate.sh at master · AuthorizeNet/sdk-python · GitHub
AuthorizeNet
/
sdk-python
Public
Notifications
You must be signed in to change notification settings
Fork
96
Star
59
Code
Issues
19
Pull requests
6
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Security and quality
Insights
Expand file tree
Breadcrumbs
sdk-python
/
script
/
generatecontrollersfromtemplate.sh
Copy path
More file actions
More file actions
Latest commit
History
History
History
executable file
·
63 lines (45 loc) · 1.93 KB
Breadcrumbs
sdk-python
/
script
/
generatecontrollersfromtemplate.sh
Copy path
File metadata and controls
executable file
·
63 lines (45 loc) · 1.93 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!
/bin/bash
#
Script to generate controllers from the generated bindings file, and uses template
currdir=
`
pwd
`
dt=
`
date
'
+%m/%d/%Y %H:%M:%S
'
`
echo
Starting
${dt}
CDIR=
`
pwd
`
SRCDIR=
${CDIR}
GENFOLDER=authorizenet/apicontractsv1.py
CONTROLLERFOLDER=controllerstemporary
SRCLOG=
${CDIR}
/log/TestSources
CNTLOG=
${CDIR}
/log/TestControllers
if
[
!
-e
"
${CDIR}
/log
"
]
;
then
echo
"
Creating
${CDIR}
/log
"
mkdir
${CDIR}
/log
else
echo
"
Deleting existing
${CDIR}
/log/*
"
rm -rf
${CDIR}
/log/
*
.
*
>
/dev/null
fi
echo
Identifying Requests
\/
Responses to process from
"
${SRCDIR}
/
${GENFOLDER}
"
grep -i -e
"
request *=
"
-e
"
response *=
"
${SRCDIR}
/
${GENFOLDER}
|
grep -v _AVS
|
cut -d= -f1
|
egrep -v
"
^ |\.
"
|
sort -u
>
${SRCLOG}
0.log
echo
Getting Unique Request
\/
Responses
grep -i -e
"
request *$
"
-e
"
response *$
"
${SRCLOG}
0.log
>
${SRCLOG}
1.log
echo
Identifying Object names
perl -pi -w -e
'
s/Request *$|Response *$//g;
'
${SRCLOG}
1.log
sort -u
${SRCLOG}
1.log
>
${SRCLOG}
2.log
#
Create backup for later comparison
cp
${SRCLOG}
2.log
${SRCLOG}
3.log
echo
Creating Final List of Request
\/
Response to generate code
sort -u
${SRCLOG}
2.log
>
${SRCLOG}
.log
#
make sure the temporary folder exists
if
[
!
-e
"
${CONTROLLERFOLDER}
"
]
;
then
mkdir
${CONTROLLERFOLDER}
fi
rm -rf
${CONTROLLERFOLDER}
/
*
Controller.py
echo
Creating Controllers
for
cntrls
in
`
cat
${SRCLOG}
.log
`
do
echo
Generating Code
for
${cntrls}
Controller.py
cp
${SRCDIR}
/script/ControllerTemplate.pyt
${SRCDIR}
/
${CONTROLLERFOLDER}
/
${cntrls}
Controller.py
perl -pi -w -e
"
s/APICONTROLLERNAME/
$cntrls
/g;
"
${SRCDIR}
/
${CONTROLLERFOLDER}
/
${cntrls}
Controller.py
done
cat
${SRCDIR}
/script/headertemplate.pyt
${SRCDIR}
/
${CONTROLLERFOLDER}
/
*
.py
>
${SRCDIR}
/authorizenet/apicontrollers.new
sed -i
'
s/getTransactionListForCustomerResponse/getTransactionListResponse/g
'
${SRCDIR}
/authorizenet/apicontrollers.new
echo
Controllers generated
in
module:
${SRCDIR}
/authorizenet/apicontrollers.py
echo
Finished
${dt}
Back
|
FazBrowse Home
|
New Git URL