-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathcreateSite
More file actions
60 lines (56 loc) 路 1.54 KB
/
Copy pathcreateSite
File metadata and controls
60 lines (56 loc) 路 1.54 KB
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
#
# createSite
# ws: global variable pointing to workspace
# param 1: l_project - project name/directory
# param 2: l_ghpages - directory where gh-pages branch has been git cloned/pulled
# param 3: l_modules - non-empty for a multi-module project (e.g. containing the list of modules)
#
createSite() {
local l_project="$1"
local l_ghpages="$2"
local l_modules="$3"
color_msg $green "creating site for $l_project $l_modules"
cd $ws/$l_project
stage=/tmp/stage$$
sitelog=/tmp/sitelog$$.txt
rm -rf $stage
# the stagingDirectory needs to be subdirectory
mkdir -p $stage/$l_project
# run the staging of the site against this directory and log the results
mvn -U clean install site site:stage -DstagingDirectory=$stage/$l_project | tee $sitelog
# rsync the result into the github-pages folder
rsync -avz --del $stage/* $l_ghpages/$l_project/
# is this a multi module project?
if [ "$l_modules" != "" ]
then
cd $l_ghpages/$l_project/
if [ ! -f index.html ]
then
cat << EOF > index.html
<!DOCTYPE html>
<html>
<head>
<!-- HTML meta refresh URL redirection -->
<meta http-equiv="refresh"
content="0; url=./$l_project/$l_project/index.html">
</head>
<body>
<p>This is a multimodule mvn site click below to get to the index.html of
<a href="./$l_project/$l_project/index.html">$l_project</a></p>
</body>
</html>
EOF
fi
# add potentially new files
git add *
# commit results
git commit -m "checked in by checksite script"
# push results
git push
fi
if [ "$debug" = "false" ]
then
rm -rf $stage
rm $sitelog
fi
}