consolidation/robo
Robo is a modern PHP task runner for automating common development workflows. Define tasks in a RoboFile with a clean OO API to run tests, build assets, deploy, and more. Extensible via plugins, with useful built-in tasks and CLI tooling.
Executes shell script. Closes it when running in background mode.
<?php
$this->taskExec('compass')->arg('watch')->run();
// or use shortcut
$this->_exec('compass watch');
$this->taskExec('compass watch')->background()->run();
if ($this->taskExec('phpunit .')->run()->wasSuccessful()) {
$this->say('tests passed');
}
?>
simulate($context)
param $context
setProcessInput($input)
param resource|string $input
dir($dir)
param string $dir
arg($arg)
param string $arg
args($args)
param string|string[] $args
rawArg($arg)
param string $arg
option($option, $value = null, $separator = null)
param string $option
options(array $options, $separator = null)
param array $options
optionList($option, $value = null, $separator = null)
param string $option
setOutput($output)
param \Symfony\Component\Console\Output\OutputInterface $output
Execute commands one by one in stack.
Stack can be stopped on first fail if you call stopOnFail().
<?php
$this->taskExecStack()
->stopOnFail()
->exec('mkdir site')
->exec('cd site')
->run();
?>
executable($executable)
param string $executable
exec($command)
param string|string[]|CommandInterface $command
stopOnFail($stopOnFail = null)
param bool $stopOnFail
result($result)
param $result
setProcessInput($input)
param resource|string $input
dir($dir)
param string $dir
setOutput($output)
param \Symfony\Component\Console\Output\OutputInterface $output
Class ParallelExecTask
<?php
$this->taskParallelExec()
->process('php ~/demos/script.php hey')
->process('php ~/demos/script.php hoy')
->process('php ~/demos/script.php gou')
->run();
?>
process($command)
param string|\Robo\Contract\CommandInterface $command
waitInterval($waitInterval)
param int $waitInterval
setOutput($output)
param \Symfony\Component\Console\Output\OutputInterface $output
Executes Symfony Command
<?php
// Symfony Command
$this->taskSymfonyCommand(new \Codeception\Command\Run('run'))
->arg('suite','acceptance')
->opt('debug')
->run();
// Artisan Command
$this->taskSymfonyCommand(new ModelGeneratorCommand())
->arg('name', 'User')
->run();
?>
arg($arg, $value)
param string $arg
opt($option, $value = null)
param $option
setOutput($output)
param \Symfony\Component\Console\Output\OutputInterface $output
Runs task when specified file or dir was changed. Uses Lurker library. Monitor third parameter takes Lurker filesystem events types to watch. By default its set to MODIFY event.
<?php
$this->taskWatch()
->monitor(
'composer.json',
function() {
$this->taskComposerUpdate()->run();
}
)->monitor(
'src',
function() {
$this->taskExec('phpunit')->run();
},
\Lurker\Event\FilesystemEvent::ALL
)->monitor(
'migrations',
function() {
//do something
},
[
\Lurker\Event\FilesystemEvent::CREATE,
\Lurker\Event\FilesystemEvent::DELETE
]
)->run();
?>
Pass through the changed file to the callable function
$this
->taskWatch()
->monitor(
'filename',
function ($event) {
$resource = $event->getResource();
... do something with (string)$resource ...
},
FilesystemEvent::ALL
)
->run();
The $event parameter is a standard Symfony file resource object
monitor($paths, $callable, $events = null)
param string|string[] $paths
setOutput($output)
param \Symfony\Component\Console\Output\OutputInterface $output
How can I help you explore Laravel packages today?