プロジェクトの composer.json
に追加
require-dev: {
"consolidation/robo": "^1.0.0"
}
あるいは、グローバルにインストール:
composer global require consolidation/robo
robo.pharをダウンロード
wget http://robo.li/robo.phar
あるいは GitHub releases からHTTPSを経由してダウンロード
グローバルにインストールするには、/usr/bin に robo.phar を置きます。
sudo chmod +x robo.phar && mv robo.phar /usr/bin/robo
これで、robo
のように使うことができます。
#Robo はとても驚くべきプロジェクトです。The one project that was missing to php developer environment. 私はとても好きです。@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. とても良いです。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
}