forked from imod/jenkins-statistics
-
-
Notifications
You must be signed in to change notification settings - Fork 43
/
generate-pluginversions-index.sh
executable file
·70 lines (54 loc) · 1.14 KB
/
generate-pluginversions-index.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
#!/bin/bash
set -o nounset
set -o pipefail
set -o errexit
shopt -s failglob
if [[ $# -lt 1 ]] ; then
echo "Usage: $0 <directory>" >&2
exit 1
fi
DIRNAME="$1"
if [ ! -d "$DIRNAME" ]; then
echo "Not a directory: $DIRNAME" >&2
exit 1;
fi
if [ ! -x "$DIRNAME" ]; then
echo "Executable permission missing: $DIRNAME" >&2
exit 1;
fi
if [ ! -r "$DIRNAME" ]; then
echo "Read permission missing: $DIRNAME" >&2
exit 1;
fi
FILENAME="$DIRNAME/index.html"
cat > $FILENAME <<EOF
<html>
<head>
<title>Install Counts by Plugin Version and Jenkins Version</title>
<style type="text/css">
* {
font-family: sans-serif;
}
</style>
</head>
<body>
<h1>Install Counts by Plugin Version and Jenkins Version</h1>
<h2>Plugins</h2>
<ul>
EOF
for f in "$DIRNAME"/*.html ; do
FILE=$(basename $f)
cat >> $FILENAME <<EOF
<li><a href="${FILE}">${FILE/.html/}</a></li>
EOF
done;
cat >> $FILENAME <<EOF
</ul>
<br/>
<center>
This page generated by
<a href="https://github.com/jenkins-infra/infra-statistics/blob/master/$(basename $0)">this script</a>
</center>
</body>
</html>
EOF