├── .gitattributes
├── dist
├── bootstrap.php.dist
├── behat.yml.dist
├── phpmd.xml.dist
├── phpunit.xml.dist
└── phpdox.xml.dist
├── .gitignore
├── composer.properties
├── composer.json
├── composer.xml
├── README.md
├── php-build-tools.properties
└── tests.xml
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Normalize line endings
2 | *html text eol=lf
3 |
--------------------------------------------------------------------------------
/dist/bootstrap.php.dist:
--------------------------------------------------------------------------------
1 |
7 | Description of your coding standard
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/dist/phpunit.xml.dist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
17 |
18 |
19 |
20 | @phptools.phpunit.srcdir@
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/dist/phpdox.xml.dist:
--------------------------------------------------------------------------------
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 |
--------------------------------------------------------------------------------
/composer.xml:
--------------------------------------------------------------------------------
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 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ant-phptools
2 | ================
3 |
4 | A Composer-friendly port of the PEAR-based Template for Jenkins Jobs for PHP Projects (http://jenkins-php.org)
5 |
6 | ## Theory of operation
7 |
8 | While the Jenkins Jobs relies on PEAR, this port relies on the new hotness that is Composer (http://getcomposer.org/).
9 | While PEAR is a system-level library container, Composer is an application-level dependency manager, which allows more granularity of control over which libraries and version are required for use.
10 | To get around the need for granular controls for testing, a Jenkins admin would have to install ALL the dependencies system-wide to meet any variety of testing criteria (TDD, BDD, SpecBDD, etc).
11 |
12 | This library gets around this by keeping in sync with the application composer dependencies. It has hooks for:
13 |
14 | * PHPUnit (https://github.com/sebastianbergmann/phpunit)
15 | * Behat (http://behat.org/)
16 | * PHPSpec2 (http://phpspec.net/)
17 | * phpmd (PHP Mess Detector - http://phpmd.org/)
18 | * phpcb (PHP Code Browser - https://github.com/Mayflower/PHP_CodeBrowser)
19 | * phpcpd (PHP Copy Paste Detector - https://github.com/sebastianbergmann/phpcpd)
20 | * phploc (PHP Lines of Code - https://github.com/sebastianbergmann/phploc)
21 | * phpcs (PHP_CodeSniffer - https://github.com/squizlabs/PHP_CodeSniffer)
22 | * pdepend (PHP_Depend - http://pdepend.org/)
23 |
24 |
25 | ## Usage
26 |
27 | Clone or download this repo into a location readable by ant:
28 |
29 | ```shell
30 | git clone https://github.com/shrikeh/ant-phptools.git
31 | ```
32 |
33 | Then, in your ant `build.xml` file, reference the `tests.xml` file by `` (not ``):
34 |
35 | ```xml
36 |
37 | ```
38 |
39 | To use the tests, you can then simply add a reference to the tests within, such as:
40 | ```xml
41 |
42 | ```
43 |
44 | For every existing hook, the tools will check to see if the corresponding phar is available, and if so, it will assume the target is to be run. Thus, by adding or subtracting from your require-dev section of the `composer.json` file, your ant file will automatically run the new automated testing referenced.
45 |
46 | These tools assume you have your tools installed to `vendor/bin`, which is the default. To achieve another location, add the following to your `composer.json` file:
47 |
48 | ```json
49 | "config": {
50 | "bin-dir": "some-other-dir/bin"
51 | },
52 |
53 | ```
54 | There are a couple of variables you should change either in a properties file or in your build.xml if you wish to do this.
55 |
56 | If you want to change the bin-dir globally, set a variable called `phptools.bindir` in your `build.xml` file:
57 |
58 | ```xml
59 |
60 | ```
61 |
62 | Or in your `.properties` file:
63 | ```
64 | phptools.bindir = /path/to/tools/bin
65 | ```
66 |
67 | If you don't use a bin dir for your tools, you can override either the path, the file, or both, for each tool:
68 |
69 | ```xml
70 |
71 |
72 | ```
73 | Each `phar` variable is constructed in the following format:
74 |
75 | ```
76 | phptools.[tool].phar = ${phptools.[tool].phar.path}/${phptools.[tool].phar.file}
77 |
78 | ```
79 |
80 | Which allows you to change either the path or the file, or simply override the resultant `.phar` variable if you prefer.
81 |
82 |
83 | ## Further configuration
84 | By default, the `tests.xml` uses sensible Symfony-style defaults for paths. However, ALL of the variables it uses are variables, allowing as much configuration as you wish.
85 |
86 | There are several ways to configure the include:
87 |
88 | * If you do not wish to use the default `php-build-tools.properties` file, copy the file, alter the values you wish, and simply set the `${phptools.properties}` to the path of the new file:
89 |
90 | ```xml
91 |
92 | ```
93 | * Alternatively, you can set individual values. Because ant works on the theory that variables already configured are read only, you can set variables prior to running the `tests-parallel` target and all will be well.
94 |
95 | ## @todo and coming soon
96 | * Support for Composer self-update, install and update is included in composer.xml, but currently undocumented.
97 | * The build will try and create phpunit.xml if it can't find one. This should be configurable.
98 | * Full documentation for every variable
99 |
100 |
101 |
--------------------------------------------------------------------------------
/php-build-tools.properties:
--------------------------------------------------------------------------------
1 | # Namespaced variables used by phptools
2 |
3 | # The project directory including the phptools
4 | phptools.project.dir = ${basedir}
5 |
6 | # Temporary properties:
7 | # Ant doesn't allow nested properties within filters, so to
8 | # achieve this, we copy the expanded properties to a temporary file and then use this
9 | # for filtering
10 | phptools.properties.tmp.dir = /tmp/
11 | phptools.properties.tmp.file = ${ant.project.name}.phptools.properties
12 | phptools.properties.tmp = ${phptools.properties.tmp.dir}/${phptools.properties.tmp.file}
13 |
14 | # The source directory for the site
15 | phptools.srcdir = ${phptools.project.dir}/src
16 | # The composer vendor directory for the site
17 | phptools.vendordir = ${phptools.project.dir}/vendor
18 | # The directory where all the php tools (phpunit, phpmd, etc) should be found.
19 | phptools.bindir = ${phptools.vendordir}/bin
20 | # The build directory
21 | phptools.builddir = ${phptools.project.dir}/build
22 | # The distribution directory. Used for copying/filtering templates for phpunit, behat, etc
23 | phptools.distdir = ${phptools.basedir}/dist
24 | # The log directory
25 | phptools.logdir = ${phptools.builddir}/logs
26 | #
27 | phptools.parallel = true
28 | phptools.threadcount = 2
29 |
30 | phptools.phpdox.phar.path = ${phptools.bindir}
31 | phptools.phpdox.phar.file = phpdox
32 | phptools.phpdox.phar = ${phptools.phpdox.phar.path}/${phptools.phpdox.phar.file}
33 | phptools.phpdox.dir = ${phptools.builddir}/api
34 | phptools.phpdox.enrichdir = ${phptools.logdir}
35 | phptools.phpdox.dist.path = ${phptools.distdir}
36 | phptools.phpdox.dist.file = phpdox.xml.dist
37 | phptools.phpdox.dist = ${phptools.phpdox.dist.path}/${phptools.phpdox.dist.file}
38 | phptools.phpdox.config.path = ${phptools.builddir}
39 | phptools.phpdox.config.file = phpdox.xml
40 | phptools.phpdox.config = ${phptools.phpdox.config.path}/${phptools.phpdox.config.file}
41 | phptools.phpdox.output = ${phptools.phpdox.dir}/docs
42 | phptools.phpdox.dot = /usr/bin/dot
43 | phptools.phpdox.todofile = todolist.txt
44 | phptools.phpdox.srcdir = ${phptools.srcdir}
45 | phptools.phpdox.workdir = ${phptools.phpdox.dir}/xml
46 | phptools.phpdox.templates = ${phptools.vendordir}/theseer/phpdox/templates/html
47 | phptools.phpdox.failonerror = false
48 | phptools.phpdox.echolevel = verbose
49 |
50 | phptools.phpunit.phar.path = ${phptools.bindir}
51 | phptools.phpunit.phar.file = phpunit
52 | phptools.phpunit.phar = ${phptools.phpunit.phar.path}/${phptools.phpunit.phar.file}
53 | phptools.phpunit.testdir = ${phptools.project.dir}/tests
54 | phptools.phpunit.srcdir = ${phptools.srcdir}
55 |
56 | phptools.phpunit.bootstrap.path = ${phptools.phpunit.testdir}
57 | phptools.phpunit.bootstrap.file = bootstrap.php
58 | phptools.phpunit.bootstrap = ${phptools.phpunit.bootstrap.path}/${phptools.phpunit.bootstrap.file}
59 | phptools.phpunit.autoload = __DIR__ . '/../vendor/autoload.php'
60 | phptools.phpunit.coverage.path = ${phptools.builddir}
61 | phptools.phpunit.coverage.name = coverage
62 | phptools.phpunit.coverage = ${phptools.phpunit.coverage.path}/${phptools.phpunit.coverage.name}
63 |
64 | phptools.phpunit.junit.path = ${phptools.phpdox.enrichdir}
65 | phptools.phpunit.junit.file = junit.xml
66 | phptools.phpunit.junit = ${phptools.phpunit.junit.path}/${phptools.phpunit.junit.file}
67 |
68 | phptools.phpunit.clover.path = ${phptools.phpdox.enrichdir}
69 | phptools.phpunit.clover.file = clover.xml
70 | phptools.phpunit.clover = ${phptools.phpunit.clover.path}/${phptools.phpunit.clover.file}
71 |
72 | phptools.phpunit.dist.bootstrap.path = ${phptools.distdir}
73 | phptools.phpunit.dist.bootstrap.file = bootstrap.php.dist
74 | phptools.phpunit.dist.bootstrap = ${phptools.phpunit.dist.bootstrap.path}/${phptools.phpunit.dist.bootstrap.file}
75 |
76 | phptools.phpunit.dist.config.path = ${phptools.distdir}
77 | phptools.phpunit.dist.config.file = phpunit.xml.dist
78 | phptools.phpunit.dist.config = ${phptools.phpunit.dist.config.path}/${phptools.phpunit.dist.config.file}
79 | phptools.phpunit.config.path = ${phptools.phpunit.testdir}
80 | phptools.phpunit.config.file = phpunit.xml
81 | phptools.phpunit.config = ${phptools.phpunit.config.path}/${phptools.phpunit.config.file}
82 | phptools.phpunit.failonerror = true
83 | phptools.phpunit.echolevel = verbose
84 |
85 | phptools.behat.phar.path = ${phptools.bindir}
86 | phptools.behat.phar.file = behat
87 | phptools.behat.phar = ${phptools.behat.phar.path}/${phptools.behat.phar.file}
88 |
89 | phptools.behat.dist.config.path = ${phptools.distdir}
90 | phptools.behat.dist.config.file = behat.yml.dist
91 | phptools.behat.dist.config = ${phptools.behat.dist.config.path}/${phptools.behat.dist.config.file}
92 |
93 | phptools.behat.config.path = ${phptools.project.dir}
94 | phptools.behat.config.file = behat.yml
95 | phptools.behat.config = ${phptools.behat.config.path}/${phptools.behat.config.file}
96 |
97 | phptools.behat.features.path = ${phptools.project.dir}
98 | phptools.behat.features.name = features
99 | phptools.behat.features = ${phptools.behat.features.path}/${phptools.behat.features.name}
100 |
101 | phptools.behat.bootstrap.path = %behat.paths.features%
102 | phptools.behat.bootstrap.name = bootstrap
103 | phptools.behat.bootstrap = ${phptools.behat.bootstrap.path}/${phptools.behat.bootstrap.name}
104 |
105 | phptools.behat.format = html
106 | phptools.behat.report.path = ${phptools.builddir}/reports
107 | phptools.behat.report.file = report.html
108 | phptools.behat.report = ${phptools.behat.report.path}/${phptools.behat.report.file}
109 | phptools.behat.srcdir = ${phptools.srcdir}
110 | phptools.behat.failonerror = true
111 | phptools.behat.echolevel = verbose
112 |
113 | phptools.phpspec2.phar.path = ${phptools.bindir}
114 | phptools.phpspec2.phar.file = phpspec
115 | phptools.phpspec2.phar = ${phptools.phpspec2.phar.path}/${phptools.phpspec2.phar.file}
116 | phptools.phpspec2.spec.path = ${phptools.project.dir}
117 | phptools.phpspec2.spec.name = spec
118 | phptools.phpspec2.specs = ${phptools.phpspec2.spec.path}/${phptools.phpspec2.spec.name}
119 | phptools.phpspec2.failonerror = true
120 | phptools.phpspec2.echolevel = verbose
121 | phptools.phpspec2.log.path = ${phptools.logdir}
122 | phptools.phpspec2.log.file = phpspec.xml
123 | phptools.phpspec2.log = ${phptools.phpspec2.log.path}/${phptools.phpspec2.log.file}
124 |
125 | phptools.phpcpd.phar.path = ${phptools.bindir}
126 | phptools.phpcpd.phar.file = phpcpd
127 | phptools.phpcpd.phar = ${phptools.phpcpd.phar.path}/${phptools.phpcpd.phar.file}
128 | phptools.phpcpd.log.path = ${phptools.logdir}
129 | phptools.phpcpd.log.file = pmdcpd.xml
130 | phptools.phpcpd.log = ${phptools.phpcpd.log.path}/${phptools.phpcpd.log.file}
131 | phptools.phpcpd.srcdir = ${phptools.srcdir}
132 | phptools.phpcpd.failonerror = false
133 | phptools.phpcpd.echolevel = verbose
134 |
135 | phptools.phpmd.phar.path = ${phptools.bindir}
136 | phptools.phpmd.phar.file = phpmd
137 | phptools.phpmd.phar = ${phptools.phpmd.phar.path}/${phptools.phpmd.phar.file}
138 | phptools.phpmd.srcdir = ${phptools.srcdir}
139 | phptools.phpmd.format = xml
140 | phptools.phpmd.dist.path = ${phptools.distdir}
141 | phptools.phpmd.dist.file = phpmd.xml.dist
142 | phptools.phpmd.dist = ${phptools.phpmd.dist.path}/${phptools.phpmd.dist.file}
143 | phptools.phpmd.config.path = ${phptools.builddir}
144 | phptools.phpmd.config.file = phpmd.xml
145 | phptools.phpmd.config = ${phptools.phpmd.config.path}/${phptools.phpmd.config.file}
146 |
147 | phptools.phpmd.reportfile.path = ${phptools.phpdox.enrichdir}
148 | phptools.phpmd.reportfile.file = pmd.xml
149 | phptools.phpmd.reportfile = ${phptools.phpmd.reportfile.path}/${phptools.phpmd.reportfile.file}
150 |
151 | phptools.phpmd.rulesets = ${phptools.vendordir}/phpmd/phpmd/src/main/resources/rulesets
152 | phptools.phpmd.failonerror = false
153 | phptools.phpmd.echolevel = verbose
154 |
155 | phptools.pdepend.phar.path = ${phptools.bindir}
156 | phptools.pdepend.phar.file = pdepend
157 | phptools.pdepend.phar = ${phptools.pdepend.phar.path}/${phptools.pdepend.phar.file}
158 | phptools.pdepend.srcdir = ${phptools.srcdir}
159 | phptools.pdepend.path = ${phptools.builddir}/pdepend
160 | phptools.pdepend.xml.path = ${phptools.logdir}
161 | phptools.pdepend.xml.file = jdepend.xml
162 | phptools.pdepend.xml = ${phptools.pdepend.xml.path}/${phptools.pdepend.xml.file}
163 | phptools.pdepend.chart.path = ${phptools.pdepend.path}
164 | phptools.pdepend.chart.file = dependencies.svg
165 | phptools.pdepend.chart = ${phptools.pdepend.chart.path}/${phptools.pdepend.chart.file}
166 | phptools.pdepend.overview-pyramid.path = ${phptools.pdepend.path}
167 | phptools.pdepend.overview-pyramid.file = overview-pyramid.svg
168 | phptools.pdepend.overview-pyramid = ${phptools.pdepend.overview-pyramid.path}/${phptools.pdepend.overview-pyramid.file}
169 | phptools.pdepend.failonerror = false
170 | phptools.pdepend.echolevel = verbose
171 |
172 | phptools.phploc.phar.path = ${phptools.bindir}
173 | phptools.phploc.phar.file = phploc
174 | phptools.phploc.phar = ${phptools.phploc.phar.path}/${phptools.phploc.phar.file}
175 | phptools.phploc.csv.path = ${phptools.builddir}
176 | phptools.phploc.csv.file = phploc.csv
177 | phptools.phploc.csv = ${phptools.phploc.csv.path}/${phptools.phploc.csv.file}
178 | phptools.phploc.srcdir = ${phptools.srcdir}
179 | phptools.phploc.failonerror = false
180 | phptools.phploc.echolevel = verbose
181 |
182 | phptools.phpcs.phar.path = ${phptools.bindir}
183 | phptools.phpcs.phar.file = phpcs
184 | phptools.phpcs.phar = ${phptools.phpcs.phar.path}/${phptools.phpcs.phar.file}
185 | phptools.phpcs.srcdir = ${phptools.srcdir}
186 | phptools.phpcs.standard = PSR2
187 | phptools.phpcs.report-format = checkstyle
188 | phptools.phpcs.report.path = ${phptools.phpdox.enrichdir}
189 | phptools.phpcs.report.file = checkstyle.xml
190 | phptools.phpcs.report = ${phptools.phpcs.report.path}/${phptools.phpcs.report.file}
191 | phptools.phpcs.failonerror = false
192 | phptools.phpcs.echolevel = verbose
193 |
194 | phptools.phpcb.phar.path = ${phptools.bindir}
195 | phptools.phpcb.phar.file = phpcb
196 | phptools.phpcb.phar = ${phptools.phpcb.phar.path}/${phptools.phpcb.phar.file}
197 | phptools.phpcb.logdir = ${phptools.logdir}
198 | phptools.phpcb.output.path = ${phptools.builddir}
199 | phptools.phpcb.output.name = code-browser
200 | phptools.phpcb.output = ${phptools.phpcb.output.path}/${phptools.phpcb.output.name}
201 | phptools.phpcb.srcdir = ${phptools.srcdir}
202 | phptools.phpcb.failonerror = false
203 | phptools.phpcb.echolevel = verbose
204 |
205 | phptools.lint.srcdir = ${phptools.srcdir}
206 | phptools.lint.unitdir = ${phptools.phpunit.testdir}
207 | phptools.lint.failonerror = true
208 | phptools.lint.echolevel = verbose
209 |
--------------------------------------------------------------------------------
/tests.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
24 |
25 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
65 |
66 |
67 |
68 |
69 |
70 |
72 |
73 |
74 |
75 |
76 |
77 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
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 |
134 |
135 |
136 |
137 |
139 |
141 |
142 |
143 |
144 |
145 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 |
189 |
191 |
192 |
193 |
194 |
195 |
196 |
197 |
198 |
199 |
200 |
202 |
203 |
204 |
205 |
206 |
207 |
208 |
209 |
210 |
211 |
212 |
213 |
214 |
215 |
216 |
217 |
218 |
219 |
220 |
221 |
222 |
223 |
224 |
225 |
226 |
227 |
228 |
229 |
230 |
231 |
232 |
233 |
234 |
235 |
236 |
237 |
238 |
239 |
240 |
241 |
242 |
243 |
244 |
245 |
246 |
247 |
248 |
249 |
250 |
251 |
252 |
253 |
254 |
255 |
256 |
257 |
258 |
259 |
260 |
261 |
262 |
263 |
264 |
265 |
266 |
267 |
268 |
269 |
270 |
271 |
272 |
273 |
274 |
275 |
276 |
277 |
278 |
279 |
280 |
281 |
282 |
283 |
284 |
285 |
286 |
287 |
288 |
289 |
--------------------------------------------------------------------------------