mirror of
https://github.com/sitelease/sugar-cube-client.git
synced 2025-10-31 20:12:29 +01:00
Updated the build system
This commit is contained in:
27
RoboFile.php
27
RoboFile.php
@ -16,14 +16,17 @@ class RoboFile extends Tasks {
|
|||||||
$path = (string) getenv('PATH');
|
$path = (string) getenv('PATH');
|
||||||
$vendor = (string) realpath('vendor/bin');
|
$vendor = (string) realpath('vendor/bin');
|
||||||
if (strpos($path, $vendor) === false) putenv("PATH=$vendor".PATH_SEPARATOR.$path);
|
if (strpos($path, $vendor) === false) putenv("PATH=$vendor".PATH_SEPARATOR.$path);
|
||||||
|
$this->stopOnFail();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deletes all generated files and reset any saved state.
|
* Deletes all generated files and reset any saved state.
|
||||||
*/
|
*/
|
||||||
function clean(): void {
|
function clean(): Result {
|
||||||
$this->_cleanDir('var');
|
return $this->collectionBuilder()
|
||||||
$this->_deleteDir(['build', 'doc/api', 'web']);
|
->addTask($this->taskCleanDir('var'))
|
||||||
|
->addTask($this->taskDeleteDir(['build', 'doc/api', 'web']))
|
||||||
|
->run();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -39,12 +42,14 @@ class RoboFile extends Tasks {
|
|||||||
* @return Result The task result.
|
* @return Result The task result.
|
||||||
*/
|
*/
|
||||||
function doc(): Result {
|
function doc(): Result {
|
||||||
$this->taskFilesystemStack()
|
return $this->collectionBuilder()
|
||||||
|
->addTask($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'))
|
||||||
|
->addTask($this->taskExec('mkdocs build --config-file=doc/mkdocs.yml'))
|
||||||
|
->addTask($this->taskFilesystemStack()
|
||||||
|
->remove(['doc/about/changelog.md', 'doc/about/license.md', 'web/mkdocs.yml', 'web/phpdoc.xml']))
|
||||||
->run();
|
->run();
|
||||||
|
|
||||||
return $this->_exec('mkdocs build --config-file=doc/mkdocs.yml');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -72,7 +77,7 @@ class RoboFile extends Tasks {
|
|||||||
*/
|
*/
|
||||||
function upgrade(): Result {
|
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');
|
||||||
return $this->taskExecStack()->stopOnFail()
|
return $this->taskExecStack()
|
||||||
->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')
|
||||||
@ -92,9 +97,9 @@ class RoboFile extends Tasks {
|
|||||||
/**
|
/**
|
||||||
* Watches for file changes.
|
* Watches for file changes.
|
||||||
*/
|
*/
|
||||||
function watch(): void {
|
function watch(): Result {
|
||||||
$this->taskWatch()
|
return $this->taskWatch()
|
||||||
->monitor(['src', 'test'], function() { $this->test(); })
|
->monitor('test', function() { $this->test(); })
|
||||||
->run();
|
->run();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user