Change Robo tasks to return error exit codes when they fail

This commit is contained in:
Tautvidas Sipavičius
2016-10-31 15:43:04 +02:00
parent 1331ed70f1
commit 288464e8cb

View File

@@ -3,14 +3,21 @@
class RoboFile extends \Robo\Tasks { class RoboFile extends \Robo\Tasks {
function install() { function install() {
$this->_exec('./composer.phar install'); return $this->taskExecStack()
$this->_exec('npm install'); ->stopOnFail()
->exec('./composer.phar install')
->exec('npm install')
->run();
} }
function update() { function update() {
$this->say(getenv('WP_TEST_URL')); $this->say(getenv('WP_TEST_URL'));
$this->_exec('./composer.phar update');
$this->_exec('npm update'); return $this->taskExecStack()
->stopOnFail()
->exec('./composer.phar update')
->exec('npm update')
->run();
} }
protected function rsearch($folder, $extensions = array()) { protected function rsearch($folder, $extensions = array()) {
@@ -61,12 +68,14 @@ class RoboFile extends \Robo\Tasks {
} }
function compileAll() { function compileAll() {
$this->compileJs(); $collection = $this->collection();
$this->compileCss(); $collection->add(array($this, 'compileJs'));
$collection->add(array($this, 'compileCss'));
return $collection->run();
} }
function compileJs() { function compileJs() {
$this->_exec('./node_modules/webpack/bin/webpack.js'); return $this->_exec('./node_modules/webpack/bin/webpack.js --bail');
} }
function compileCss() { function compileCss() {
@@ -78,7 +87,7 @@ class RoboFile extends \Robo\Tasks {
'assets/css/src/importExport.styl' 'assets/css/src/importExport.styl'
); );
$this->_exec(join(' ', array( return $this->_exec(join(' ', array(
'./node_modules/stylus/bin/stylus', './node_modules/stylus/bin/stylus',
'--include ./node_modules', '--include ./node_modules',
'--include-css', '--include-css',
@@ -89,14 +98,14 @@ class RoboFile extends \Robo\Tasks {
} }
function makepot() { function makepot() {
$this->_exec('./node_modules/.bin/grunt makepot'. return $this->_exec('./node_modules/.bin/grunt makepot'.
' --gruntfile '.__DIR__.'/tasks/makepot/makepot.js'. ' --gruntfile '.__DIR__.'/tasks/makepot/makepot.js'.
' --base_path '.__DIR__ ' --base_path '.__DIR__
); );
} }
function pushpot() { function pushpot() {
$this->_exec('./node_modules/.bin/grunt pushpot'. return $this->_exec('./node_modules/.bin/grunt pushpot'.
' --gruntfile '.__DIR__.'/tasks/makepot/makepot.js'. ' --gruntfile '.__DIR__.'/tasks/makepot/makepot.js'.
' --base_path '.__DIR__ ' --base_path '.__DIR__
); );
@@ -152,22 +161,26 @@ class RoboFile extends \Robo\Tasks {
function testDebug() { function testDebug() {
$this->_exec('vendor/bin/codecept build'); $this->_exec('vendor/bin/codecept build');
$this->loadEnv(); $this->loadEnv();
$this->_exec('vendor/bin/codecept run unit --debug'); return $this->_exec('vendor/bin/codecept run unit --debug');
} }
function testFailed() { function testFailed() {
$this->loadEnv(); $this->loadEnv();
$this->_exec('vendor/bin/codecept build'); $this->_exec('vendor/bin/codecept build');
$this->_exec('vendor/bin/codecept run -g failed'); return $this->_exec('vendor/bin/codecept run -g failed');
} }
function qa() { function qa() {
$this->qaLint(); $collection = $this->collection();
$this->qaCodeSniffer('all'); $collection->add(array($this, 'qaLint'));
$collection->add(function() {
return $this->qaCodeSniffer('all');
});
return $collection->run();
} }
function qaLint() { function qaLint() {
$this->_exec('./tasks/php_lint.sh lib/ tests/ mailpoet.php'); return $this->_exec('./tasks/php_lint.sh lib/ tests/ mailpoet.php');
} }
function qaCodeSniffer($severity='errors') { function qaCodeSniffer($severity='errors') {
@@ -176,7 +189,7 @@ class RoboFile extends \Robo\Tasks {
} else { } else {
$severityFlag = '-n'; $severityFlag = '-n';
} }
$this->_exec( return $this->_exec(
'./vendor/bin/phpcs '. './vendor/bin/phpcs '.
'--standard=./tasks/code_sniffer/MailPoet '. '--standard=./tasks/code_sniffer/MailPoet '.
'--ignore=./lib/Util/Sudzy/*,./lib/Util/CSS.php,./lib/Util/XLSXWriter.php,'. '--ignore=./lib/Util/Sudzy/*,./lib/Util/CSS.php,./lib/Util/XLSXWriter.php,'.