Fixed the build system

This commit is contained in:
Cédric Belin
2018-12-23 15:08:49 +01:00
parent 7df671f5d3
commit 6514ab20bd

View File

@ -29,29 +29,34 @@ class RoboFile extends Tasks {
/** /**
* Uploads the results of the code coverage. * Uploads the results of the code coverage.
* @return Result The task result.
*/ */
function coverage(): void { function coverage(): Result {
$this->_exec('coveralls var/coverage.xml'); return $this->_exec('coveralls var/coverage.xml');
} }
/** /**
* Builds the documentation. * Builds the documentation.
* @return Result The task result.
*/ */
function doc(): void { function doc(): Result {
$this->taskFilesystemStack() $this->taskFilesystemStack()
->copy('CHANGELOG.md', 'doc/about/changelog.md') ->copy('CHANGELOG.md', 'doc/about/changelog.md')
->copy('LICENSE.md', 'doc/about/license.md') ->copy('LICENSE.md', 'doc/about/license.md')
->run(); ->run();
$this->_exec('mkdocs build'); return $this->_exec('mkdocs build');
} }
/** /**
* Performs the static analysis of source code. * Performs the static analysis of source code.
* @return Result The task result.
*/ */
function lint(): void { function lint(): Result {
$this->_exec('php -l example/main.php'); return $this->taskExecStack()
$this->_exec('phpstan analyse'); ->exec('php -l example/main.php')
->exec('phpstan analyse')
->run();
} }
/** /**
@ -64,10 +69,11 @@ class RoboFile extends Tasks {
/** /**
* Upgrades the project to the latest revision. * Upgrades the project to the latest revision.
* @return Result The task result.
*/ */
function upgrade(): void { function upgrade(): Result {
$composer = escapeshellarg(PHP_OS_FAMILY == 'Windows' ? 'C:\Program Files\PHP\share\composer.phar' : '/usr/local/bin/composer'); $composer = escapeshellarg(PHP_OS_FAMILY == 'Windows' ? 'C:\Program Files\PHP\share\composer.phar' : '/usr/local/bin/composer');
$this->taskExecStack()->stopOnFail() return $this->taskExecStack()->stopOnFail()
->exec('git reset --hard') ->exec('git reset --hard')
->exec('git fetch --all --prune') ->exec('git fetch --all --prune')
->exec('git pull --rebase') ->exec('git pull --rebase')
@ -78,9 +84,10 @@ class RoboFile extends Tasks {
/** /**
* Increments the version number of the package. * Increments the version number of the package.
* @param string $component The part in the version number to increment. * @param string $component The part in the version number to increment.
* @return Result The task result.
*/ */
function version(string $component = 'patch'): void { function version(string $component = 'patch'): Result {
$this->taskSemVer('.semver')->increment($component)->run(); return $this->taskSemVer('.semver')->increment($component)->run();
} }
/** /**