<?php
namespace SuiteCRM\Custom\Robo\Plugin\Commands;
use Robo\Task\Base\loadTasks;
class DeployCommands extends \Robo\Tasks
{
use loadTasks;
/**
* This Robo task will deploy a given git branch.
*
* @param array $opts
* @option $branch The branch to deploy, e.g. master, development, etc.
* @usage deploy --branch=master
*/
public function deploy(array $opts = ['branch' => 'master'])
{
// You can print to stdout with $this->say
$this->say("Hello, world.");
// Or get values from the user with $this->ask
$name = $this->ask("What is your name?");
// Run arbitrary shell commands, e.g. git.
$this->_exec("git fetch");
// You can fail the task at any time with a RuntimeException.
$check = true;
if ($check !== true) {
throw new \RuntimeException("Unable to continue, check failed!");
}
// You can also use Symfony Console's io methods to provide better styling for your Robo tasks.
$checkedFiles = ['file.txt', 'file2.txt'];
$this->io()->section("{count($checkedFiles)} checked files");
$this->io()->listing($checkedFiles);
// Or use the io methods to show success or error messages.
$this->io->success('Success!');
$this->io->error('Failed!');
// Read more about Symfony Console in the documentation:
// https://symfony.com/doc/current/console/style.html
}
}