Add to composer.json
of your project
require-dev: {
"consolidation/robo": "^1.0.0"
}
or install it globally:
composer global require consolidation/robo
Download robo.phar
wget http://robo.li/robo.phar
or download it via HTTPS from GitHub releases
To install globally put robo.phar in /usr/bin (/usr/local/bin in OSX 10.11+).
chmod +x robo.phar && sudo mv robo.phar /usr/bin/robo
Now you can use it just like robo
.
#Robo is a very amazing project. The one project that was missing to php developer environment. I really like it. @codeception @codegyre
— Hugo Leonardo C. S. (@hugoleodev) February 20, 2014
I've been playing w/ @davert's Robo this evening, converting a rickety shell script for building #Drupal. Very nice. pic.twitter.com/gGtJu0EWSC
— Paul Byrne (@pfaocle) January 29, 2014
<?php // all tasks are defined in RoboFile.php
class RoboFile {
/**
* Each public method is a command in runner
* parameters are arguments in console
*
* use './robo test' to run tests on a project
*/
function test($pathToSelenium = '~/selenium.jar')
{
// starts PHP server in background
$this->taskPhpServer(8000)
->background()
->dir('web')
->run();
// launches Selenium server
$this->taskExec('java -jar '.$pathToSelenium)
->background()
->run();
// runs PHPUnit tests
$this->taskPHPUnit()
->run();
}
/**
* Cleanup temporary files
*/
function clean()
{
$this->_cleanDir(['app/cache', 'app/logs']);
$this->_deleteDir(['web/assets/tmp_uploads']);
}
/**
* Minify assets
*/
function assets()
{
// concat CSS files
$this->taskConcat(['web/css/core.css','web/css/theme.css'])
->to('main.css')
->run();
// minify CSS files
$this->taskMinify('main.css')
->to('main.min.css')
->run();
// install Bower dependencies
$this->taskBowerInstall()
->dir('web')
->run();
}
// ...Git, Ssh, Docker, and other tasks available
}