-
-
Notifications
You must be signed in to change notification settings - Fork 47
/
Copy pathbuild-authors.sh
executable file
·87 lines (72 loc) · 2.47 KB
/
build-authors.sh
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
#!/usr/bin/env bash
##
# build-authors.sh
#
# Copyright (c) 2001-2002 Daniel Horn
# Copyright (c) 2002-2019 pyramid3d and other Vega Strike Contributors
# Copyright (c) 2019-2021 Stephen G. Tuggy, and other Vega Strike Contributors
#
# https://github.com/vegastrike/Vega-Strike-Engine-Source
#
# This file is part of Vega Strike.
#
# Vega Strike is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# Vega Strike is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Vega Strike. If not, see <https://www.gnu.org/licenses/>.
#
set -e
AUTHORS_FILE="$(pwd)/Authors"
AUTHORS_UNIQUE_FILE="${AUTHORS_FILE}.uniq"
AUTHORS_TEMP_FILE="${AUTHORS_TRACED_FILE}.temp"
AUTHORS_FINAL="$(pwd)/AUTHORS"
ATT_DEBUG="${AUTHORS_FINAL}.debug"
# clean out the old traced file
echo > ${ATT_DEBUG}
# Extract the author line from all the git commits
git log | grep Author > ${AUTHORS_FILE}
if [ -n "${GIT_REPOSITORY}" ]; then
echo "Returning to local directory"
popd
else
echo "Already in local directory"
fi
# shrink the list to just the unique contributors
cat ${AUTHORS_FILE} | sort | uniq > ${AUTHORS_UNIQUE_FILE}
# Drop the git data so it's just the author data
cat ${AUTHORS_UNIQUE_FILE} | cut -f 2 -d ':' > ${AUTHORS_TEMP_FILE}
# Generate the AUTHORS file:
echo "The below is the list of all the known authors.
It has been auto-generated from the GitHub commit logs
using ./sh/build-authors.sh.
" > ${AUTHORS_FINAL}
# Generate a nice file to work with
IFS="
"
for AUTHOR in `cat ${AUTHORS_TEMP_FILE}`
do
# Extract Username and Email
NAME=`echo ${AUTHOR} | cut -f 1 -d '<' | tr -d ' '`
EMAIL=`echo ${AUTHOR} | cut -f 2 -d '<' | cut -f 1 -d '>'`
# Record to AUTHORS
echo "* ${NAME} <${EMAIL}>" >> ${AUTHORS_FINAL}
# Record to the debug tracer
echo "Author: ${AUTHOR}" >> ${ATT_DEBUG}
echo "Name: ${NAME}" >> ${ATT_DEBUG}
echo "Email: ${EMAIL}" >> ${ATT_DEBUG}
echo "-------------------------------------------------------------" >> ${ATT_DEBUG}
# Record to the traced file
done
# Clean up the temp file
rm ${AUTHORS_TEMP_FILE}
rm ${AUTHORS_FILE}
rm ${AUTHORS_UNIQUE_FILE}
rm ${ATT_DEBUG}