-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
149 lines (120 loc) · 4.79 KB
/
Makefile
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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
#
# BONZAI
# (was phpGuardian)
#
# CODENAME: caffeine
# VERSION: 0.2
#
# URL: http://www.bonzai-project.org
# E-MAIL: [email protected]
#
# COPYRIGHT: 2006 - 2012 Bonzai (Fabio Cicerchia). All rights reserved.
# LICENSE: MIT or GNU GPL 2
# The MIT License is recommended for most projects, it's simple and
# easy to understand and it places almost no restrictions on what
# you can do with Bonzai.
# If the GPL suits your project better you are also free to use
# Bonzai under that license.
# You don't have to do anything special to choose one license or
# the other and you don't have to notify anyone which license you
# are using. You are free to use Bonzai in commercial projects as
# long as the copyright header is left intact.
# <http://www.opensource.org/licenses/mit-license.php>
# <http://www.opensource.org/licenses/gpl-2.0.php>
#
RM=rm -rf
MKDIR=mkdir -p
CP=cp -r
CHMOD=chmod
ECHO=@echo
LN=ln -s
PECL=-pecl
PEAR=-pear
PHPUNIT=phpunit
PHPCS=phpcs -s -v
PHPMD=phpmd
PHPLOC=phploc
PHPCPD=phpcpd
PDEPEND=pdepend
PHPCB=phpcb
DOCBLOX=docblox
MSGFMT=msgfmt
PEAR_INSTALL_FLAGS=--alldeps
CURRENTDIR=.
REPORTDIR=$(CURRENTDIR)/report
SOURCEDIR=$(CURRENTDIR)/src
LOCALEDIR=$(CURRENTDIR)/locales
PEARDIR=$(CURRENTDIR)/pear
INSTALLDIR=/opt/bonzai
BINDIR=/bin
################################################################################
# GENERAL ACTIONS
################################################################################
all: .info build-environment test sca docs gettext
.info:
$(ECHO) "--------------------------------------------------------------------------------"
$(ECHO) "BONZAI (was phpGuardian)"
$(ECHO) "--------------------------------------------------------------------------------"
install-environment: install-bcompiler install-imagick install-phpunit install-docblox install-pdepend install-phpmd install-phpcs
build-environment:
$(ECHO) "CREATE THE ENVIRONMENT STRUCTURE"
+@[ -d $(REPORTDIR) ] || $(RM) $(REPORTDIR)
$(MKDIR) $(REPORTDIR)
$(MKDIR) $(REPORTDIR)/cli
$(MKDIR) $(REPORTDIR)/cli/code_coverage
$(MKDIR) $(REPORTDIR)/cli/code_browser
$(MKDIR) $(REPORTDIR)/cli/log
test:
$(ECHO) "RUN THE TESTS"
$(PHPUNIT) --log-junit "$(REPORTDIR)/cli/log/phpunit.xml"
sca: run-phpcs run-phpmd run-phploc run phpcpd run-pdepend run-phpcb
docs:
$(ECHO) "BUILD THE DOCUMENTATION"
$(DOCBLOX) run -d "$(SOURCEDIR)" -t "$(REPORTDIR)/cli/docs"
# phpdoc -d "./src/" -t "./report/cli/docs" -ti "Bonzai CLI Documentation" -dn "bonzai"
gettext:
$(ECHO) "BUILD THE TRANSLATIONS"
$(MSGFMT) "$(LOCALEDIR)/it_IT/LC_MESSAGES/messages.po" -o "$(LOCALEDIR)/it_IT/LC_MESSAGES/messages.mo"`
install:
+@[ ! -d $(INSTALLDIR) ] || $(MKDIR) $(INSTALLDIR)
$(CP) $(CURRENTDIR) $(INSTALLDIR)
$(CHMOD) 777 $(INSTALLDIR)/bin/bonzai-cli
$(LN) $(INSTALLDIR)/bin/bonzai-cli $(BINDIR)/bonzai-cli
$(ECHO) "INSTALLED"
uninstall:
$(RM) $(INSTALLDIR)
$(RM) $(BINDIR)/bonzai-cli
$(ECHO) "UNINSTALLED"
################################################################################
# SPECIFIC ACTIONS
################################################################################
install-bcompiler:
$(PECL) install bcompiler
install-imagick:
$(PECL) install imagick
install-phpunit:
$(PEAR) channel-discover pear.phpunit.de
$(PEAR) install $(PEAR_INSTALL_FLAGS) phpunit/PHPUnit phpunit/PHP_CodeBrowser phpunit/PHP_CodeCoverage phpunit/phpcov phpunit/phpcpd phpunit/phploc
install-docblox:
$(PEAR) channel-discover pear.docblox-project.org
$(PEAR) install $(PEAR_INSTALL_FLAGS) docblox/DocBlox
install-pdepend:
$(PEAR) channel-discover pear.pdepend.org
$(PEAR) install $(PEAR_INSTALL_FLAGS) pdepend/PHP_Depend-beta
install-phpmd:
$(PEAR) channel-discover pear.phpmd.org
$(PEAR) install $(PEAR_INSTALL_FLAGS) phpmd/PHP_PMD
install-phpcs:
$(PEAR) install $(PEAR_INSTALL_FLAGS) PHP_CodeSniffer-1.3.2
run-phpcs:
$(PHPCS) --standard="./bonzai_ruleset.xml" --report-file="$(REPORTDIR)/cli/violations.txt" --report-xml="$(REPORTDIR)/cli/log/phpcs.xml" "$(SOURCEDIR)"
run-phpmd:
$(PHPMD) "$(SOURCEDIR)" xml codesize,design,naming,unusedcode --reportfile "$(REPORTDIR)/cli/log/phpmd.xml"
run-phploc:
$(PHPLOC) --log-xml "$(REPORTDIR)/cli/log/phploc.xml" "$(SOURCEDIR)" > "$(REPORTDIR)/cli.loc.txt"
run-phpcpd:
$(PHPCPD) --log-pmd "$(REPORTDIR)/cli/log/phpcpd.xml" "$(SOURCEDIR)" > "$(REPORTDIR)/cli/cli.duplications.txt"
run-pdepend:
$(PDEPEND) --jdepend-chart="$(REPORTDIR)/cli/cli.pdepend-chart.svg" --overview-pyramid="$(REPORTDIR)/cli/cli.pdepend-pyramid.svg" --jdepend-xml="$(REPORTDIR)/cli/log/pdepend.xml" "$(SOURCEDIR)"
run-phpcb:
$(PHPCB) --log="$(REPORTDIR)/cli/log" --source="$(SOURCEDIR)" --output="$(REPORTDIR)/cli/code_browser"