-
Notifications
You must be signed in to change notification settings - Fork 59
/
make-docs.sh
executable file
·101 lines (84 loc) · 3.05 KB
/
make-docs.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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#!/bin/sh
# HyperVM, Server Virtualization GUI for OpenVZ and Xen
#
# Copyright (C) 2000-2009 LxLabs
# Copyright (C) 2009-2011 LxCenter
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program 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 Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# author: Ángel Guzmán Maeso <[email protected]>
#
# Create the php docs for all .php files involved on HyperVM
#
# Note: PhpDocumentor is obsoleted, unmaintained and deprecated. Using the
# new DocBlox for generate the php-doc.
# Requires:
# - PHP >= 5.2.6
# - iconv/ext (enabled by default since PHP 5.0.0)
# - XSL extension
# - Graphviz (optional, used for generating Class diagrams)
# - PEAR (optional, used for generating Class Diagrams or installing via PEAR)
DOCBLOX_BINARY='docblox/bin/docblox.php'
# The HyperVM source path to generate the php-doc
HYPERVM_SOURCE_PATH='.'
# The HyperVM documentation path to output the php-doc
HYPERVM_DOC_PATH='./doc'
DOCBLOX_CONFIGURATION_FILE='docblox.dist.xml'
usage(){
echo "'Usage: $0 [-h]"
echo 'h: shows this help.'
exit 1
}
install_GIT()
{
# Redhat based
if [ -f /etc/redhat-release ] ; then
# Install git with curl and expat support to enable support on github cloning
yum install -y gcc gettext-devel expat-devel curl-devel zlib-devel openssl-devel
# Debian based
elif [ -f /etc/debian_version ] ; then
# Needed XSLTProcessor
apt-get install gcc php5 php5-xsl
fi
# @todo Try to get the lastest version from some site. LASTEST file?
GIT_VERSION='1.7.9.1'
echo "Downloading and compiling GIT ${GIT_VERSION}"
wget http://git-core.googlecode.com/files/git-${GIT_VERSION}.tar.gz
tar xvfz git-*.tar.gz; cd git-*;
./configure --prefix=/usr --with-curl --with-expat
make all
make install
echo 'Cleaning GIT files.'
cd ..; rm -rf git-*
}
if [ `/usr/bin/id -u` -ne 0 ]; then
echo 'Please, run this script as root.'
usage
fi
if [ ! -d "docblox" ]; then
echo 'Installing docblox.'
if which git >/dev/null; then
echo 'GIT support detected.'
else
echo 'No GIT support detected. Installing GIT.'
install_GIT
fi
# Clone from GitHub the last version using git transport (no http or https)
git clone git://github.com/docblox/docblox.git docblox
# Install the new_black theme as default
php $DOCBLOX_BINARY template:install new_black -v 1.0.1
fi
# Generate the php-doc
echo 'Generating the doc files. It could take around 180 sec or more. Be patient'
php $DOCBLOX_BINARY run -c $DOCBLOX_CONFIGURATION_FILE -d $HYPERVM_SOURCE_PATH -t $HYPERVM_DOC_PATH