Skip to content

Commit 35555e4

Browse files
committed
Include appender script in masterUpdate
1 parent 0bb7262 commit 35555e4

7 files changed

Lines changed: 59 additions & 88 deletions

File tree

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010

1111
while (<>) {
1212
chomp;
13-
my $filepath = "../lib/net/authorize/api/contract/v1/";
13+
my $filepath = "lib/net/authorize/api/contract/v1/";
1414
my $filename = "$filepath"."$_";
1515
my $text = `cat $filename`;
16-
my $sub = `cat appendJsonSeralizeCode.txt`;
16+
my $sub = `cat scripts/appendJsonSeralizeCode.txt`;
1717

1818
$text =~ s|(.+)}|$1$sub|xms;
1919

scripts/appendSetCode.pl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010

1111
while (<>) {
1212
chomp;
13-
my $filepath = "../lib/net/authorize/api/contract/v1/";
13+
my $filepath = "lib/net/authorize/api/contract/v1/";
1414
my $filename = "$filepath"."$_";
1515
my $text = `cat $filename`;
16-
my $sub = `cat appendSetCode.txt`;
16+
my $sub = `cat scripts/appendSetCode.txt`;
1717

1818
$text =~ s|(.+)}|$1$sub|xms;
1919

scripts/appender.sh

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#!/bin/bash
2+
3+
echo "Start appending : `date`"
4+
5+
# List filenames with request, response and type and remove the file path upto v1 i.e. 38 characters
6+
find lib/net/authorize/api/contract/v1 -print | grep -i -e "request\.php" | cut -c 35- > scripts/requestList.txt
7+
find lib/net/authorize/api/contract/v1 -print | grep -i -e "response\.php" | cut -c 35- > scripts/responseList.txt
8+
find lib/net/authorize/api/contract/v1 -print | grep -i -e "type\.php" | cut -c 35- > scripts/typeList.txt
9+
find lib/net/authorize/api/contract/v1 -print | grep -i -e "type\.php" > scripts/typeList2.txt
10+
11+
#mkdir -p ../lib/net/authorize/api/contract/v1/backup
12+
13+
#appendJsonSeralizeCode=`cat appendJsonSeralizeCode.txt`
14+
#appendSetCode=`cat appendSetCode.txt`
15+
16+
echo "Taking backup of Types"
17+
perl scripts/backup.pl scripts/typeList.txt
18+
echo "Appending JsonSerialize code to Types"
19+
perl scripts/appendJsonSeralizeCode.pl scripts/typeList.txt
20+
echo "Appending Set code to Types"
21+
perl scripts/appendSetCode.pl scripts/typeList.txt
22+
23+
24+
echo "Taking backup of Requests"
25+
perl scripts/backup.pl scripts/requestList.txt
26+
echo "Appending JsonSerialize code to Requests"
27+
perl scripts/appendJsonSeralizeCode.pl scripts/requestList.txt
28+
#echo "Appending Set code to Requests"
29+
#perl appendSetCode.pl requestList.txt
30+
31+
echo "Taking backup of Responses"
32+
perl scripts/backup.pl scripts/responseList.txt
33+
#echo "Appending JsonSerialize code to Responses"
34+
#perl appendJsonSeralizeCode.pl responseList.txt
35+
echo "Appending Set code to Responses"
36+
perl scripts/appendSetCode.pl scripts/responseList.txt
37+
38+
echo "Appending implements JsonSerializable to Types"
39+
list="scripts/typeList2.txt"
40+
while read -r filename
41+
do
42+
filename=$(echo "$filename" | sed -e "s/^\.\///g")
43+
# echo "Appending implements JsonSerializable to - $filename"
44+
sed -i.bak '/^class/ s/$/ implements \\JsonSerializable/' "$filename"
45+
46+
done < "$list"
47+
48+
php lib/net/authorize/util/MapperGen.php
49+
50+
git clean -fdq lib/net/authorize/api/contract/v1 -e .bak
51+
52+
echo "Completed!"
53+

scripts/backup.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#mkdir 'backup';
1212
while (<>) {
1313
chomp;
14-
my $filepath = "../lib/net/authorize/api/contract/";
14+
my $filepath = "lib/net/authorize/api/contract/";
1515
my $filename = $filepath."v1/".$_;
1616
my $text = `cat $filename`;
1717
# print $filename;

scripts/masterAppender.sh

Lines changed: 0 additions & 82 deletions
This file was deleted.

scripts/masterUpdate.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ echo This script will update the generated code
55
echo
66

77
currdir=`pwd`
8-
cmdlist="generateObjectsFromXsd.sh generateControllersFromTemplate.sh"
8+
cmdlist="generateObjectsFromXsd.sh generateControllersFromTemplate.sh appender.sh"
99
for cmd in $cmdlist ; do
1010
echo Executing Script "$cmd"
1111
if [ ! -f $currdir/scripts/$cmd ];then

0 commit comments

Comments
 (0)