Browse Source

Use Robo for programming task execution

The plan had originally been to use Bldr, but Bldr's features were not particularly compelling, and it has not been maintained recently. By contrast Robo has very useful features while still meeting my needs.

In addition to migrating the build process, the current Robo file also runs unit tests, with or without coverage reporting.

Fixes #116; improves #113
J. King 1 year ago
parent
commit
4bc3398157

+ 1
- 7
.gitattributes View File

@@ -3,11 +3,5 @@
3 3
 *.html     diff=html
4 4
 *.php      diff=php
5 5
 *.bat      eol=crlf
6
+*.cmd      eol=crlf
6 7
 .gitignore -eol
7
-
8
-
9
-tests/         export-ignore
10
-.*             export-ignore
11
-build.xml      export-ignore
12
-composer.*     export-ignore
13
-phpdoc.*       export-ignore

+ 1
- 4
.gitignore View File

@@ -1,17 +1,13 @@
1
-
2 1
 # Temporary files and dependencies
3 2
 
4 3
 vendor/
5 4
 documentation/
6 5
 tests/coverage/
7
-build/
8 6
 arsse.db*
9 7
 config.php
10 8
 .php_cs.cache
11 9
 
12 10
 
13
-
14
-
15 11
 # Windows files
16 12
 
17 13
 Thumbs.db
@@ -30,6 +26,7 @@ Icon
30 26
 .Spotlight-V100
31 27
 .Trashes
32 28
 
29
+
33 30
 # archives
34 31
 
35 32
 *.zip

+ 63
- 0
RoboFile.php View File

@@ -0,0 +1,63 @@
1
+<?php
2
+
3
+use Robo\Result;
4
+
5
+/**
6
+ * This is project's console commands configuration for Robo task runner.
7
+ *
8
+ * @see http://robo.li/
9
+ */
10
+class RoboFile extends \Robo\Tasks {
11
+    const BASE = __DIR__.\DIRECTORY_SEPARATOR;
12
+    const BASE_TEST = self::BASE."tests".\DIRECTORY_SEPARATOR;
13
+
14
+    public function test(array $args): Result {
15
+        // start the built-in PHP server, which is required for some of the tests
16
+        $this->taskServer(8000)->host("localhost")->dir(self::BASE_TEST."docroot")->rawArg("-n")->arg(self::BASE_TEST."server.php")->background()->run();
17
+        // run tests
18
+        return $this->taskPHPUnit()->configFile(self::BASE_TEST."phpunit.xml")->args($args)->run();
19
+    }
20
+
21
+    public function coverage(array $args): Result {
22
+        // run the test suite with code coverage reporting enabled
23
+        return $this->test(["--coverage-html",self::BASE_TEST."coverage"]);
24
+    }
25
+
26
+    public function package(array $args): Result {
27
+        // establish which commit to package
28
+        $version = $args ? $args[0] : $this->askDefault("Commit to package:", "head");
29
+        $archive = self::BASE."arsse-$version.tar.gz";
30
+        // start a collection
31
+        $t = $this->collectionBuilder();
32
+        // create a temporary directory
33
+        $dir = $t->tmpDir().\DIRECTORY_SEPARATOR;
34
+        // create a Git worktree for the selected commit in the temp location
35
+        $t->taskExec("git worktree add ".escapeshellarg($dir)." ".escapeshellarg($version));
36
+        // perform Composer installation in the temp location
37
+        $t->taskComposerInstall()->dir($dir)->noDev()->optimizeAutoloader()->arg("--no-scripts");
38
+        // delete unwanted files
39
+        $t->taskFilesystemStack()->remove([
40
+            $dir.".git",
41
+            $dir.".gitignore",
42
+            $dir.".gitattributes",
43
+            $dir."composer.json",
44
+            $dir."composer.lock",
45
+            $dir.".php_cs.dist",
46
+            $dir."phpdoc.dist.xml",
47
+            $dir."build.xml",
48
+            $dir."RoboFile.php",
49
+            $dir."CONTRIBUTING.md",
50
+            $dir."tests",
51
+            $dir."vendor-bin",
52
+        ]);
53
+        // generate a sample configuration file
54
+        $t->taskExec("php arsse.php conf save-defaults config.defaults.php")->dir($dir);
55
+        // package it all up
56
+        $t->taskPack($archive)->addDir("arsse", $dir);
57
+        // execute the collection
58
+        $out = $t->run();
59
+        // clean the Git worktree list
60
+        $this->_exec("git worktree prune");
61
+        return $out;
62
+    }
63
+}

+ 0
- 49
build.xml View File

@@ -1,49 +0,0 @@
1
-<project default="build">
2
-
3
-    <target name="build">
4
-        <mkdir dir="./build/arsse"/>
5
-        <copy todir="./build/arsse">
6
-            <fileset dir=".">
7
-                <include name="lib/**"/>
8
-                <include name="sql/**"/>
9
-                <include name="locale/**"/>
10
-                <include name="dist/**"/>
11
-                <include name="www/**"/>
12
-                <include name="composer.*"/>
13
-                <include name="arsse.php"/>
14
-                <include name="CHANGELOG"/>
15
-                <include name="LICENSE"/>
16
-                <include name="AUTHORS"/>
17
-                <include name="UPGRADING"/>
18
-                <include name="README.md"/>
19
-            </fileset>
20
-        </copy>
21
-        <echo>Installing dependencies via Composer</echo>
22
-        <exec command="composer install -o --no-dev --no-scripts" dir="./build/arsse"/>
23
-        <delete>
24
-            <fileset dir="./build/arsse">
25
-                <include name="composer.*"/>
26
-            </fileset>
27
-        </delete>
28
-        <echo>Generating example configuration file</echo>
29
-        <exec command="php arsse.php conf save-defaults config.defaults.php" dir="./build/arsse"/>
30
-    </target>
31
-
32
-    <target name="clean">
33
-        <delete dir="./build"/>
34
-    </target>
35
-
36
-    <target name="package">
37
-        <propertyprompt propertyName="arsse.version" defaultValue="head" promptText="Git tag to package"/> <!-- This needs to be used to actually check out a tag, etc -->
38
-        <delete> <!-- Delete code, but keep dependencies, which Composer will prune -->
39
-            <fileset dir="./build/arsse">
40
-                <exclude name="vendor/**"/>
41
-            </fileset>
42
-        </delete>
43
-        <phingcall target="build"/>
44
-        <tar destfile="./build/arsse-${arsse.version}.tar.gz" basedir="./build" compression="gzip">
45
-            <fileset dir="./build" includes="arsse"/>
46
-        </tar>
47
-    </target>
48
-
49
-</project>

+ 1
- 1
composer.lock View File

@@ -4,7 +4,7 @@
4 4
         "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
5 5
         "This file is @generated automatically"
6 6
     ],
7
-    "content-hash": "99dc7ae7311e5fbb4b09757ddf52e766",
7
+    "content-hash": "8a3c7ff23f125a5fa3dac2e6a7244a90",
8 8
     "packages": [
9 9
         {
10 10
             "name": "docopt/docopt",

+ 0
- 3
tests/phpunit.xml View File

@@ -15,9 +15,6 @@
15 15
     <directory suffix=".php">../lib</directory>
16 16
   </whitelist>
17 17
 </filter>
18
-<logging>
19
-  <log type="coverage-html" target="coverage" showUncoveredFiles="true"/>
20
-</logging>
21 18
 <listeners>
22 19
     <listener class="JohnKary\PHPUnit\Listener\SpeedTrapListener">
23 20
         <arguments><array>

+ 7
- 6
vendor-bin/csfixer/composer.lock View File

@@ -192,16 +192,16 @@
192 192
         },
193 193
         {
194 194
             "name": "friendsofphp/php-cs-fixer",
195
-            "version": "v2.8.3",
195
+            "version": "v2.9.0",
196 196
             "source": {
197 197
                 "type": "git",
198 198
                 "url": "https://github.com/FriendsOfPHP/PHP-CS-Fixer.git",
199
-                "reference": "d9ec9b848cbf930c31dea3693d34dbd8b9c95295"
199
+                "reference": "454ddbe65da6a9297446f442bad244e8a99a9a38"
200 200
             },
201 201
             "dist": {
202 202
                 "type": "zip",
203
-                "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/d9ec9b848cbf930c31dea3693d34dbd8b9c95295",
204
-                "reference": "d9ec9b848cbf930c31dea3693d34dbd8b9c95295",
203
+                "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/454ddbe65da6a9297446f442bad244e8a99a9a38",
204
+                "reference": "454ddbe65da6a9297446f442bad244e8a99a9a38",
205 205
                 "shasum": ""
206 206
             },
207 207
             "require": {
@@ -228,7 +228,8 @@
228 228
             "require-dev": {
229 229
                 "johnkary/phpunit-speedtrap": "^1.1 || ^2.0@dev",
230 230
                 "justinrainbow/json-schema": "^5.0",
231
-                "php-coveralls/php-coveralls": "^1.0.2",
231
+                "mikey179/vfsstream": "^1.6",
232
+                "php-coveralls/php-coveralls": "^2.0",
232 233
                 "php-cs-fixer/accessible-object": "^1.0",
233 234
                 "phpunit/phpunit": "^5.7.23 || ^6.4.3",
234 235
                 "symfony/phpunit-bridge": "^3.2.2 || ^4.0"
@@ -268,7 +269,7 @@
268 269
                 }
269 270
             ],
270 271
             "description": "A tool to automatically fix PHP code style",
271
-            "time": "2017-11-26T20:45:16+00:00"
272
+            "time": "2017-12-08T16:36:20+00:00"
272 273
         },
273 274
         {
274 275
             "name": "gecko-packages/gecko-php-unit",

+ 0
- 6
vendor-bin/phing/composer.json View File

@@ -1,6 +0,0 @@
1
-{
2
-    "require": {
3
-        "phing/phing": "^2.16",
4
-        "pear/archive_tar": "^1.4"
5
-    }
6
-}

+ 0
- 381
vendor-bin/phing/composer.lock View File

@@ -1,381 +0,0 @@
1
-{
2
-    "_readme": [
3
-        "This file locks the dependencies of your project to a known state",
4
-        "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
5
-        "This file is @generated automatically"
6
-    ],
7
-    "content-hash": "941e0d87740d0c3d899eb3dabe54c0f6",
8
-    "packages": [
9
-        {
10
-            "name": "pear/archive_tar",
11
-            "version": "1.4.3",
12
-            "source": {
13
-                "type": "git",
14
-                "url": "https://github.com/pear/Archive_Tar.git",
15
-                "reference": "43455c960da70e655c6bdf8ea2bc8cc1a6034afb"
16
-            },
17
-            "dist": {
18
-                "type": "zip",
19
-                "url": "https://api.github.com/repos/pear/Archive_Tar/zipball/43455c960da70e655c6bdf8ea2bc8cc1a6034afb",
20
-                "reference": "43455c960da70e655c6bdf8ea2bc8cc1a6034afb",
21
-                "shasum": ""
22
-            },
23
-            "require": {
24
-                "pear/pear-core-minimal": "^1.10.0alpha2",
25
-                "php": ">=5.2.0"
26
-            },
27
-            "require-dev": {
28
-                "phpunit/phpunit": "*"
29
-            },
30
-            "suggest": {
31
-                "ext-bz2": "bz2 compression support.",
32
-                "ext-xz": "lzma2 compression support.",
33
-                "ext-zlib": "Gzip compression support."
34
-            },
35
-            "type": "library",
36
-            "extra": {
37
-                "branch-alias": {
38
-                    "dev-master": "1.4.x-dev"
39
-                }
40
-            },
41
-            "autoload": {
42
-                "psr-0": {
43
-                    "Archive_Tar": ""
44
-                }
45
-            },
46
-            "notification-url": "https://packagist.org/downloads/",
47
-            "include-path": [
48
-                "./"
49
-            ],
50
-            "license": [
51
-                "BSD-3-Clause"
52
-            ],
53
-            "authors": [
54
-                {
55
-                    "name": "Vincent Blavet",
56
-                    "email": "vincent@phpconcept.net"
57
-                },
58
-                {
59
-                    "name": "Greg Beaver",
60
-                    "email": "greg@chiaraquartet.net"
61
-                },
62
-                {
63
-                    "name": "Michiel Rook",
64
-                    "email": "mrook@php.net"
65
-                }
66
-            ],
67
-            "description": "Tar file management class",
68
-            "homepage": "https://github.com/pear/Archive_Tar",
69
-            "keywords": [
70
-                "archive",
71
-                "tar"
72
-            ],
73
-            "time": "2017-06-11T17:28:11+00:00"
74
-        },
75
-        {
76
-            "name": "pear/console_getopt",
77
-            "version": "v1.4.1",
78
-            "source": {
79
-                "type": "git",
80
-                "url": "https://github.com/pear/Console_Getopt.git",
81
-                "reference": "82f05cd1aa3edf34e19aa7c8ca312ce13a6a577f"
82
-            },
83
-            "dist": {
84
-                "type": "zip",
85
-                "url": "https://api.github.com/repos/pear/Console_Getopt/zipball/82f05cd1aa3edf34e19aa7c8ca312ce13a6a577f",
86
-                "reference": "82f05cd1aa3edf34e19aa7c8ca312ce13a6a577f",
87
-                "shasum": ""
88
-            },
89
-            "type": "library",
90
-            "autoload": {
91
-                "psr-0": {
92
-                    "Console": "./"
93
-                }
94
-            },
95
-            "notification-url": "https://packagist.org/downloads/",
96
-            "include-path": [
97
-                "./"
98
-            ],
99
-            "license": [
100
-                "BSD-2-Clause"
101
-            ],
102
-            "authors": [
103
-                {
104
-                    "name": "Greg Beaver",
105
-                    "email": "cellog@php.net",
106
-                    "role": "Helper"
107
-                },
108
-                {
109
-                    "name": "Andrei Zmievski",
110
-                    "email": "andrei@php.net",
111
-                    "role": "Lead"
112
-                },
113
-                {
114
-                    "name": "Stig Bakken",
115
-                    "email": "stig@php.net",
116
-                    "role": "Developer"
117
-                }
118
-            ],
119
-            "description": "More info available on: http://pear.php.net/package/Console_Getopt",
120
-            "time": "2015-07-20T20:28:12+00:00"
121
-        },
122
-        {
123
-            "name": "pear/pear-core-minimal",
124
-            "version": "v1.10.3",
125
-            "source": {
126
-                "type": "git",
127
-                "url": "https://github.com/pear/pear-core-minimal.git",
128
-                "reference": "070f0b600b2caca2501e2c9b7e553016e4b0d115"
129
-            },
130
-            "dist": {
131
-                "type": "zip",
132
-                "url": "https://api.github.com/repos/pear/pear-core-minimal/zipball/070f0b600b2caca2501e2c9b7e553016e4b0d115",
133
-                "reference": "070f0b600b2caca2501e2c9b7e553016e4b0d115",
134
-                "shasum": ""
135
-            },
136
-            "require": {
137
-                "pear/console_getopt": "~1.4",
138
-                "pear/pear_exception": "~1.0"
139
-            },
140
-            "replace": {
141
-                "rsky/pear-core-min": "self.version"
142
-            },
143
-            "type": "library",
144
-            "autoload": {
145
-                "psr-0": {
146
-                    "": "src/"
147
-                }
148
-            },
149
-            "notification-url": "https://packagist.org/downloads/",
150
-            "include-path": [
151
-                "src/"
152
-            ],
153
-            "license": [
154
-                "BSD-3-Clause"
155
-            ],
156
-            "authors": [
157
-                {
158
-                    "name": "Christian Weiske",
159
-                    "email": "cweiske@php.net",
160
-                    "role": "Lead"
161
-                }
162
-            ],
163
-            "description": "Minimal set of PEAR core files to be used as composer dependency",
164
-            "time": "2017-02-28T16:46:11+00:00"
165
-        },
166
-        {
167
-            "name": "pear/pear_exception",
168
-            "version": "v1.0.0",
169
-            "source": {
170
-                "type": "git",
171
-                "url": "https://github.com/pear/PEAR_Exception.git",
172
-                "reference": "8c18719fdae000b690e3912be401c76e406dd13b"
173
-            },
174
-            "dist": {
175
-                "type": "zip",
176
-                "url": "https://api.github.com/repos/pear/PEAR_Exception/zipball/8c18719fdae000b690e3912be401c76e406dd13b",
177
-                "reference": "8c18719fdae000b690e3912be401c76e406dd13b",
178
-                "shasum": ""
179
-            },
180
-            "require": {
181
-                "php": ">=4.4.0"
182
-            },
183
-            "require-dev": {
184
-                "phpunit/phpunit": "*"
185
-            },
186
-            "type": "class",
187
-            "extra": {
188
-                "branch-alias": {
189
-                    "dev-master": "1.0.x-dev"
190
-                }
191
-            },
192
-            "autoload": {
193
-                "psr-0": {
194
-                    "PEAR": ""
195
-                }
196
-            },
197
-            "notification-url": "https://packagist.org/downloads/",
198
-            "include-path": [
199
-                "."
200
-            ],
201
-            "license": [
202
-                "BSD-2-Clause"
203
-            ],
204
-            "authors": [
205
-                {
206
-                    "name": "Helgi Thormar",
207
-                    "email": "dufuz@php.net"
208
-                },
209
-                {
210
-                    "name": "Greg Beaver",
211
-                    "email": "cellog@php.net"
212
-                }
213
-            ],
214
-            "description": "The PEAR Exception base class.",
215
-            "homepage": "https://github.com/pear/PEAR_Exception",
216
-            "keywords": [
217
-                "exception"
218
-            ],
219
-            "time": "2015-02-10T20:07:52+00:00"
220
-        },
221
-        {
222
-            "name": "phing/phing",
223
-            "version": "2.16.0",
224
-            "source": {
225
-                "type": "git",
226
-                "url": "https://github.com/phingofficial/phing.git",
227
-                "reference": "151a0f4d8cebf7711eccc62dde3f09bc36a00d7b"
228
-            },
229
-            "dist": {
230
-                "type": "zip",
231
-                "url": "https://api.github.com/repos/phingofficial/phing/zipball/151a0f4d8cebf7711eccc62dde3f09bc36a00d7b",
232
-                "reference": "151a0f4d8cebf7711eccc62dde3f09bc36a00d7b",
233
-                "shasum": ""
234
-            },
235
-            "require": {
236
-                "php": ">=5.2.0",
237
-                "symfony/yaml": "^3.1"
238
-            },
239
-            "require-dev": {
240
-                "ext-pdo_sqlite": "*",
241
-                "mikey179/vfsstream": "^1.6",
242
-                "pdepend/pdepend": "2.x",
243
-                "pear/archive_tar": "1.4.x",
244
-                "pear/http_request2": "dev-trunk",
245
-                "pear/net_growl": "dev-trunk",
246
-                "pear/pear-core-minimal": "1.10.1",
247
-                "pear/versioncontrol_git": "@dev",
248
-                "pear/versioncontrol_svn": "~0.5",
249
-                "phpdocumentor/phpdocumentor": "2.x",
250
-                "phploc/phploc": "~2.0.6",
251
-                "phpmd/phpmd": "~2.2",
252
-                "phpunit/phpunit": ">=3.7",
253
-                "sebastian/git": "~1.0",
254
-                "sebastian/phpcpd": "2.x",
255
-                "siad007/versioncontrol_hg": "^1.0",
256
-                "simpletest/simpletest": "^1.1",
257
-                "squizlabs/php_codesniffer": "~2.2"
258
-            },
259
-            "suggest": {
260
-                "pdepend/pdepend": "PHP version of JDepend",
261
-                "pear/archive_tar": "Tar file management class",
262
-                "pear/versioncontrol_git": "A library that provides OO interface to handle Git repository",
263
-                "pear/versioncontrol_svn": "A simple OO-style interface for Subversion, the free/open-source version control system",
264
-                "phpdocumentor/phpdocumentor": "Documentation Generator for PHP",
265
-                "phploc/phploc": "A tool for quickly measuring the size of a PHP project",
266
-                "phpmd/phpmd": "PHP version of PMD tool",
267
-                "phpunit/php-code-coverage": "Library that provides collection, processing, and rendering functionality for PHP code coverage information",
268
-                "phpunit/phpunit": "The PHP Unit Testing Framework",
269
-                "sebastian/phpcpd": "Copy/Paste Detector (CPD) for PHP code",
270
-                "siad007/versioncontrol_hg": "A library for interfacing with Mercurial repositories.",
271
-                "tedivm/jshrink": "Javascript Minifier built in PHP"
272
-            },
273
-            "bin": [
274
-                "bin/phing"
275
-            ],
276
-            "type": "library",
277
-            "extra": {
278
-                "branch-alias": {
279
-                    "dev-master": "2.16.x-dev"
280
-                }
281
-            },
282
-            "autoload": {
283
-                "classmap": [
284
-                    "classes/phing/"
285
-                ]
286
-            },
287
-            "notification-url": "https://packagist.org/downloads/",
288
-            "include-path": [
289
-                "classes"
290
-            ],
291
-            "license": [
292
-                "LGPL-3.0"
293
-            ],
294
-            "authors": [
295
-                {
296
-                    "name": "Michiel Rook",
297
-                    "email": "mrook@php.net"
298
-                },
299
-                {
300
-                    "name": "Phing Community",
301
-                    "homepage": "https://www.phing.info/trac/wiki/Development/Contributors"
302
-                }
303
-            ],
304
-            "description": "PHing Is Not GNU make; it's a PHP project build system or build tool based on Apache Ant.",
305
-            "homepage": "https://www.phing.info/",
306
-            "keywords": [
307
-                "build",
308
-                "phing",
309
-                "task",
310
-                "tool"
311
-            ],
312
-            "time": "2016-12-22T20:16:33+00:00"
313
-        },
314
-        {
315
-            "name": "symfony/yaml",
316
-            "version": "v3.4.1",
317
-            "source": {
318
-                "type": "git",
319
-                "url": "https://github.com/symfony/yaml.git",
320
-                "reference": "f6a99b95b338799645fe9f7880d7d4ca1bf79cc1"
321
-            },
322
-            "dist": {
323
-                "type": "zip",
324
-                "url": "https://api.github.com/repos/symfony/yaml/zipball/f6a99b95b338799645fe9f7880d7d4ca1bf79cc1",
325
-                "reference": "f6a99b95b338799645fe9f7880d7d4ca1bf79cc1",
326
-                "shasum": ""
327
-            },
328
-            "require": {
329
-                "php": "^5.5.9|>=7.0.8"
330
-            },
331
-            "conflict": {
332
-                "symfony/console": "<3.4"
333
-            },
334
-            "require-dev": {
335
-                "symfony/console": "~3.4|~4.0"
336
-            },
337
-            "suggest": {
338
-                "symfony/console": "For validating YAML files using the lint command"
339
-            },
340
-            "type": "library",
341
-            "extra": {
342
-                "branch-alias": {
343
-                    "dev-master": "3.4-dev"
344
-                }
345
-            },
346
-            "autoload": {
347
-                "psr-4": {
348
-                    "Symfony\\Component\\Yaml\\": ""
349
-                },
350
-                "exclude-from-classmap": [
351
-                    "/Tests/"
352
-                ]
353
-            },
354
-            "notification-url": "https://packagist.org/downloads/",
355
-            "license": [
356
-                "MIT"
357
-            ],
358
-            "authors": [
359
-                {
360
-                    "name": "Fabien Potencier",
361
-                    "email": "fabien@symfony.com"
362
-                },
363
-                {
364
-                    "name": "Symfony Community",
365
-                    "homepage": "https://symfony.com/contributors"
366
-                }
367
-            ],
368
-            "description": "Symfony Yaml Component",
369
-            "homepage": "https://symfony.com",
370
-            "time": "2017-12-04T18:15:22+00:00"
371
-        }
372
-    ],
373
-    "packages-dev": [],
374
-    "aliases": [],
375
-    "minimum-stability": "stable",
376
-    "stability-flags": [],
377
-    "prefer-stable": false,
378
-    "prefer-lowest": false,
379
-    "platform": [],
380
-    "platform-dev": []
381
-}

+ 7
- 0
vendor-bin/robo/composer.json View File

@@ -0,0 +1,7 @@
1
+{
2
+    "require": {
3
+        "consolidation/robo": "^1.1",
4
+        "pear/archive_tar": "^1.4",
5
+        "symfony/process": "3.3.*"
6
+    }
7
+}

+ 1256
- 0
vendor-bin/robo/composer.lock
File diff suppressed because it is too large
View File


Loading…
Cancel
Save