|
| 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 | + |
0 commit comments