-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpack
executable file
·146 lines (118 loc) · 3.37 KB
/
pack
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
#!/bin/bash
version=$(php artisan app:version)
gitbranch=$(git branch | grep \*)
filename="biblesupersearch_api_$version.zip"
filepath="../releases/api/$filename"
filename_nobi="biblesupersearch_api_${version}_nobibles.zip"
filepath_nobi="../releases/api/$filename_nobi"
filename_lite="biblesupersearch_api_${version}_lite.zip"
filepath_lite="../releases/api/$filename_lite"
# files to be deleted / excluded from the release
delfiles=(
pack
install
uninstall
update
.env.example-cli
readme.md
tests/Feature/test_spreadsheets/kjv_full.csv
tests/Feature/test_spreadsheets/kjv_full.xlsx
tests/Feature/test_spreadsheets/kjv_full.ods
)
echo ''
echo 'This script will pack the Bible SuperSearch API code for release'
# Check git status
gitstatus=$(git status --porcelain)
if [[ $gitstatus != '' ]]
then
echo ''
echo 'Please commit your changes before packing'
echo 'Only committed changes will be packed'
exit # comment out ONLY for debugging of this script.
fi
echo ''
echo Application Version:
echo "* $version"
echo ''
echo ''
read -p "Is this correct? (Y/n) " -n 1 -r
if [[ !($REPLY =~ ^[Yy]$) ]]
then
echo ''
exit
fi
echo ''
echo ''
echo Current git branch:
echo "$gitbranch"
echo ''
read -p "Is this correct? (Y/n) " -n 1 -r
if [[ !($REPLY =~ ^[Yy]$) ]]
then
echo ''
exit
fi
echo ''
echo ''
echo 'Running tests (phpunit)'
echo ''
php artisan test --parallel # comment out ONLY for debugging of this script.
code=$?
if [[ !($code = 0) ]]
then
echo ''
echo 'The tests found some errors'
echo 'Please fix errors before continuing';
exit
fi
echo ''
echo ''
echo Output Filename:
echo "* $filename"
echo ''
echo ''
read -p "Create the release? (Y/n) " -n 1 -r
echo # (optional) move to a new line
if [[ $REPLY =~ ^[Yy]$ ]]
then
# do dangerous stuff
echo
echo 'Clearing out Laravel cacheing'
php artisan config:cache
php artisan optimize:clear
echo ''
echo 'Creating ZIP file'
git archive -o $filepath HEAD
echo 'Copying Composer dependencies to ZIP file'
zip -r -q $filepath vendor/
echo ''
echo 'Deleting unwanted files / dirs:'
# delete unwanted files from ZIP file
for i in ${delfiles[@]}; do
echo " Deleting file: ${i}"
zip -d -q $filepath ${i}
done
# delete unwanted dirs from ZIP file
zip --delete -q $filepath 'public/js/bin/enyo/2.5.1.1/tools/minifier/*'
echo ''
echo "Success! File created at $filepath"
# Create 'no Bibles' version
cp $filepath $filepath_nobi
zip --delete -q $filepath_nobi 'bibles/modules/*.zip'
#zip -r -q $filepath_nobi bibles/modules/readme.txt
echo ''
echo "Success! File created at $filepath_nobi"
# Create 'lite' version
cp $filepath_nobi $filepath_lite
# Selected public domain Bibles
zip -r -q $filepath_lite 'bibles/modules/kjv.zip' #English KJV
zip -r -q $filepath_lite 'bibles/modules/chinese_union_trad.zip'
# Hindi - no public domain Bibles
zip -r -q $filepath_lite 'bibles/modules/sagradas.zip' #Spanish
zip -r -q $filepath_lite 'bibles/modules/martin.zip' # French
zip -r -q $filepath_lite 'bibles/modules/svd.zip' #Arabic Smith Van Dyke
zip -r -q $filepath_lite 'bibles/modules/tr.zip' #Greek TR
zip -r -q $filepath_lite 'bibles/modules/he_modern.zip' #Hebrew
echo ''
echo "Success! File created at $filepath_lite"
fi