Fix code style
This commit is contained in:
committed by
M. Shull
parent
9588ce4515
commit
05a4ebad04
36
RoboFile.php
36
RoboFile.php
@ -36,8 +36,8 @@ class RoboFile extends \Robo\Tasks {
|
|||||||
|
|
||||||
function watch() {
|
function watch() {
|
||||||
$this->say('Warning: this lints and compiles all files, not just the changed one. Use separate tasks watch:js and watch:css for faster and more efficient watching.');
|
$this->say('Warning: this lints and compiles all files, not just the changed one. Use separate tasks watch:js and watch:css for faster and more efficient watching.');
|
||||||
$css_files = $this->rsearch('assets/css/src/', array('scss'));
|
$css_files = $this->rsearch('assets/css/src/', ['scss']);
|
||||||
$js_files = $this->rsearch('assets/js/src/', array('js', 'jsx'));
|
$js_files = $this->rsearch('assets/js/src/', ['js', 'jsx']);
|
||||||
|
|
||||||
$this->taskWatch()
|
$this->taskWatch()
|
||||||
->monitor($js_files, function() {
|
->monitor($js_files, function() {
|
||||||
@ -50,7 +50,7 @@ class RoboFile extends \Robo\Tasks {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function watchCss() {
|
function watchCss() {
|
||||||
$css_files = $this->rsearch('assets/css/src/', array('scss'));
|
$css_files = $this->rsearch('assets/css/src/', ['scss']);
|
||||||
$this->taskWatch()
|
$this->taskWatch()
|
||||||
->monitor($css_files, function($changedFile) {
|
->monitor($css_files, function($changedFile) {
|
||||||
$file = $changedFile->getResource()->getResource();
|
$file = $changedFile->getResource()->getResource();
|
||||||
@ -71,10 +71,10 @@ class RoboFile extends \Robo\Tasks {
|
|||||||
function compileAll($opts = ['env' => null]) {
|
function compileAll($opts = ['env' => null]) {
|
||||||
$collection = $this->collectionBuilder();
|
$collection = $this->collectionBuilder();
|
||||||
$collection->addCode(function() use ($opts) {
|
$collection->addCode(function() use ($opts) {
|
||||||
return call_user_func(array($this, 'compileJs'), $opts);
|
return call_user_func([$this, 'compileJs'], $opts);
|
||||||
});
|
});
|
||||||
$collection->addCode(function() use ($opts) {
|
$collection->addCode(function() use ($opts) {
|
||||||
return call_user_func(array($this, 'compileCss'), $opts);
|
return call_user_func([$this, 'compileCss'], $opts);
|
||||||
});
|
});
|
||||||
return $collection->run();
|
return $collection->run();
|
||||||
}
|
}
|
||||||
@ -191,12 +191,12 @@ class RoboFile extends \Robo\Tasks {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function testCoverage($opts=['file' => null, 'xml' => false]) {
|
function testCoverage($opts=['file' => null, 'xml' => false]) {
|
||||||
$command = join(' ', array(
|
$command = join(' ', [
|
||||||
'vendor/bin/codecept run -s acceptance',
|
'vendor/bin/codecept run -s acceptance',
|
||||||
(($opts['file']) ? $opts['file'] : ''),
|
(($opts['file']) ? $opts['file'] : ''),
|
||||||
'--coverage',
|
'--coverage',
|
||||||
($opts['xml']) ? '--coverage-xml' : '--coverage-html'
|
($opts['xml']) ? '--coverage-xml' : '--coverage-html',
|
||||||
));
|
]);
|
||||||
|
|
||||||
if ($opts['xml']) {
|
if ($opts['xml']) {
|
||||||
$command .= ' --xml';
|
$command .= ' --xml';
|
||||||
@ -208,11 +208,11 @@ class RoboFile extends \Robo\Tasks {
|
|||||||
function testJavascript($xml_output_file = null) {
|
function testJavascript($xml_output_file = null) {
|
||||||
$this->compileJs();
|
$this->compileJs();
|
||||||
|
|
||||||
$command = join(' ', array(
|
$command = join(' ', [
|
||||||
'./node_modules/.bin/mocha',
|
'./node_modules/.bin/mocha',
|
||||||
'-r tests/javascript/mochaTestHelper.js',
|
'-r tests/javascript/mochaTestHelper.js',
|
||||||
'tests/javascript/testBundles/**/*.js'
|
'tests/javascript/testBundles/**/*.js',
|
||||||
));
|
]);
|
||||||
|
|
||||||
if (!empty($xml_output_file)) {
|
if (!empty($xml_output_file)) {
|
||||||
$command .= sprintf(
|
$command .= sprintf(
|
||||||
@ -296,19 +296,19 @@ class RoboFile extends \Robo\Tasks {
|
|||||||
$dump_file,
|
$dump_file,
|
||||||
$dumper->dump([
|
$dumper->dump([
|
||||||
'class' => $configurator->getDumpClassname(),
|
'class' => $configurator->getDumpClassname(),
|
||||||
'namespace' => $configurator->getDumpNamespace()
|
'namespace' => $configurator->getDumpNamespace(),
|
||||||
])
|
])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function qa() {
|
function qa() {
|
||||||
$collection = $this->collectionBuilder();
|
$collection = $this->collectionBuilder();
|
||||||
$collection->addCode(array($this, 'qaLint'));
|
$collection->addCode([$this, 'qaLint']);
|
||||||
$collection->addCode(function() {
|
$collection->addCode(function() {
|
||||||
return $this->qaCodeSniffer('all');
|
return $this->qaCodeSniffer('all');
|
||||||
});
|
});
|
||||||
$collection->addCode(array($this, 'qaLintJavascript'));
|
$collection->addCode([$this, 'qaLintJavascript']);
|
||||||
$collection->addCode(array($this, 'qaLintCss'));
|
$collection->addCode([$this, 'qaLintCss']);
|
||||||
return $collection->run();
|
return $collection->run();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -439,7 +439,7 @@ class RoboFile extends \Robo\Tasks {
|
|||||||
if (file_exists("$svn_dir/trunk_new") || file_exists("$svn_dir/trunk_old")) {
|
if (file_exists("$svn_dir/trunk_new") || file_exists("$svn_dir/trunk_old")) {
|
||||||
$collection->taskFileSystemStack()
|
$collection->taskFileSystemStack()
|
||||||
->stopOnFail()
|
->stopOnFail()
|
||||||
->remove(array("$svn_dir/trunk_new", "$svn_dir/trunk_old"));
|
->remove(["$svn_dir/trunk_new", "$svn_dir/trunk_old"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Extract the distributable zip to tmp trunk dir
|
// Extract the distributable zip to tmp trunk dir
|
||||||
@ -743,7 +743,7 @@ class RoboFile extends \Robo\Tasks {
|
|||||||
$this->say("Release '$version[name]' info was published on Slack.");
|
$this->say("Release '$version[name]' info was published on Slack.");
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function rsearch($folder, $extensions = array()) {
|
protected function rsearch($folder, $extensions = []) {
|
||||||
$dir = new RecursiveDirectoryIterator($folder);
|
$dir = new RecursiveDirectoryIterator($folder);
|
||||||
$iterator = new RecursiveIteratorIterator($dir);
|
$iterator = new RecursiveIteratorIterator($dir);
|
||||||
|
|
||||||
@ -755,7 +755,7 @@ class RoboFile extends \Robo\Tasks {
|
|||||||
RecursiveRegexIterator::GET_MATCH
|
RecursiveRegexIterator::GET_MATCH
|
||||||
);
|
);
|
||||||
|
|
||||||
$list = array();
|
$list = [];
|
||||||
foreach ($files as $file) {
|
foreach ($files as $file) {
|
||||||
$list[] = $file[0];
|
$list[] = $file[0];
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user