Added the Porter Stemmer module to improve searches. This doesn't deal with some...
[yaffs-website] / vendor / consolidation / robo / README.md
1 # RoboTask
2
3 **Modern and simple PHP task runner** inspired by Gulp and Rake aimed to automate common tasks:
4
5 [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/consolidation-org/Robo?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) 
6 [![Latest Stable Version](https://poser.pugx.org/consolidation/robo/v/stable.png)](https://packagist.org/packages/consolidation/robo) 
7 [![Latest Unstable Version](https://poser.pugx.org/consolidation/robo/v/unstable.png)](https://packagist.org/packages/consolidation/robo) 
8 [![Total Downloads](https://poser.pugx.org/consolidation/robo/downloads.png)](https://packagist.org/packages/consolidation/robo) 
9 [![PHP 7 ready](http://php7ready.timesplinter.ch/consolidation/Robo/badge.svg)](https://travis-ci.org/consolidation/Robo)
10 [![License](https://poser.pugx.org/consolidation/robo/license.png)](https://www.versioneye.com/user/projects/57c4a6fe968d64004d97620a?child=57c4a6fe968d64004d97620a#tab-licenses)
11
12 [![Build Status](https://travis-ci.org/consolidation/Robo.svg?branch=master)](https://travis-ci.org/consolidation/Robo) 
13 [![Windows CI](https://ci.appveyor.com/api/projects/status/0823hnh06pw8ir4d?svg=true)](https://ci.appveyor.com/project/greg-1-anderson/robo)
14 [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/consolidation/Robo/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/consolidation/Robo/?branch=master)
15 [![Dependency Status](https://www.versioneye.com/user/projects/57c4a6fe968d64004d97620a/badge.svg?style=flat-square)](https://www.versioneye.com/user/projects/57c4a6fe968d64004d97620a)
16
17 * writing cross-platform scripts
18 * processing assets (less, sass, minification)
19 * running tests
20 * executing daemons (and workers)
21 * watching filesystem changes
22 * deployment with sftp/ssh/docker
23
24 ## Installing
25
26 ### Phar
27
28 [Download robo.phar >](http://robo.li/robo.phar)
29
30 ```
31 wget http://robo.li/robo.phar
32 ```
33
34 To install globally put `robo.phar` in `/usr/bin`. (`/usr/local/bin/` in OSX 10.11+)
35
36 ```
37 chmod +x robo.phar && sudo mv robo.phar /usr/bin/robo
38 ```
39
40 OSX 10.11+
41 ```
42 chmod +x robo.phar && sudo mv robo.phar /usr/local/bin/robo
43 ```
44
45 Now you can use it just like `robo`.
46
47 ### Composer
48
49 * Run `composer require consolidation/robo:~1`
50 * Use `vendor/bin/robo` to execute Robo tasks.
51
52 ## Usage
53
54 All tasks are defined as **public methods** in `RoboFile.php`. It can be created by running `robo`.
55 All protected methods in traits that start with `task` prefix are tasks and can be configured and executed in your tasks.
56
57 ## Examples
58
59 The best way to learn Robo by example is to take a look into [its own RoboFile](https://github.com/consolidation-org/Robo/blob/master/RoboFile.php)
60  or [RoboFile of Codeception project](https://github.com/Codeception/Codeception/blob/2.4/RoboFile.php). There are also some basic example commands in examples/RoboFile.php.
61
62 Here are some snippets from them:
63
64 ---
65
66 Run acceptance test with local server and selenium server started.
67
68
69 ``` php
70 <?php
71 class RoboFile extends \Robo\Tasks
72 {
73
74     function testAcceptance($seleniumPath = '~/selenium-server-standalone-2.39.0.jar')
75     {
76        // launches PHP server on port 8000 for web dir
77        // server will be executed in background and stopped in the end
78        $this->taskServer(8000)
79             ->background()
80             ->dir('web')
81             ->run();
82
83        // running Selenium server in background
84         $this->taskExec('java -jar ' . $seleniumPath)
85             ->background()
86             ->run();
87
88         // loading Symfony Command and running with passed argument
89         $this->taskSymfonyCommand(new \Codeception\Command\Run('run'))
90             ->arg('suite','acceptance')
91             ->run();
92     }
93 }
94 ```
95
96 If you execute `robo` you will see this task added to list of available task with name: `test:acceptance`.
97 To execute it you should run `robo test:acceptance`. You may change path to selenium server by passing new path as a argument:
98
99 ```
100 robo test:acceptance "C:\Downloads\selenium.jar"
101 ```
102
103 Using `watch` task so you can use it for running tests or building assets.
104
105 ``` php
106 <?php
107 class RoboFile extends \Robo\Tasks {
108
109     function watchComposer()
110     {
111         // when composer.json changes `composer update` will be executed
112         $this->taskWatch()->monitor('composer.json', function() {
113             $this->taskComposerUpdate()->run();
114         })->run();
115     }
116 }
117 ```
118
119 ---
120
121 Cleaning logs and cache
122
123 ``` php
124 <?php
125 class RoboFile extends \Robo\Tasks
126 {
127     public function clean()
128     {
129         $this->taskCleanDir([
130             'app/cache',
131             'app/logs'
132         ])->run();
133
134         $this->taskDeleteDir([
135             'web/assets/tmp_uploads',
136         ])->run();
137     }
138 }
139 ```
140
141 This task cleans `app/cache` and `app/logs` dirs (ignoring .gitignore and .gitkeep files)
142 Can be executed by running:
143
144 ```
145 robo clean
146 ```
147
148 ----
149
150 Creating Phar archive
151
152 ``` php
153 function buildPhar()
154 {
155     $files = Finder::create()->ignoreVCS(true)->files()->name('*.php')->in(__DIR__);
156     $packer = $this->taskPackPhar('robo.phar');
157     foreach ($files as $file) {
158         $packer->addFile($file->getRelativePathname(), $file->getRealPath());
159     }
160     $packer->addFile('robo','robo')
161         ->executable('robo')
162         ->run();
163 }
164 ```
165
166 ---
167
168 ## We need more tasks!
169
170 Create your own tasks and send them as Pull Requests or create packages [with `"type": "robo-tasks"` in `composer.json` on Packagist](https://packagist.org/?type=robo-tasks).
171
172 ## Credits
173
174 Follow [@robo_php](http://twitter.com/robo_php) for updates.
175
176 Brought to you by [Consolidation Team](https://github.com/orgs/consolidation/people) and our [awesome contributors](https://github.com/consolidation/Robo/graphs/contributors).
177
178 ## License
179
180 [MIT](https://github.com/consolidation/Robo/blob/master/LICENSE)