-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpack
executable file
·114 lines (95 loc) · 2.25 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
#!/bin/bash
version=$(php artisan app:version)
gitbranch=$(git branch | grep \*)
filename="biblesupersearch_api_$version.zip"
filepath="../releases/api/$filename";
# 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"
fi