Skip to content

Commit

Permalink
Merge pull request consolidation#149 from pscheit/fix-replace-in-file…
Browse files Browse the repository at this point in the history
…-docu

fix PR consolidation#128 document replaceInFile with better example
  • Loading branch information
DavertMik committed Mar 23, 2015
2 parents a01a370 + b7f7921 commit 76c4b4b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
11 changes: 8 additions & 3 deletions docs/tasks/File.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,17 @@ $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)` string to be replaced
* `to(string)` value to be set as a replacement
* `from(string|array)` string(s) to be replaced
* `to(string|array)` value(s) to be set as a replacement



Expand All @@ -68,7 +73,7 @@ $this->taskWriteToFile('blogpost.md')
* `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 {{}}
* `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

8 changes: 4 additions & 4 deletions src/Task/File/Replace.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@
* ->run();
*
* $this->taskReplaceInFile('box/robo.txt')
* ->from(array('##dbname##', 'robo'))
* ->to(array('##dbhost## ', 'localhost'))
* ->from(array('##dbname##', '##dbhost##'))
* ->to(array('robo', 'localhost'))
* ->run();
* ?>
* ```
*
* @method regex(string) regex to match string to be replaced
* @method from(string) string to be replaced
* @method to(string) value to be set as a replacement
* @method from(string|array) string(s) to be replaced
* @method to(string|array) value(s) to be set as a replacement
*/
class Replace extends BaseTask
{
Expand Down

0 comments on commit 76c4b4b

Please sign in to comment.