Refactoring

This commit is contained in:
gamonoid
2017-09-03 20:39:22 +02:00
parent af40881847
commit a7274d3cfd
5075 changed files with 238202 additions and 16291 deletions

View File

@@ -0,0 +1,56 @@
# ApiGen Tasks
## ApiGen
Executes ApiGen command to generate documentation
``` php
<?php
// ApiGen Command
$this->taskApiGen('./apigen.neon')
->templateConfig('vendor/apigen/apigen/templates/bootstrap/config.neon')
->wipeout(true)
->run();
?>
```
* `config($config)` * `param string` $config
* `source($src)` * `param array|string|Traversable` $src one or more source values
* `destination($dest)` * `param string` $dest
* `extensions($exts)` * `param array|string` $exts one or more extensions
* `exclude($exclude)` * `param array|string` $exclude one or more exclusions
* `skipDocPath($path)` * `param array|string|Traversable` $path one or more skip-doc-path values
* `skipDocPrefix($prefix)` * `param array|string|Traversable` $prefix one or more skip-doc-prefix values
* `charset($charset)` * `param array|string` $charset one or more charsets
* `mainProjectNamePrefix($name)` * `param string` $name
* `title($title)` * `param string` $title
* `baseUrl($baseUrl)` * `param string` $baseUrl
* `googleCseId($id)` * `param string` $id
* `googleAnalytics($trackingCode)` * `param string` $trackingCode
* `templateConfig($templateConfig)` * `param mixed` $templateConfig
* `allowedHtml($tags)` * `param array|string` $tags one or more supported html tags
* `groups($groups)` * `param string` $groups
* `autocomplete($types)` * `param array|string` $types or more supported autocomplete types
* `accessLevels($levels)` * `param array|string` $levels one or more access levels
* `internal($internal)` * `param boolean|string` $internal 'yes' or true if internal, 'no' or false if not
* `php($php)` * `param boolean|string` $php 'yes' or true to generate documentation for internal php classes,
* `tree($tree)` * `param bool|string` $tree 'yes' or true to generate a tree view of classes, 'no' or false otherwise
* `deprecated($dep)` * `param bool|string` $dep 'yes' or true to generate documentation for deprecated classes, 'no' or false otherwise
* `todo($todo)` * `param bool|string` $todo 'yes' or true to document tasks, 'no' or false otherwise
* `sourceCode($src)` * `param bool|string` $src 'yes' or true to generate highlighted source code, 'no' or false otherwise
* `download($zipped)` * `param bool|string` $zipped 'yes' or true to generate downloadable documentation, 'no' or false otherwise
* `report($path)`
* `wipeout($wipeout)` * `param bool|string` $wipeout 'yes' or true to clear out the destination directory, 'no' or false otherwise
* `quiet($quiet)` * `param bool|string` $quiet 'yes' or true for quiet, 'no' or false otherwise
* `progressbar($bar)` * `param bool|string` $bar 'yes' or true to display a progress bar, 'no' or false otherwise
* `colors($colors)` * `param bool|string` $colors 'yes' or true colorize the output, 'no' or false otherwise
* `updateCheck($check)` * `param bool|string` $check 'yes' or true to check for updates, 'no' or false otherwise
* `debug($debug)` * `param bool|string` $debug 'yes' or true to enable debug mode, 'no' or false otherwise
* `dir($dir)` Changes working directory of command
* `printed($arg)` Should command output be printed
* `arg($arg)` Pass argument to executable. Its value will be automatically escaped.
* `args($args)` Pass methods parameters as arguments to executable. Argument values
* `rawArg($arg)` Pass the provided string in its raw (as provided) form as an argument to executable.
* `option($option, $value = null)` Pass option to executable. Options are prefixed with `--` , value can be provided in second parameter.
* `optionList($option, $value = null)` Pass multiple options to executable. Value can be a string or array.

View File

@@ -0,0 +1,52 @@
# Archive Tasks
## Extract
Extracts an archive.
Note that often, distributions are packaged in tar or zip archives
where the topmost folder may contain variable information, such as
the release date, or the version of the package. This information
is very useful when unpacking by hand, but arbitrarily-named directories
are much less useful to scripts. Therefore, by default, Extract will
remove the top-level directory, and instead store all extracted files
into the directory specified by $archivePath.
To keep the top-level directory when extracting, use
`preserveTopDirectory(true)`.
``` php
<?php
$this->taskExtract($archivePath)
->to($destination)
->preserveTopDirectory(false) // the default
->run();
?>
```
* `to(string)` location to store extracted files
* `to($to)` Location to store extracted files.
* `preserveTopDirectory($preserve = null)` * `param bool` $preserve
## Pack
Creates a zip or tar archive.
``` php
<?php
$this->taskPack(
<archiveFile>)
->add('README') // Puts file 'README' in archive at the root
->add('project') // Puts entire contents of directory 'project' in archinve inside 'project'
->addFile('dir/file.txt', 'file.txt') // Takes 'file.txt' from cwd and puts it in archive inside 'dir'.
->run();
?>
```
* `archiveFile($archiveFile)` * `param string` $archiveFile
* `addFile($placementLocation, $filesystemLocation)` Add an item to the archive. Like file_exists(), the parameter
* `addDir($placementLocation, $filesystemLocation)` Alias for addFile, in case anyone has angst about using
* `add($item)` Add a file or directory, or list of same to the archive.

View File

@@ -0,0 +1,163 @@
# Assets Tasks
## ImageMinify
Minifies images. When the required minifier is not installed on the system
the task will try to download it from the [imagemin](https://github.com/imagemin) repository.
When the task is run without any specified minifier it will compress the images
based on the extension.
```php
$this->taskImageMinify('assets/images/*')
->to('dist/images/')
->run();
```
This will use the following minifiers:
- PNG: optipng
- GIF: gifsicle
- JPG, JPEG: jpegtran
- SVG: svgo
When the minifier is specified the task will use that for all the input files. In that case
it is useful to filter the files with the extension:
```php
$this->taskImageMinify('assets/images/*.png')
->to('dist/images/')
->minifier('pngcrush');
->run();
```
The task supports the following minifiers:
- optipng
- pngquant
- advpng
- pngout
- zopflipng
- pngcrush
- gifsicle
- jpegoptim
- jpeg-recompress
- jpegtran
- svgo (only minification, no downloading)
You can also specifiy extra options for the minifiers:
```php
$this->taskImageMinify('assets/images/*.jpg')
->to('dist/images/')
->minifier('jpegtran', ['-progressive' => null, '-copy' => 'none'])
->run();
```
This will execute as:
`jpegtran -copy none -progressive -optimize -outfile "dist/images/test.jpg" "/var/www/test/assets/images/test.jpg"`
* `to($target)` Sets the target directory where the files will be copied to.
* `minifier($minifier, array $options = Array ( ) )` Sets the minifier.
## Less
Compiles less files.
```php
<?php
$this->taskLess([
'less/default.less' => 'css/default.css'
])
->run();
?>
```
Use one of both less compilers in your project:
```
"leafo/lessphp": "~0.5",
"oyejorge/less.php": "~1.5"
```
Specify directory (string or array) for less imports lookup:
```php
<?php
$this->taskLess([
'less/default.less' => 'css/default.css'
])
->importDir('less')
->compiler('lessphp')
->run();
?>
```
You can implement additional compilers by extending this task and adding a
method named after them and overloading the lessCompilers() method to
inject the name there.
* `importDir($dirs)` Sets import directories
* `addImportPath($dir)` Adds import directory
* `setImportPaths($dirs)` Sets import directories
* `setFormatter($formatterName)` * `param string` $formatterName
* `compiler($compiler, array $options = Array ( ) )` Sets the compiler.
## Minify
Minifies asset file (CSS or JS).
``` php
<?php
$this->taskMinify( 'web/assets/theme.css' )
->run()
?>
```
Please install additional dependencies to use:
```
"patchwork/jsqueeze": "~1.0",
"natxet/CssMin": "~3.0"
```
* `to($dst)` Sets destination. Tries to guess type from it.
* `type($type)` Sets type with validation.
* `singleLine($singleLine)` Single line option for the JS minimisation.
* `keepImportantComments($keepImportantComments)` keepImportantComments option for the JS minimisation.
* `specialVarRx($specialVarRx)` specialVarRx option for the JS minimisation.
* `__toString()` @return string
## Scss
Compiles scss files.
```php
<?php
$this->taskScss([
'scss/default.scss' => 'css/default.css'
])
->importDir('assets/styles')
->run();
?>
```
Use the following scss compiler in your project:
```
"leafo/scssphp": "~0.1",
```
You can implement additional compilers by extending this task and adding a
method named after them and overloading the scssCompilers() method to
inject the name there.
* `setFormatter($formatterName)` Sets the formatter for scssphp
* `importDir($dirs)` Sets import directories
* `addImportPath($dir)` Adds import directory
* `setImportPaths($dirs)` Sets import directories
* `compiler($compiler, array $options = Array ( ) )` Sets the compiler.

View File

@@ -0,0 +1,126 @@
# Base Tasks
## Exec
Executes shell script. Closes it when running in background mode.
``` php
<?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');
}
?>
```
* `background()` Executes command in background mode (asynchronously)
* `timeout($timeout)` Stop command if it runs longer then $timeout in seconds
* `idleTimeout($timeout)` Stops command if it does not output something for a while
* `env(array $env)` Sets the environment variables for the command
* `simulate($context)` {@inheritdoc}
* `dir($dir)` Changes working directory of command
* `printed($arg)` Should command output be printed
* `arg($arg)` Pass argument to executable. Its value will be automatically escaped.
* `args($args)` Pass methods parameters as arguments to executable. Argument values
* `rawArg($arg)` Pass the provided string in its raw (as provided) form as an argument to executable.
* `option($option, $value = null)` Pass option to executable. Options are prefixed with `--` , value can be provided in second parameter.
* `optionList($option, $value = null)` Pass multiple options to executable. Value can be a string or array.
## ExecStack
Execute commands one by one in stack.
Stack can be stopped on first fail if you call `stopOnFail()`.
```php
<?php
$this->taskExecStack()
->stopOnFail()
->exec('mkdir site')
->exec('cd site')
->run();
?>
```
* `$this stopOnFail()`
* `executable($executable)` * `param string` $executable
* `exec($command)` * `param string|string[]` $command
* `stopOnFail($stopOnFail = null)` * `param bool` $stopOnFail
* `result($result)`
* `dir($dir)` Changes working directory of command
* `printed($arg)` Should command output be printed
## ParallelExec
Class ParallelExecTask
``` php
<?php
$this->taskParallelExec()
->process('php ~/demos/script.php hey')
->process('php ~/demos/script.php hoy')
->process('php ~/demos/script.php gou')
->run();
?>
```
* ` timeout(int $timeout)` stops process if it runs longer then `$timeout` (seconds)
* ` idleTimeout(int $timeout)` stops process if it does not output for time longer then `$timeout` (seconds)
* `printed($isPrinted = null)` * `param bool` $isPrinted
* `process($command)` * `param string|\Robo\Contract\CommandInterface` $command
* `timeout($timeout)` * `param int` $timeout
* `idleTimeout($idleTimeout)` * `param int` $idleTimeout
## SymfonyCommand
Executes Symfony Command
``` php
<?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)`
## Watch
Runs task when specified file or dir was changed.
Uses Lurker library.
``` php
<?php
$this->taskWatch()
->monitor('composer.json', function() {
$this->taskComposerUpdate()->run();
})->monitor('src', function() {
$this->taskExec('phpunit')->run();
})->run();
?>
```
* `monitor($paths, $callable)` * `param string|string[]` $paths

View File

@@ -0,0 +1,60 @@
# Bower Tasks
## Install
Bower Install
``` php
<?php
// simple execution
$this->taskBowerInstall()->run();
// prefer dist with custom path
$this->taskBowerInstall('path/to/my/bower')
->noDev()
->run();
?>
```
* `allowRoot()` adds `allow-root` option to bower
* `forceLatest()` adds `force-latest` option to bower
* `noDev()` adds `production` option to bower
* `offline()` adds `offline` option to bower
* `dir($dir)` Changes working directory of command
* `printed($arg)` Should command output be printed
* `arg($arg)` Pass argument to executable. Its value will be automatically escaped.
* `args($args)` Pass methods parameters as arguments to executable. Argument values
* `rawArg($arg)` Pass the provided string in its raw (as provided) form as an argument to executable.
* `option($option, $value = null)` Pass option to executable. Options are prefixed with `--` , value can be provided in second parameter.
* `optionList($option, $value = null)` Pass multiple options to executable. Value can be a string or array.
## Update
Bower Update
``` php
<?php
// simple execution
$this->taskBowerUpdate->run();
// prefer dist with custom path
$this->taskBowerUpdate('path/to/my/bower')
->noDev()
->run();
?>
```
* `allowRoot()` adds `allow-root` option to bower
* `forceLatest()` adds `force-latest` option to bower
* `noDev()` adds `production` option to bower
* `offline()` adds `offline` option to bower
* `dir($dir)` Changes working directory of command
* `printed($arg)` Should command output be printed
* `arg($arg)` Pass argument to executable. Its value will be automatically escaped.
* `args($args)` Pass methods parameters as arguments to executable. Argument values
* `rawArg($arg)` Pass the provided string in its raw (as provided) form as an argument to executable.
* `option($option, $value = null)` Pass option to executable. Options are prefixed with `--` , value can be provided in second parameter.
* `optionList($option, $value = null)` Pass multiple options to executable. Value can be a string or array.

View File

@@ -0,0 +1,179 @@
# Composer Tasks
## DumpAutoload
Composer Dump Autoload
``` php
<?php
// simple execution
$this->taskComposerDumpAutoload()->run();
// dump auto loader with custom path
$this->taskComposerDumpAutoload('path/to/my/composer.phar')
->preferDist()
->run();
// optimize autoloader dump with custom path
$this->taskComposerDumpAutoload('path/to/my/composer.phar')
->optimize()
->run();
// optimize autoloader dump with custom path and no dev
$this->taskComposerDumpAutoload('path/to/my/composer.phar')
->optimize()
->noDev()
->run();
?>
```
* `optimize()` * `return` $this
* `preferDist()` adds `prefer-dist` option to composer
* `preferSource()` adds `prefer-source` option to composer
* `noDev()` adds `no-dev` option to composer
* `noAnsi()` adds `no-ansi` option to composer
* `ansi()` adds `ansi` option to composer
* `optimizeAutoloader()` adds `optimize-autoloader` option to composer
* `dir($dir)` Changes working directory of command
* `printed($arg)` Should command output be printed
* `arg($arg)` Pass argument to executable. Its value will be automatically escaped.
* `args($args)` Pass methods parameters as arguments to executable. Argument values
* `rawArg($arg)` Pass the provided string in its raw (as provided) form as an argument to executable.
* `option($option, $value = null)` Pass option to executable. Options are prefixed with `--` , value can be provided in second parameter.
* `optionList($option, $value = null)` Pass multiple options to executable. Value can be a string or array.
## Install
Composer Install
``` php
<?php
// simple execution
$this->taskComposerInstall()->run();
// prefer dist with custom path
$this->taskComposerInstall('path/to/my/composer.phar')
->preferDist()
->run();
// optimize autoloader with custom path
$this->taskComposerInstall('path/to/my/composer.phar')
->optimizeAutoloader()
->run();
?>
```
* `preferDist()` adds `prefer-dist` option to composer
* `preferSource()` adds `prefer-source` option to composer
* `noDev()` adds `no-dev` option to composer
* `noAnsi()` adds `no-ansi` option to composer
* `ansi()` adds `ansi` option to composer
* `optimizeAutoloader()` adds `optimize-autoloader` option to composer
* `dir($dir)` Changes working directory of command
* `printed($arg)` Should command output be printed
* `arg($arg)` Pass argument to executable. Its value will be automatically escaped.
* `args($args)` Pass methods parameters as arguments to executable. Argument values
* `rawArg($arg)` Pass the provided string in its raw (as provided) form as an argument to executable.
* `option($option, $value = null)` Pass option to executable. Options are prefixed with `--` , value can be provided in second parameter.
* `optionList($option, $value = null)` Pass multiple options to executable. Value can be a string or array.
## Remove
Composer Validate
``` php
<?php
// simple execution
$this->taskComposerValidate()->run();
?>
```
* `dev()` * `return` $this
* `noProgress()` * `return` $this
* `noUpdate()` * `return` $this
* `updateNoDev()` * `return` $this
* `noUpdateWithDependencies()` * `return` $this
* `preferDist()` adds `prefer-dist` option to composer
* `preferSource()` adds `prefer-source` option to composer
* `noDev()` adds `no-dev` option to composer
* `noAnsi()` adds `no-ansi` option to composer
* `ansi()` adds `ansi` option to composer
* `optimizeAutoloader()` adds `optimize-autoloader` option to composer
* `dir($dir)` Changes working directory of command
* `printed($arg)` Should command output be printed
* `arg($arg)` Pass argument to executable. Its value will be automatically escaped.
* `args($args)` Pass methods parameters as arguments to executable. Argument values
* `rawArg($arg)` Pass the provided string in its raw (as provided) form as an argument to executable.
* `option($option, $value = null)` Pass option to executable. Options are prefixed with `--` , value can be provided in second parameter.
* `optionList($option, $value = null)` Pass multiple options to executable. Value can be a string or array.
## Update
Composer Update
``` php
<?php
// simple execution
$this->taskComposerUpdate()->run();
// prefer dist with custom path
$this->taskComposerUpdate('path/to/my/composer.phar')
->preferDist()
->run();
// optimize autoloader with custom path
$this->taskComposerUpdate('path/to/my/composer.phar')
->optimizeAutoloader()
->run();
?>
```
* `preferDist()` adds `prefer-dist` option to composer
* `preferSource()` adds `prefer-source` option to composer
* `noDev()` adds `no-dev` option to composer
* `noAnsi()` adds `no-ansi` option to composer
* `ansi()` adds `ansi` option to composer
* `optimizeAutoloader()` adds `optimize-autoloader` option to composer
* `dir($dir)` Changes working directory of command
* `printed($arg)` Should command output be printed
* `arg($arg)` Pass argument to executable. Its value will be automatically escaped.
* `args($args)` Pass methods parameters as arguments to executable. Argument values
* `rawArg($arg)` Pass the provided string in its raw (as provided) form as an argument to executable.
* `option($option, $value = null)` Pass option to executable. Options are prefixed with `--` , value can be provided in second parameter.
* `optionList($option, $value = null)` Pass multiple options to executable. Value can be a string or array.
## Validate
Composer Validate
``` php
<?php
// simple execution
$this->taskComposerValidate()->run();
?>
```
* `noCheckAll()` * `return` $this
* `noCheckLock()` * `return` $this
* `noCheckPublish()` * `return` $this
* `withDependencies()` * `return` $this
* `strict()` * `return` $this
* `preferDist()` adds `prefer-dist` option to composer
* `preferSource()` adds `prefer-source` option to composer
* `noDev()` adds `no-dev` option to composer
* `noAnsi()` adds `no-ansi` option to composer
* `ansi()` adds `ansi` option to composer
* `optimizeAutoloader()` adds `optimize-autoloader` option to composer
* `dir($dir)` Changes working directory of command
* `printed($arg)` Should command output be printed
* `arg($arg)` Pass argument to executable. Its value will be automatically escaped.
* `args($args)` Pass methods parameters as arguments to executable. Argument values
* `rawArg($arg)` Pass the provided string in its raw (as provided) form as an argument to executable.
* `option($option, $value = null)` Pass option to executable. Options are prefixed with `--` , value can be provided in second parameter.
* `optionList($option, $value = null)` Pass multiple options to executable. Value can be a string or array.

View File

@@ -0,0 +1,282 @@
# Development Tasks
## Changelog
Helps to manage changelog file.
Creates or updates `changelog.md` file with recent changes in current version.
``` php
<?php
$version = "0.1.0";
$this->taskChangelog()
->version($version)
->change("released to github")
->run();
?>
```
Changes can be asked from Console
``` php
<?php
$this->taskChangelog()
->version($version)
->askForChanges()
->run();
?>
```
* `Development\Changelog filename(string $filename)`
* `Development\Changelog anchor(string $anchor)`
* `Development\Changelog version(string $version)`
* `filename($filename)` * `param string` $filename
* `log($item)` * `param string` $item
* `anchor($anchor)` * `param string` $anchor
* `version($version)` * `param string` $version
* `changes(array $data)` * `param array` $data
* `change($change)` * `param string` $change
* `getChanges()` @return array
## GenerateMarkdownDoc
Simple documentation generator from source files.
Takes classes, properties and methods with their docblocks and writes down a markdown file.
``` php
<?php
$this->taskGenDoc('models.md')
->docClass('Model\User') // take class Model\User
->docClass('Model\Post') // take class Model\Post
->filterMethods(function(\ReflectionMethod $r) {
return $r->isPublic() or $r->isProtected(); // process public and protected methods
})->processClass(function(\ReflectionClass $r, $text) {
return "Class ".$r->getName()."\n\n$text\n\n###Methods\n";
})->run();
```
By default this task generates a documentation for each public method of a class.
It combines method signature with a docblock. Both can be post-processed.
``` php
<?php
$this->taskGenDoc('models.md')
->docClass('Model\User')
->processClassSignature(false) // false can be passed to not include class signature
->processClassDocBlock(function(\ReflectionClass $r, $text) {
return "[This is part of application model]\n" . $text;
})->processMethodSignature(function(\ReflectionMethod $r, $text) {
return "#### {$r->name}()";
})->processMethodDocBlock(function(\ReflectionMethod $r, $text) {
return strpos($r->name, 'save')===0 ? "[Saves to the database]\n" . $text : $text;
})->run();
```
* ` docClass(string $classname)` put a class you want to be documented
* ` filterMethods(\Closure $func)` using callback function filter out methods that won't be documented
* ` filterClasses(\Closure $func)` using callback function filter out classes that won't be documented
* ` filterProperties(\Closure $func)` using callback function filter out properties that won't be documented
* ` processClass(\Closure $func)` post-process class documentation
* ` processClassSignature(\Closure $func)` post-process class signature. Provide *false* to skip.
* ` processClassDocBlock(\Closure $func)` post-process class docblock contents. Provide *false* to skip.
* ` processMethod(\Closure $func)` post-process method documentation. Provide *false* to skip.
* ` processMethodSignature(\Closure $func)` post-process method signature. Provide *false* to skip.
* ` processMethodDocBlock(\Closure $func)` post-process method docblock contents. Provide *false* to skip.
* ` processProperty(\Closure $func)` post-process property documentation. Provide *false* to skip.
* ` processPropertySignature(\Closure $func)` post-process property signature. Provide *false* to skip.
* ` processPropertyDocBlock(\Closure $func)` post-process property docblock contents. Provide *false* to skip.
* ` reorder(\Closure $func)` use a function to reorder classes
* ` reorderMethods(\Closure $func)` use a function to reorder methods in class
* ` prepend($text)` inserts text into beginning of markdown file
* ` append($text)` inserts text in the end of markdown file
* `docClass($item)` * `param string` $item
* `filterMethods($filterMethods)` * `param callable` $filterMethods
* `filterClasses($filterClasses)` * `param callable` $filterClasses
* `filterProperties($filterProperties)` * `param callable` $filterProperties
* `processClass($processClass)` * `param callable` $processClass
* `processClassSignature($processClassSignature)` * `param callable|false` $processClassSignature
* `processClassDocBlock($processClassDocBlock)` * `param callable|false` $processClassDocBlock
* `processMethod($processMethod)` * `param callable|false` $processMethod
* `processMethodSignature($processMethodSignature)` * `param callable|false` $processMethodSignature
* `processMethodDocBlock($processMethodDocBlock)` * `param callable|false` $processMethodDocBlock
* `processProperty($processProperty)` * `param callable|false` $processProperty
* `processPropertySignature($processPropertySignature)` * `param callable|false` $processPropertySignature
* `processPropertyDocBlock($processPropertyDocBlock)` * `param callable|false` $processPropertyDocBlock
* `reorder($reorder)` * `param callable` $reorder
* `reorderMethods($reorderMethods)` * `param callable` $reorderMethods
* `reorderProperties($reorderProperties)` * `param callable` $reorderProperties
* `filename($filename)` * `param string` $filename
* `prepend($prepend)` * `param string` $prepend
* `append($append)` * `param string` $append
* `text($text)` * `param string` $text
* `textForClass($item)` * `param string` $item
## Generate
Generate a Robo Task that is a wrapper around an existing class.
``` php
<?php
$this->taskGenerateTask('Symfony\Component\Filesystem\Filesystem', 'FilesystemStack')
->run();
```
## GitHubRelease
Publishes new GitHub release.
``` php
<?php
$this->taskGitHubRelease('0.1.0')
->uri('consolidation-org/Robo')
->description('Add stuff people need.')
->change('Fix #123')
->change('Add frobulation method to all widgets')
->run();
?>
```
* `tag($tag)` * `param string` $tag
* `draft($draft)` * `param bool` $draft
* `name($name)` * `param string` $name
* `description($description)` * `param string` $description
* `prerelease($prerelease)` * `param bool` $prerelease
* `comittish($comittish)` * `param string` $comittish
* `appendDescription($description)` * `param string` $description
* `changes(array $changes)`
* `change($change)` * `param string` $change
* `repo($repo)` * `param string` $repo
* `owner($owner)` * `param string` $owner
* `uri($uri)` * `param string` $uri
* `user($user)` * `param string` $user
* `password($password)` * `param` $password
## OpenBrowser
Opens the default's user browser
code inspired from openBrowser() function in https://github.com/composer/composer/blob/master/src/Composer/Command/HomeCommand.php
``` php
<?php
// open one browser window
$this->taskOpenBrowser('http://localhost')
->run();
// open two browser windows
$this->taskOpenBrowser([
'http://localhost/mysite',
'http://localhost/mysite2'
])
->run();
```
## PackPhar
Creates Phar.
``` php
<?php
$pharTask = $this->taskPackPhar('package/codecept.phar')
->compress()
->stub('package/stub.php');
$finder = Finder::create()
->name('*.php')
->in('src');
foreach ($finder as $file) {
$pharTask->addFile('src/'.$file->getRelativePathname(), $file->getRealPath());
}
$finder = Finder::create()->files()
->name('*.php')
->in('vendor');
foreach ($finder as $file) {
$pharTask->addStripped('vendor/'.$file->getRelativePathname(), $file->getRealPath());
}
$pharTask->run();
// verify Phar is packed correctly
$code = $this->_exec('php package/codecept.phar');
?>
```
* `compress($compress = null)` * `param bool` $compress
* `stub($stub)` * `param string` $stub
* `addStripped($path, $file)` * `param string` $path
* `addFile($path, $file)` * `param string` $path
* `addFiles($files)` * `param \Symfony\Component\Finder\SplFileInfo[]` $files
* `executable($file)` * `param string` $file
## PhpServer
Runs PHP server and stops it when task finishes.
``` php
<?php
// run server in /public directory
$this->taskServer(8000)
->dir('public')
->run();
// run with IP 0.0.0.0
$this->taskServer(8000)
->host('0.0.0.0')
->run();
// execute server in background
$this->taskServer(8000)
->background()
->run();
?>
```
* `host($host)` * `param string` $host
* `dir($path)` * `param string` $path
* `background()` Executes command in background mode (asynchronously)
* `timeout($timeout)` Stop command if it runs longer then $timeout in seconds
* `idleTimeout($timeout)` Stops command if it does not output something for a while
* `env(array $env)` Sets the environment variables for the command
* `simulate($context)` {@inheritdoc}
* `printed($arg)` Should command output be printed
* `arg($arg)` Pass argument to executable. Its value will be automatically escaped.
* `args($args)` Pass methods parameters as arguments to executable. Argument values
* `rawArg($arg)` Pass the provided string in its raw (as provided) form as an argument to executable.
* `option($option, $value = null)` Pass option to executable. Options are prefixed with `--` , value can be provided in second parameter.
* `optionList($option, $value = null)` Pass multiple options to executable. Value can be a string or array.
## SemVer
Helps to maintain `.semver` file.
```php
<?php
$this->taskSemVer('.semver')
->increment()
->run();
?>
```
* `__toString()` @return string
* `setFormat($format)` * `param string` $format
* `setMetadataSeparator($separator)` * `param string` $separator
* `setPrereleaseSeparator($separator)` * `param string` $separator
* `increment($what = null)` * `param string` $what
* `prerelease($tag = null)` * `param string` $tag
* `metadata($data)` * `param array|string` $data

View File

@@ -0,0 +1,249 @@
# Docker Tasks
## Build
Builds Docker image
```php
<?php
$this->taskDockerBuild()->run();
$this->taskDockerBuild('path/to/dir')
->tag('database')
->run();
?>
```
Class Build
@package Robo\Task\Docker
* `tag($tag)` * `param string` $tag
* `dir($dir)` Changes working directory of command
* `printed($arg)` Should command output be printed
* `arg($arg)` Pass argument to executable. Its value will be automatically escaped.
* `args($args)` Pass methods parameters as arguments to executable. Argument values
* `rawArg($arg)` Pass the provided string in its raw (as provided) form as an argument to executable.
* `option($option, $value = null)` Pass option to executable. Options are prefixed with `--` , value can be provided in second parameter.
* `optionList($option, $value = null)` Pass multiple options to executable. Value can be a string or array.
## Commit
Commits docker container to an image
```
$this->taskDockerCommit($containerId)
->name('my/database')
->run();
// alternatively you can take the result from DockerRun task:
$result = $this->taskDockerRun('db')
->exec('./prepare_database.sh')
->run();
$task->dockerCommit($result)
->name('my/database')
->run();
```
* `name($name)` * `param` $name
* `dir($dir)` Changes working directory of command
* `printed($arg)` Should command output be printed
* `arg($arg)` Pass argument to executable. Its value will be automatically escaped.
* `args($args)` Pass methods parameters as arguments to executable. Argument values
* `rawArg($arg)` Pass the provided string in its raw (as provided) form as an argument to executable.
* `option($option, $value = null)` Pass option to executable. Options are prefixed with `--` , value can be provided in second parameter.
* `optionList($option, $value = null)` Pass multiple options to executable. Value can be a string or array.
## Exec
Executes command inside running Docker container
```php
<?php
$test = $this->taskDockerRun('test_env')
->detached()
->run();
$this->taskDockerExec($test)
->interactive()
->exec('./runtests')
->run();
// alternatively use commands from other tasks
$this->taskDockerExec($test)
->interactive()
->exec($this->taskCodecept()->suite('acceptance'))
->run();
?>
```
* `detached()` * `return` $this
* `interactive()` * `return` $this
* `exec($command)` * `param string|\Robo\Contract\CommandInterface` $command
* `dir($dir)` Changes working directory of command
* `printed($arg)` Should command output be printed
* `arg($arg)` Pass argument to executable. Its value will be automatically escaped.
* `args($args)` Pass methods parameters as arguments to executable. Argument values
* `rawArg($arg)` Pass the provided string in its raw (as provided) form as an argument to executable.
* `option($option, $value = null)` Pass option to executable. Options are prefixed with `--` , value can be provided in second parameter.
* `optionList($option, $value = null)` Pass multiple options to executable. Value can be a string or array.
## Pull
Pulls an image from DockerHub
```php
<?php
$this->taskDockerPull('wordpress')
->run();
?>
```
* `dir($dir)` Changes working directory of command
* `printed($arg)` Should command output be printed
* `arg($arg)` Pass argument to executable. Its value will be automatically escaped.
* `args($args)` Pass methods parameters as arguments to executable. Argument values
* `rawArg($arg)` Pass the provided string in its raw (as provided) form as an argument to executable.
* `option($option, $value = null)` Pass option to executable. Options are prefixed with `--` , value can be provided in second parameter.
* `optionList($option, $value = null)` Pass multiple options to executable. Value can be a string or array.
## Remove
Remove docker container
```php
<?php
$this->taskDockerRemove($container)
->run();
?>
```
* `dir($dir)` Changes working directory of command
* `printed($arg)` Should command output be printed
* `arg($arg)` Pass argument to executable. Its value will be automatically escaped.
* `args($args)` Pass methods parameters as arguments to executable. Argument values
* `rawArg($arg)` Pass the provided string in its raw (as provided) form as an argument to executable.
* `option($option, $value = null)` Pass option to executable. Options are prefixed with `--` , value can be provided in second parameter.
* `optionList($option, $value = null)` Pass multiple options to executable. Value can be a string or array.
## Run
Performs `docker run` on a container.
```php
<?php
$this->taskDockerRun('mysql')->run();
$result = $this->taskDockerRun('my_db_image')
->env('DB', 'database_name')
->volume('/path/to/data', '/data')
->detached()
->publish(3306)
->name('my_mysql')
->run();
// retrieve container's cid:
$this->say("Running container ".$result->getCid());
// execute script inside container
$result = $this->taskDockerRun('db')
->exec('prepare_test_data.sh')
->run();
$this->taskDockerCommit($result)
->name('test_db')
->run();
// link containers
$mysql = $this->taskDockerRun('mysql')
->name('wp_db') // important to set name for linked container
->env('MYSQL_ROOT_PASSWORD', '123456')
->run();
$this->taskDockerRun('wordpress')
->link($mysql)
->publish(80, 8080)
->detached()
->run();
?>
```
* `detached()` * `return` $this
* `interactive()` * `return` $this
* `exec($run)` * `param string|\Robo\Contract\CommandInterface` $run
* `volume($from, $to = null)` * `param string` $from
* `env($variable, $value = null)` * `param string` $variable
* `publish($port = null, $portTo = null)` * `param null|int` $port
* `containerWorkdir($dir)` * `param string` $dir
* `user($user)` * `param string` $user
* `privileged()` * `return` $this
* `name($name)` * `param string` $name
* `link($name, $alias)` * `param string|\Robo\Task\Docker\Result` $name
* `tmpDir($dir)` * `param string` $dir
* `getTmpDir()` @return string
* `getUniqId()` @return string
* `dir($dir)` Changes working directory of command
* `printed($arg)` Should command output be printed
* `arg($arg)` Pass argument to executable. Its value will be automatically escaped.
* `args($args)` Pass methods parameters as arguments to executable. Argument values
* `rawArg($arg)` Pass the provided string in its raw (as provided) form as an argument to executable.
* `option($option, $value = null)` Pass option to executable. Options are prefixed with `--` , value can be provided in second parameter.
* `optionList($option, $value = null)` Pass multiple options to executable. Value can be a string or array.
## Start
Starts Docker container
```php
<?php
$this->taskDockerStart($cidOrResult)
->run();
?>
```
* `dir($dir)` Changes working directory of command
* `printed($arg)` Should command output be printed
* `arg($arg)` Pass argument to executable. Its value will be automatically escaped.
* `args($args)` Pass methods parameters as arguments to executable. Argument values
* `rawArg($arg)` Pass the provided string in its raw (as provided) form as an argument to executable.
* `option($option, $value = null)` Pass option to executable. Options are prefixed with `--` , value can be provided in second parameter.
* `optionList($option, $value = null)` Pass multiple options to executable. Value can be a string or array.
## Stop
Stops Docker container
```php
<?php
$this->taskDockerStop($cidOrResult)
->run();
?>
```
* `dir($dir)` Changes working directory of command
* `printed($arg)` Should command output be printed
* `arg($arg)` Pass argument to executable. Its value will be automatically escaped.
* `args($args)` Pass methods parameters as arguments to executable. Argument values
* `rawArg($arg)` Pass the provided string in its raw (as provided) form as an argument to executable.
* `option($option, $value = null)` Pass option to executable. Options are prefixed with `--` , value can be provided in second parameter.
* `optionList($option, $value = null)` Pass multiple options to executable. Value can be a string or array.

View File

@@ -0,0 +1,129 @@
# File Tasks
## Concat
Merges files into one. Used for preparing assets.
``` php
<?php
$this->taskConcat([
'web/assets/screen.css',
'web/assets/print.css',
'web/assets/theme.css'
])
->to('web/assets/style.css')
->run()
?>
```
* `to($dst)` set the destination file
## Replace
Performs search and replace inside a files.
``` php
<?php
$this->taskReplaceInFile('VERSION')
->from('0.2.0')
->to('0.3.0')
->run();
$this->taskReplaceInFile('README.md')
->from(date('Y')-1)
->to(date('Y'))
->run();
$this->taskReplaceInFile('config.yml')
->regex('~^service:~')
->to('services:')
->run();
$this->taskReplaceInFile('box/robo.txt')
->from(array('##dbname##', '##dbhost##'))
->to(array('robo', 'localhost'))
->run();
?>
```
* `regex(string)` regex to match string to be replaced
* `from(string|array)` string(s) to be replaced
* `to(string|array)` value(s) to be set as a replacement
* `filename($filename)` * `param string` $filename
* `from($from)` * `param string` $from
* `to($to)` * `param string` $to
* `regex($regex)` * `param string` $regex
## TmpFile
Create a temporary file that is automatically cleaned up
once the task collection is is part of completes. When created,
it is given a random filename.
This temporary file may be manipulated exacatly like taskWrite().
It is deleted as soon as the collection it is a part of completes
or rolls back.
``` php
<?php
$collection = $this->collectionBuilder();
$tmpFilePath = $collection->taskTmpFile()
->line('-----')
->line(date('Y-m-d').' '.$title)
->line('----')
->getPath();
$collection->run();
?>
```
* `complete()` Delete this file when our collection completes.
* `filename($filename)` * `param string` $filename
* `append($append = null)` * `param bool` $append
* `line($line)` add a line.
* `lines(array $lines)` add more lines.
* `text($text)` add a text.
* `textFromFile($filename)` add a text from a file.
* `place($name, $val)` substitute a placeholder with value, placeholder must be enclosed by `{}`.
* `replace($string, $replacement)` replace any string with value.
* `regexReplace($pattern, $replacement)` replace any string with value using regular expression.
* `appendIfMatches($pattern, $text)` Append the provided text to the end of the buffer if the provided
* `appendUnlessMatches($pattern, $text)` Append the provided text to the end of the buffer unless the provided
* `originalContents()` @return string
* `wouldChange()` @return bool
* `getPath()` @return string
## Write
Writes to file.
``` php
<?php
$this->taskWriteToFile('blogpost.md')
->line('-----')
->line(date('Y-m-d').' '.$title)
->line('----')
->run();
?>
```
* `append()`
* `filename($filename)` * `param string` $filename
* `append($append = null)` * `param bool` $append
* `line($line)` add a line.
* `lines(array $lines)` add more lines.
* `text($text)` add a text.
* `textFromFile($filename)` add a text from a file.
* `place($name, $val)` substitute a placeholder with value, placeholder must be enclosed by `{}`.
* `replace($string, $replacement)` replace any string with value.
* `regexReplace($pattern, $replacement)` replace any string with value using regular expression.
* `appendIfMatches($pattern, $text)` Append the provided text to the end of the buffer if the provided
* `appendUnlessMatches($pattern, $text)` Append the provided text to the end of the buffer unless the provided
* `originalContents()` @return string
* `wouldChange()` @return bool
* `getPath()` @return string

View File

@@ -0,0 +1,217 @@
# Filesystem Tasks
## CleanDir
Deletes all files from specified dir, ignoring git files.
``` php
<?php
$this->taskCleanDir(['tmp','logs'])->run();
// as shortcut
$this->_cleanDir('app/cache');
?>
```
## CopyDir
Copies one dir into another
``` php
<?php
$this->taskCopyDir(['dist/config' => 'config'])->run();
// as shortcut
$this->_copyDir('dist/config', 'config');
?>
```
* `dirPermissions($value)` Sets the default folder permissions for the destination if it doesn't exist
* `exclude($exclude = null)` List files to exclude.
## DeleteDir
Deletes dir
``` php
<?php
$this->taskDeleteDir('tmp')->run();
// as shortcut
$this->_deleteDir(['tmp', 'log']);
?>
```
## FilesystemStack
Wrapper for [Symfony Filesystem](http://symfony.com/doc/current/components/filesystem.html) Component.
Comands are executed in stack and can be stopped on first fail with `stopOnFail` option.
``` php
<?php
$this->taskFilesystemStack()
->mkdir('logs')
->touch('logs/.gitignore')
->chgrp('www', 'www-data')
->symlink('/var/log/nginx/error.log', 'logs/error.log')
->run();
// one line
$this->_touch('.gitignore');
$this->_mkdir('logs');
?>
```
* `$this mkdir($dir)`
* `$this touch($file)`
* `$this copy($from, $to, $force = null)`
* `$this chmod($file, $permissions, $umask = null, $recursive = null)`
* `$this chgrp($file, $group, $recursive = null)`
* `$this chown($file, $user, $recursive = null)`
* `$this remove($file)`
* `$this rename($from, $to)`
* `$this symlink($from, $to)`
* `$this mirror($from, $to)`
* `stopOnFail($stop = null)` * `param bool` $stop
## FlattenDir
Searches for files in a nested directory structure and copies them to
a target directory with or without the parent directories. The task was
inspired by [gulp-flatten](https://www.npmjs.com/package/gulp-flatten).
Example directory structure:
```
└── assets
├── asset-library1
│ ├── README.md
│ └── asset-library1.min.js
└── asset-library2
├── README.md
└── asset-library2.min.js
```
The following code will search the `*.min.js` files and copy them
inside a new `dist` folder:
``` php
<?php
$this->taskFlattenDir(['assets/*.min.js' => 'dist'])->run();
// or use shortcut
$this->_flattenDir('assets/*.min.js', 'dist');
?>
```
You can also define the target directory with an additional method, instead of
key/value pairs. More similar to the gulp-flatten syntax:
``` php
<?php
$this->taskFlattenDir(['assets/*.min.js'])
->to('dist')
->run();
?>
```
You can also append parts of the parent directories to the target path. If you give
the value `1` to the `includeParents()` method, then the top parent will be appended
to the target directory resulting in a path such as `dist/assets/asset-library1.min.js`.
If you give a negative number, such as `-1` (the same as specifying `array(0, 1)` then
the bottom parent will be appended, resulting in a path such as
`dist/asset-library1/asset-library1.min.js`.
The top parent directory will always be starting from the relative path to the current
directory. You can override that with the `parentDir()` method. If in the above example
you would specify `assets`, then the top parent directory would be `asset-library1`.
``` php
<?php
$this->taskFlattenDir(['assets/*.min.js' => 'dist'])
->parentDir('assets')
->includeParents(1)
->run();
?>
```
* `dirPermissions($permission)` Sets the default folder permissions for the destination if it does not exist.
* `includeParents($parents)` Sets the value from which direction and how much parent dirs should be included.
* `parentDir($dir)` Sets the parent directory from which the relative parent directories will be calculated.
* `to($target)` Sets the target directory where the files will be copied to.
## MirrorDir
Mirrors a directory to another
``` php
<?php
$this->taskMirrorDir(['dist/config/' => 'config/'])->run();
// or use shortcut
$this->_mirrorDir('dist/config/', 'config/');
?>
```
## TmpDir
Create a temporary directory that is automatically cleaned up
once the task collection is is part of completes.
Use WorkDir if you do not want the directory to be deleted.
``` php
<?php
// Delete on rollback or on successful completion.
// Note that in this example, everything is deleted at
// the end of $collection->run().
$collection = $this->collectionBuilder();
$tmpPath = $collection->tmpDir()->getPath();
$collection->taskFilesystemStack()
->mkdir("$tmpPath/log")
->touch("$tmpPath/log/error.txt");
$collection->run();
// as shortcut (deleted when program exits)
$tmpPath = $this->_tmpDir();
?>
```
* `cwd($shouldChangeWorkingDirectory = null)` Flag that we should cwd to the temporary directory when it is
* `complete()` Delete this directory when our collection completes.
* `getPath()` Get a reference to the path to the temporary directory, so that
## WorkDir
Create a temporary working directory that is automatically renamed to its
final desired location if all of the tasks in the collection succeed. If
there is a rollback, then the working directory is deleted.
``` php
<?php
$collection = $this->collectionBuilder();
$workingPath = $collection->workDir("build")->getPath();
$collection->taskFilesystemStack()
->mkdir("$workingPath/log")
->touch("$workingPath/log/error.txt");
$collection->run();
?>
```
* `complete()` Move our working directory into its final destination once the
* `rollback()` Delete our working directory
* `getPath()` Get a reference to the path to the temporary directory, so that
* `cwd($shouldChangeWorkingDirectory = null)` Flag that we should cwd to the temporary directory when it is

View File

@@ -0,0 +1,31 @@
# Gulp Tasks
## Run
Gulp Run
``` php
<?php
// simple execution
$this->taskGulpRun()->run();
// run task 'clean' with --silent option
$this->taskGulpRun('clean')
->silent()
->run();
?>
```
* `silent()` adds `silent` option to gulp
* `noColor()` adds `--no-color` option to gulp
* `color()` adds `--color` option to gulp
* `simple()` adds `--tasks-simple` option to gulp
* `dir($dir)` Changes working directory of command
* `printed($arg)` Should command output be printed
* `arg($arg)` Pass argument to executable. Its value will be automatically escaped.
* `args($args)` Pass methods parameters as arguments to executable. Argument values
* `rawArg($arg)` Pass the provided string in its raw (as provided) form as an argument to executable.
* `option($option, $value = null)` Pass option to executable. Options are prefixed with `--` , value can be provided in second parameter.
* `optionList($option, $value = null)` Pass multiple options to executable. Value can be a string or array.

View File

@@ -0,0 +1,54 @@
# Npm Tasks
## Install
Npm Install
``` php
<?php
// simple execution
$this->taskNpmInstall()->run();
// prefer dist with custom path
$this->taskNpmInstall('path/to/my/npm')
->noDev()
->run();
?>
```
* `noDev()` adds `production` option to npm
* `dir($dir)` Changes working directory of command
* `printed($arg)` Should command output be printed
* `arg($arg)` Pass argument to executable. Its value will be automatically escaped.
* `args($args)` Pass methods parameters as arguments to executable. Argument values
* `rawArg($arg)` Pass the provided string in its raw (as provided) form as an argument to executable.
* `option($option, $value = null)` Pass option to executable. Options are prefixed with `--` , value can be provided in second parameter.
* `optionList($option, $value = null)` Pass multiple options to executable. Value can be a string or array.
## Update
Npm Update
```php
<?php
// simple execution
$this->taskNpmUpdate()->run();
// prefer dist with custom path
$this->taskNpmUpdate('path/to/my/npm')
->noDev()
->run();
?>
```
* `noDev()` adds `production` option to npm
* `dir($dir)` Changes working directory of command
* `printed($arg)` Should command output be printed
* `arg($arg)` Pass argument to executable. Its value will be automatically escaped.
* `args($args)` Pass methods parameters as arguments to executable. Argument values
* `rawArg($arg)` Pass the provided string in its raw (as provided) form as an argument to executable.
* `option($option, $value = null)` Pass option to executable. Options are prefixed with `--` , value can be provided in second parameter.
* `optionList($option, $value = null)` Pass multiple options to executable. Value can be a string or array.

View File

@@ -0,0 +1,143 @@
# Remote Tasks
## Rsync
Executes rsync in a flexible manner.
``` php
$this->taskRsync()
->fromPath('src/')
->toHost('localhost')
->toUser('dev')
->toPath('/var/www/html/app/')
->remoteShell('ssh -i public_key')
->recursive()
->excludeVcs()
->checksum()
->wholeFile()
->verbose()
->progress()
->humanReadable()
->stats()
->run();
```
You could also clone the task and do a dry-run first:
``` php
$rsync = $this->taskRsync()
->fromPath('src/')
->toPath('example.com:/var/www/html/app/')
->archive()
->excludeVcs()
->progress()
->stats();
$dryRun = clone $rsync;
$dryRun->dryRun()->run();
if ('y' === $this->ask('Do you want to run (y/n)')) {
$rsync->run();
}
```
* ` fromUser(string $user)`
* ` fromHost(string $hostname)`
* ` toUser(string $user)`
* ` toHost(string $hostname)`
* `fromPath($path)` This can either be a full rsync path spec (user@host:path) or just a path.
* `toPath($path)` This can either be a full rsync path spec (user@host:path) or just a path.
* `fromUser($fromUser)` * `param string` $fromUser
* `fromHost($fromHost)` * `param string` $fromHost
* `toUser($toUser)` * `param string` $toUser
* `toHost($toHost)` * `param string` $toHost
* `progress()` * `return` $this
* `stats()` * `return` $this
* `recursive()` * `return` $this
* `verbose()` * `return` $this
* `checksum()` * `return` $this
* `archive()` * `return` $this
* `compress()` * `return` $this
* `owner()` * `return` $this
* `group()` * `return` $this
* `times()` * `return` $this
* `delete()` * `return` $this
* `timeout($seconds)` * `param int` $seconds
* `humanReadable()` * `return` $this
* `wholeFile()` * `return` $this
* `dryRun()` * `return` $this
* `itemizeChanges()` * `return` $this
* `excludeVcs()` Excludes .git, .svn and .hg items at any depth.
* `exclude($pattern)` * `param array|string` $pattern
* `excludeFrom($file)` * `param string` $file
* `includeFilter($pattern)` * `param array|string` $pattern
* `filter($pattern)` * `param array|string` $pattern
* `filesFrom($file)` * `param string` $file
* `remoteShell($command)` * `param string` $command
* `dir($dir)` Changes working directory of command
* `printed($arg)` Should command output be printed
* `arg($arg)` Pass argument to executable. Its value will be automatically escaped.
* `args($args)` Pass methods parameters as arguments to executable. Argument values
* `rawArg($arg)` Pass the provided string in its raw (as provided) form as an argument to executable.
* `option($option, $value = null)` Pass option to executable. Options are prefixed with `--` , value can be provided in second parameter.
* `optionList($option, $value = null)` Pass multiple options to executable. Value can be a string or array.
## Ssh
Runs multiple commands on a remote server.
Per default, commands are combined with &&, unless stopOnFail is false.
```php
<?php
$this->taskSshExec('remote.example.com', 'user')
->remoteDir('/var/www/html')
->exec('ls -la')
->exec('chmod g+x logs')
->run();
```
You can even exec other tasks (which implement CommandInterface):
```php
$gitTask = $this->taskGitStack()
->checkout('master')
->pull();
$this->taskSshExec('remote.example.com')
->remoteDir('/var/www/html/site')
->exec($gitTask)
->run();
```
You can configure the remote directory for all future calls:
```php
::configure('remoteDir', '/some-dir');
```
* `$this stopOnFail(bool $stopOnFail)` Whether or not to chain commands together with &&
and stop the chain if one command fails
* `$this remoteDir(string $remoteWorkingDirectory)` Changes to the given directory before running commands
* `hostname($hostname)` * `param string` $hostname
* `user($user)` * `param string` $user
* `stopOnFail($stopOnFail = null)` * `param bool` $stopOnFail
* `remoteDir($remoteDir)` * `param string` $remoteDir
* `identityFile($filename)` * `param string` $filename
* `port($port)` * `param int` $port
* `forcePseudoTty()` * `return` $this
* `quiet()` * `return` $this
* `verbose()` * `return` $this
* `exec($command)` * `param string|string[]|CommandInterface` $command
* `simulate($context)` {@inheritdoc}
* `dir($dir)` Changes working directory of command
* `printed($arg)` Should command output be printed
* `arg($arg)` Pass argument to executable. Its value will be automatically escaped.
* `args($args)` Pass methods parameters as arguments to executable. Argument values
* `rawArg($arg)` Pass the provided string in its raw (as provided) form as an argument to executable.
* `option($option, $value = null)` Pass option to executable. Options are prefixed with `--` , value can be provided in second parameter.
* `optionList($option, $value = null)` Pass multiple options to executable. Value can be a string or array.

View File

@@ -0,0 +1,171 @@
# Testing Tasks
## Atoum
Runs [atoum](http://atoum.org/) tests
``` php
<?php
$this->taskAtoum()
->files('path/to/test.php')
->configFile('config/dev.php')
->run()
?>
```
* `tags($tags)` Tag or Tags to filter.
* `lightReport()` Display result using the light reporter.
* `tap()` Display result using the tap reporter.
* `bootstrap($file)` Path to the bootstrap file.
* `configFile($file)` Path to the config file.
* `debug()` Use atoum's debug mode.
* `files($files)` Test file or test files to run.
* `directories($directories)` Test directory or directories to run.
* `dir($dir)` Changes working directory of command
* `printed($arg)` Should command output be printed
* `arg($arg)` Pass argument to executable. Its value will be automatically escaped.
* `args($args)` Pass methods parameters as arguments to executable. Argument values
* `rawArg($arg)` Pass the provided string in its raw (as provided) form as an argument to executable.
* `option($option, $value = null)` Pass option to executable. Options are prefixed with `--` , value can be provided in second parameter.
* `optionList($option, $value = null)` Pass multiple options to executable. Value can be a string or array.
## Behat
Executes Behat tests
``` php
<?php
$this->taskBehat()
->format('pretty')
->noInteraction()
->run();
?>
```
* `stopOnFail()` * `return` $this
* `noInteraction()` * `return` $this
* `config($config_file)` * `param` $config_file
* `colors()` * `return` $this
* `noColors()` * `return` $this
* `suite($suite)` * `param string` $suite
* `verbose($level = null)` * `param string` $level
* `format($formater)` * `param string` $formater
* `dir($dir)` Changes working directory of command
* `printed($arg)` Should command output be printed
* `arg($arg)` Pass argument to executable. Its value will be automatically escaped.
* `args($args)` Pass methods parameters as arguments to executable. Argument values
* `rawArg($arg)` Pass the provided string in its raw (as provided) form as an argument to executable.
* `option($option, $value = null)` Pass option to executable. Options are prefixed with `--` , value can be provided in second parameter.
* `optionList($option, $value = null)` Pass multiple options to executable. Value can be a string or array.
## Codecept
Executes Codeception tests
``` php
<?php
// config
$this->taskCodecept()
->suite('acceptance')
->env('chrome')
->group('admin')
->xml()
->html()
->run();
?>
```
* `suite($suite)` * `param string` $suite
* `test($testName)` * `param string` $testName
* `group($group)` set group option. Can be called multiple times
* `excludeGroup($group)` * `param string` $group
* `json($file = null)` generate json report
* `xml($file = null)` generate xml JUnit report
* `html($dir = null)` Generate html report
* `tap($file = null)` generate tap report
* `configFile($file)` provides config file other then default `codeception.yml` with `-c` option
* `coverage($cov = null)` collect codecoverage in raw format. You may pass name of cov file to save results
* `silent()` execute in silent mode
* `coverageXml($xml = null)` collect code coverage in xml format. You may pass name of xml file to save results
* `coverageHtml($html = null)` collect code coverage and generate html report. You may pass
* `env($env)` * `param string` $env
* `debug()` * `return` $this
* `dir($dir)` Changes working directory of command
* `printed($arg)` Should command output be printed
* `arg($arg)` Pass argument to executable. Its value will be automatically escaped.
* `args($args)` Pass methods parameters as arguments to executable. Argument values
* `rawArg($arg)` Pass the provided string in its raw (as provided) form as an argument to executable.
* `option($option, $value = null)` Pass option to executable. Options are prefixed with `--` , value can be provided in second parameter.
* `optionList($option, $value = null)` Pass multiple options to executable. Value can be a string or array.
## PHPUnit
Runs PHPUnit tests
``` php
<?php
$this->taskPHPUnit()
->group('core')
->bootstrap('test/bootstrap.php')
->run()
?>
```
* `filter($filter)` * `param string` $filter
* `group($group)` * `param string` $group
* `excludeGroup($group)` * `param string` $group
* `json($file = null)` adds `log-json` option to runner
* `xml($file = null)` adds `log-junit` option
* `tap($file = null)` * `param string` $file
* `bootstrap($file)` * `param string` $file
* `configFile($file)` * `param string` $file
* `debug()` * `return` $this
* `files($files)` Directory of test files or single test file to run.
* `file($file)` Test the provided file.
* `dir($dir)` Changes working directory of command
* `printed($arg)` Should command output be printed
* `arg($arg)` Pass argument to executable. Its value will be automatically escaped.
* `args($args)` Pass methods parameters as arguments to executable. Argument values
* `rawArg($arg)` Pass the provided string in its raw (as provided) form as an argument to executable.
* `option($option, $value = null)` Pass option to executable. Options are prefixed with `--` , value can be provided in second parameter.
* `optionList($option, $value = null)` Pass multiple options to executable. Value can be a string or array.
## Phpspec
Executes Phpspec tests
``` php
<?php
$this->taskPhpspec()
->format('pretty')
->noInteraction()
->run();
?>
```
* `stopOnFail()`
* `noCodeGeneration()`
* `quiet()`
* `verbose($level = null)`
* `noAnsi()`
* `noInteraction()`
* `config($config_file)`
* `format($formater)`
* `dir($dir)` Changes working directory of command
* `printed($arg)` Should command output be printed
* `arg($arg)` Pass argument to executable. Its value will be automatically escaped.
* `args($args)` Pass methods parameters as arguments to executable. Argument values
* `rawArg($arg)` Pass the provided string in its raw (as provided) form as an argument to executable.
* `option($option, $value = null)` Pass option to executable. Options are prefixed with `--` , value can be provided in second parameter.
* `optionList($option, $value = null)` Pass multiple options to executable. Value can be a string or array.

View File

@@ -0,0 +1,108 @@
# Vcs Tasks
## GitStack
Runs Git commands in stack. You can use `stopOnFail()` to point that stack should be terminated on first fail.
``` php
<?php
$this->taskGitStack()
->stopOnFail()
->add('-A')
->commit('adding everything')
->push('origin','master')
->tag('0.6.0')
->push('origin','0.6.0')
->run()
$this->taskGitStack()
->stopOnFail()
->add('doc/*')
->commit('doc updated')
->push()
->run();
?>
```
* `cloneRepo($repo, $to = null)` Executes `git clone`
* `add($pattern)` Executes `git add` command with files to add pattern
* `commit($message, $options = null)` Executes `git commit` command with a message
* `pull($origin = null, $branch = null)` Executes `git pull` command.
* `push($origin = null, $branch = null)` Executes `git push` command
* `merge($branch)` Performs git merge
* `checkout($branch)` Executes `git checkout` command
* `tag($tag_name, $message = null)` Executes `git tag` command
* `executable($executable)` * `param string` $executable
* `exec($command)` * `param string|string[]` $command
* `stopOnFail($stopOnFail = null)` * `param bool` $stopOnFail
* `result($result)`
* `dir($dir)` Changes working directory of command
* `printed($arg)` Should command output be printed
## HgStack
Runs hg commands in stack. You can use `stopOnFail()` to point that stack should be terminated on first fail.
``` php
<?php
$this->hgStack
->cloneRepo('https://bitbucket.org/durin42/hgsubversion')
->pull()
->add()
->commit('changed')
->push()
->tag('0.6.0')
->push('0.6.0')
->run();
?>
```
* `cloneRepo($repo, $to = null)` Executes `hg clone`
* `add($include = null, $exclude = null)` Executes `hg add` command with files to add by pattern
* `commit($message, $options = null)` Executes `hg commit` command with a message
* `pull($branch = null)` Executes `hg pull` command.
* `push($branch = null)` Executes `hg push` command
* `merge($revision = null)` Performs hg merge
* `tag($tag_name, $message = null)` Executes `hg tag` command
* `executable($executable)` * `param string` $executable
* `exec($command)` * `param string|string[]` $command
* `stopOnFail($stopOnFail = null)` * `param bool` $stopOnFail
* `result($result)`
* `dir($dir)` Changes working directory of command
* `printed($arg)` Should command output be printed
## SvnStack
Runs Svn commands in stack. You can use `stopOnFail()` to point that stack should be terminated on first fail.
``` php
<?php
$this->taskSvnStack()
->checkout('http://svn.collab.net/repos/svn/trunk')
->run()
// alternatively
$this->_svnCheckout('http://svn.collab.net/repos/svn/trunk');
$this->taskSvnStack('username', 'password')
->stopOnFail()
->update()
->add('doc/*')
->commit('doc updated')
->run();
?>
```
* `update($path = null)` Updates `svn update` command
* `add($pattern = null)` Executes `svn add` command with files to add pattern
* `commit($message, $options = null)` Executes `svn commit` command with a message
* `checkout($branch)` Executes `svn checkout` command
* `executable($executable)` * `param string` $executable
* `exec($command)` * `param string|string[]` $command
* `stopOnFail($stopOnFail = null)` * `param bool` $stopOnFail
* `result($result)`
* `dir($dir)` Changes working directory of command
* `printed($arg)` Should command output be printed