Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
Improved documentation and added no-progressbar
Browse files Browse the repository at this point in the history
  • Loading branch information
palPalani committed Aug 26, 2020
1 parent 38bffb8 commit 33c6dd0
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 1 deletion.
42 changes: 41 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,57 @@ The easiest way to install this package is through composer:

``composer require --dev palpalani/grumphp-rector-task``

Add the extension loader to your `grumphp.yml`.
### Config

Add the extension loader to your `grumphp.yml` or `grumphp.yml.dist`.
The task lives under the `rector` namespace and has following
configurable parameters:

````yml
# grumphp.yml
grumphp:
tesks:
rector:
whitelist_patterns: []
config: 'rector.php'
triggered_by: ['php']
clear-cache: false
ignore_patterns: []
no-progress-bar: false
extensions:
- palPalani\GrumPhpRectorTask\ExtensionLoader
````

#### whitelist_patterns

`Default: []`

If you want to run on particular directories only, specify it with this option.

#### config

`Default: 'rector.php'`
If you want to use a different config file than the default `rector.php`, you can specify your custom config file location with this option.

#### triggered_by

`Default: [php]`

This option will specify which file extensions will trigger this task.

#### clear-cache

`Default: false`

Clear cache for already checked files.

#### no-progress-bar

`Default: false`

Hide progress bar. Useful e.g. for nicer CI output.

### Sample RectorPhp configuration

Create `rector.php` in your project root and configure as follows.
Expand Down
3 changes: 3 additions & 0 deletions src/RectorTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,15 @@ public static function getConfigurableOptions(): OptionsResolver
'config' => 'rector.php',
'triggered_by' => ['php'],
'ignore_patterns' => [],
'no-progress-bar' => false,
]);

$resolver->addAllowedTypes('whitelist_patterns', ['array']);
$resolver->addAllowedTypes('clear-cache', ['bool']);
$resolver->addAllowedTypes('config', ['null', 'string']);
$resolver->addAllowedTypes('triggered_by', ['array']);
$resolver->addAllowedTypes('ignore_patterns', ['array']);
$resolver->addAllowedTypes('no-progress-bar', ['bool']);

return $resolver;
}
Expand Down Expand Up @@ -56,6 +58,7 @@ public function run(ContextInterface $context): TaskResultInterface

$arguments->addOptionalArgument('--config=%s', $config['config']);
$arguments->addOptionalArgument('--clear-cache', $config['clear-cache']);
$arguments->addOptionalArgument('--no-progress-bar', $config['clear-cache']);
$arguments->addOptionalArgument('--ansi', true);

//$arguments->add('--no-progress-bar');
Expand Down

0 comments on commit 33c6dd0

Please sign in to comment.