1
1
Fork 0
mirror of https://code.mensbeam.com/MensBeam/Arsse.git synced 2024-12-21 20:52:40 +00:00

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
This commit is contained in:
J. King 2017-12-08 14:37:49 -05:00
parent 3a07156259
commit 4bc3398157
11 changed files with 1336 additions and 457 deletions

8
.gitattributes vendored
View file

@ -3,11 +3,5 @@
*.html diff=html
*.php diff=php
*.bat eol=crlf
*.cmd eol=crlf
.gitignore -eol
tests/ export-ignore
.* export-ignore
build.xml export-ignore
composer.* export-ignore
phpdoc.* export-ignore

5
.gitignore vendored
View file

@ -1,17 +1,13 @@
# Temporary files and dependencies
vendor/
documentation/
tests/coverage/
build/
arsse.db*
config.php
.php_cs.cache
# Windows files
Thumbs.db
@ -30,6 +26,7 @@ Icon
.Spotlight-V100
.Trashes
# archives
*.zip

63
RoboFile.php Normal file
View file

@ -0,0 +1,63 @@
<?php
use Robo\Result;
/**
* This is project's console commands configuration for Robo task runner.
*
* @see http://robo.li/
*/
class RoboFile extends \Robo\Tasks {
const BASE = __DIR__.\DIRECTORY_SEPARATOR;
const BASE_TEST = self::BASE."tests".\DIRECTORY_SEPARATOR;
public function test(array $args): Result {
// start the built-in PHP server, which is required for some of the tests
$this->taskServer(8000)->host("localhost")->dir(self::BASE_TEST."docroot")->rawArg("-n")->arg(self::BASE_TEST."server.php")->background()->run();
// run tests
return $this->taskPHPUnit()->configFile(self::BASE_TEST."phpunit.xml")->args($args)->run();
}
public function coverage(array $args): Result {
// run the test suite with code coverage reporting enabled
return $this->test(["--coverage-html",self::BASE_TEST."coverage"]);
}
public function package(array $args): Result {
// establish which commit to package
$version = $args ? $args[0] : $this->askDefault("Commit to package:", "head");
$archive = self::BASE."arsse-$version.tar.gz";
// start a collection
$t = $this->collectionBuilder();
// create a temporary directory
$dir = $t->tmpDir().\DIRECTORY_SEPARATOR;
// create a Git worktree for the selected commit in the temp location
$t->taskExec("git worktree add ".escapeshellarg($dir)." ".escapeshellarg($version));
// perform Composer installation in the temp location
$t->taskComposerInstall()->dir($dir)->noDev()->optimizeAutoloader()->arg("--no-scripts");
// delete unwanted files
$t->taskFilesystemStack()->remove([
$dir.".git",
$dir.".gitignore",
$dir.".gitattributes",
$dir."composer.json",
$dir."composer.lock",
$dir.".php_cs.dist",
$dir."phpdoc.dist.xml",
$dir."build.xml",
$dir."RoboFile.php",
$dir."CONTRIBUTING.md",
$dir."tests",
$dir."vendor-bin",
]);
// generate a sample configuration file
$t->taskExec("php arsse.php conf save-defaults config.defaults.php")->dir($dir);
// package it all up
$t->taskPack($archive)->addDir("arsse", $dir);
// execute the collection
$out = $t->run();
// clean the Git worktree list
$this->_exec("git worktree prune");
return $out;
}
}

View file

@ -1,49 +0,0 @@
<project default="build">
<target name="build">
<mkdir dir="./build/arsse"/>
<copy todir="./build/arsse">
<fileset dir=".">
<include name="lib/**"/>
<include name="sql/**"/>
<include name="locale/**"/>
<include name="dist/**"/>
<include name="www/**"/>
<include name="composer.*"/>
<include name="arsse.php"/>
<include name="CHANGELOG"/>
<include name="LICENSE"/>
<include name="AUTHORS"/>
<include name="UPGRADING"/>
<include name="README.md"/>
</fileset>
</copy>
<echo>Installing dependencies via Composer</echo>
<exec command="composer install -o --no-dev --no-scripts" dir="./build/arsse"/>
<delete>
<fileset dir="./build/arsse">
<include name="composer.*"/>
</fileset>
</delete>
<echo>Generating example configuration file</echo>
<exec command="php arsse.php conf save-defaults config.defaults.php" dir="./build/arsse"/>
</target>
<target name="clean">
<delete dir="./build"/>
</target>
<target name="package">
<propertyprompt propertyName="arsse.version" defaultValue="head" promptText="Git tag to package"/> <!-- This needs to be used to actually check out a tag, etc -->
<delete> <!-- Delete code, but keep dependencies, which Composer will prune -->
<fileset dir="./build/arsse">
<exclude name="vendor/**"/>
</fileset>
</delete>
<phingcall target="build"/>
<tar destfile="./build/arsse-${arsse.version}.tar.gz" basedir="./build" compression="gzip">
<fileset dir="./build" includes="arsse"/>
</tar>
</target>
</project>

2
composer.lock generated
View file

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

View file

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

View file

@ -192,16 +192,16 @@
},
{
"name": "friendsofphp/php-cs-fixer",
"version": "v2.8.3",
"version": "v2.9.0",
"source": {
"type": "git",
"url": "https://github.com/FriendsOfPHP/PHP-CS-Fixer.git",
"reference": "d9ec9b848cbf930c31dea3693d34dbd8b9c95295"
"reference": "454ddbe65da6a9297446f442bad244e8a99a9a38"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/d9ec9b848cbf930c31dea3693d34dbd8b9c95295",
"reference": "d9ec9b848cbf930c31dea3693d34dbd8b9c95295",
"url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/454ddbe65da6a9297446f442bad244e8a99a9a38",
"reference": "454ddbe65da6a9297446f442bad244e8a99a9a38",
"shasum": ""
},
"require": {
@ -228,7 +228,8 @@
"require-dev": {
"johnkary/phpunit-speedtrap": "^1.1 || ^2.0@dev",
"justinrainbow/json-schema": "^5.0",
"php-coveralls/php-coveralls": "^1.0.2",
"mikey179/vfsstream": "^1.6",
"php-coveralls/php-coveralls": "^2.0",
"php-cs-fixer/accessible-object": "^1.0",
"phpunit/phpunit": "^5.7.23 || ^6.4.3",
"symfony/phpunit-bridge": "^3.2.2 || ^4.0"
@ -268,7 +269,7 @@
}
],
"description": "A tool to automatically fix PHP code style",
"time": "2017-11-26T20:45:16+00:00"
"time": "2017-12-08T16:36:20+00:00"
},
{
"name": "gecko-packages/gecko-php-unit",

View file

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

View file

@ -1,381 +0,0 @@
{
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"content-hash": "941e0d87740d0c3d899eb3dabe54c0f6",
"packages": [
{
"name": "pear/archive_tar",
"version": "1.4.3",
"source": {
"type": "git",
"url": "https://github.com/pear/Archive_Tar.git",
"reference": "43455c960da70e655c6bdf8ea2bc8cc1a6034afb"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/pear/Archive_Tar/zipball/43455c960da70e655c6bdf8ea2bc8cc1a6034afb",
"reference": "43455c960da70e655c6bdf8ea2bc8cc1a6034afb",
"shasum": ""
},
"require": {
"pear/pear-core-minimal": "^1.10.0alpha2",
"php": ">=5.2.0"
},
"require-dev": {
"phpunit/phpunit": "*"
},
"suggest": {
"ext-bz2": "bz2 compression support.",
"ext-xz": "lzma2 compression support.",
"ext-zlib": "Gzip compression support."
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.4.x-dev"
}
},
"autoload": {
"psr-0": {
"Archive_Tar": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"include-path": [
"./"
],
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Vincent Blavet",
"email": "vincent@phpconcept.net"
},
{
"name": "Greg Beaver",
"email": "greg@chiaraquartet.net"
},
{
"name": "Michiel Rook",
"email": "mrook@php.net"
}
],
"description": "Tar file management class",
"homepage": "https://github.com/pear/Archive_Tar",
"keywords": [
"archive",
"tar"
],
"time": "2017-06-11T17:28:11+00:00"
},
{
"name": "pear/console_getopt",
"version": "v1.4.1",
"source": {
"type": "git",
"url": "https://github.com/pear/Console_Getopt.git",
"reference": "82f05cd1aa3edf34e19aa7c8ca312ce13a6a577f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/pear/Console_Getopt/zipball/82f05cd1aa3edf34e19aa7c8ca312ce13a6a577f",
"reference": "82f05cd1aa3edf34e19aa7c8ca312ce13a6a577f",
"shasum": ""
},
"type": "library",
"autoload": {
"psr-0": {
"Console": "./"
}
},
"notification-url": "https://packagist.org/downloads/",
"include-path": [
"./"
],
"license": [
"BSD-2-Clause"
],
"authors": [
{
"name": "Greg Beaver",
"email": "cellog@php.net",
"role": "Helper"
},
{
"name": "Andrei Zmievski",
"email": "andrei@php.net",
"role": "Lead"
},
{
"name": "Stig Bakken",
"email": "stig@php.net",
"role": "Developer"
}
],
"description": "More info available on: http://pear.php.net/package/Console_Getopt",
"time": "2015-07-20T20:28:12+00:00"
},
{
"name": "pear/pear-core-minimal",
"version": "v1.10.3",
"source": {
"type": "git",
"url": "https://github.com/pear/pear-core-minimal.git",
"reference": "070f0b600b2caca2501e2c9b7e553016e4b0d115"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/pear/pear-core-minimal/zipball/070f0b600b2caca2501e2c9b7e553016e4b0d115",
"reference": "070f0b600b2caca2501e2c9b7e553016e4b0d115",
"shasum": ""
},
"require": {
"pear/console_getopt": "~1.4",
"pear/pear_exception": "~1.0"
},
"replace": {
"rsky/pear-core-min": "self.version"
},
"type": "library",
"autoload": {
"psr-0": {
"": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"include-path": [
"src/"
],
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Christian Weiske",
"email": "cweiske@php.net",
"role": "Lead"
}
],
"description": "Minimal set of PEAR core files to be used as composer dependency",
"time": "2017-02-28T16:46:11+00:00"
},
{
"name": "pear/pear_exception",
"version": "v1.0.0",
"source": {
"type": "git",
"url": "https://github.com/pear/PEAR_Exception.git",
"reference": "8c18719fdae000b690e3912be401c76e406dd13b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/pear/PEAR_Exception/zipball/8c18719fdae000b690e3912be401c76e406dd13b",
"reference": "8c18719fdae000b690e3912be401c76e406dd13b",
"shasum": ""
},
"require": {
"php": ">=4.4.0"
},
"require-dev": {
"phpunit/phpunit": "*"
},
"type": "class",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-0": {
"PEAR": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"include-path": [
"."
],
"license": [
"BSD-2-Clause"
],
"authors": [
{
"name": "Helgi Thormar",
"email": "dufuz@php.net"
},
{
"name": "Greg Beaver",
"email": "cellog@php.net"
}
],
"description": "The PEAR Exception base class.",
"homepage": "https://github.com/pear/PEAR_Exception",
"keywords": [
"exception"
],
"time": "2015-02-10T20:07:52+00:00"
},
{
"name": "phing/phing",
"version": "2.16.0",
"source": {
"type": "git",
"url": "https://github.com/phingofficial/phing.git",
"reference": "151a0f4d8cebf7711eccc62dde3f09bc36a00d7b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phingofficial/phing/zipball/151a0f4d8cebf7711eccc62dde3f09bc36a00d7b",
"reference": "151a0f4d8cebf7711eccc62dde3f09bc36a00d7b",
"shasum": ""
},
"require": {
"php": ">=5.2.0",
"symfony/yaml": "^3.1"
},
"require-dev": {
"ext-pdo_sqlite": "*",
"mikey179/vfsstream": "^1.6",
"pdepend/pdepend": "2.x",
"pear/archive_tar": "1.4.x",
"pear/http_request2": "dev-trunk",
"pear/net_growl": "dev-trunk",
"pear/pear-core-minimal": "1.10.1",
"pear/versioncontrol_git": "@dev",
"pear/versioncontrol_svn": "~0.5",
"phpdocumentor/phpdocumentor": "2.x",
"phploc/phploc": "~2.0.6",
"phpmd/phpmd": "~2.2",
"phpunit/phpunit": ">=3.7",
"sebastian/git": "~1.0",
"sebastian/phpcpd": "2.x",
"siad007/versioncontrol_hg": "^1.0",
"simpletest/simpletest": "^1.1",
"squizlabs/php_codesniffer": "~2.2"
},
"suggest": {
"pdepend/pdepend": "PHP version of JDepend",
"pear/archive_tar": "Tar file management class",
"pear/versioncontrol_git": "A library that provides OO interface to handle Git repository",
"pear/versioncontrol_svn": "A simple OO-style interface for Subversion, the free/open-source version control system",
"phpdocumentor/phpdocumentor": "Documentation Generator for PHP",
"phploc/phploc": "A tool for quickly measuring the size of a PHP project",
"phpmd/phpmd": "PHP version of PMD tool",
"phpunit/php-code-coverage": "Library that provides collection, processing, and rendering functionality for PHP code coverage information",
"phpunit/phpunit": "The PHP Unit Testing Framework",
"sebastian/phpcpd": "Copy/Paste Detector (CPD) for PHP code",
"siad007/versioncontrol_hg": "A library for interfacing with Mercurial repositories.",
"tedivm/jshrink": "Javascript Minifier built in PHP"
},
"bin": [
"bin/phing"
],
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.16.x-dev"
}
},
"autoload": {
"classmap": [
"classes/phing/"
]
},
"notification-url": "https://packagist.org/downloads/",
"include-path": [
"classes"
],
"license": [
"LGPL-3.0"
],
"authors": [
{
"name": "Michiel Rook",
"email": "mrook@php.net"
},
{
"name": "Phing Community",
"homepage": "https://www.phing.info/trac/wiki/Development/Contributors"
}
],
"description": "PHing Is Not GNU make; it's a PHP project build system or build tool based on Apache Ant.",
"homepage": "https://www.phing.info/",
"keywords": [
"build",
"phing",
"task",
"tool"
],
"time": "2016-12-22T20:16:33+00:00"
},
{
"name": "symfony/yaml",
"version": "v3.4.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/yaml.git",
"reference": "f6a99b95b338799645fe9f7880d7d4ca1bf79cc1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/yaml/zipball/f6a99b95b338799645fe9f7880d7d4ca1bf79cc1",
"reference": "f6a99b95b338799645fe9f7880d7d4ca1bf79cc1",
"shasum": ""
},
"require": {
"php": "^5.5.9|>=7.0.8"
},
"conflict": {
"symfony/console": "<3.4"
},
"require-dev": {
"symfony/console": "~3.4|~4.0"
},
"suggest": {
"symfony/console": "For validating YAML files using the lint command"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.4-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Component\\Yaml\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony Yaml Component",
"homepage": "https://symfony.com",
"time": "2017-12-04T18:15:22+00:00"
}
],
"packages-dev": [],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": [],
"prefer-stable": false,
"prefer-lowest": false,
"platform": [],
"platform-dev": []
}

View file

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

1256
vendor-bin/robo/composer.lock generated Normal file

File diff suppressed because it is too large Load diff