Skip to content

Commit f8ed01d

Browse files
committed
fix bugs
1 parent 0684443 commit f8ed01d

File tree

2 files changed

+35
-32
lines changed

2 files changed

+35
-32
lines changed

cleanup

+7-11
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ if (isset($options['h']) || isset($options['help'])) {
2222
echo " \e[0;32m-e, --exclude \e[0m Remove patterns for common files, comma separated" . PHP_EOL . PHP_EOL;
2323

2424
echo "\e[0;33mExample:\e[0m" . PHP_EOL;
25-
echo " ./vendor/bin/cleanup --include *.lock,*.txt --exclude doc,docs,test" . PHP_EOL;
25+
echo " ./vendor/bin/cleanup --include *.zip,*.rar --exclude doc,docs,test" . PHP_EOL;
2626
return;
2727
}
2828

@@ -38,7 +38,7 @@ $patterns = [
3838
'examples',
3939
'doc',
4040
'docs',
41-
'license*',
41+
'license',
4242
'changelog*',
4343
'changes*',
4444
'faq*',
@@ -48,12 +48,12 @@ $patterns = [
4848
'upgrade*',
4949
'package*',
5050
'readme*',
51-
'phpunit.xml*',
52-
'phpunit.php',
53-
'phpunit*',
54-
'*.yml',
51+
'{,.}*.yml',
5552
'*.md',
5653
'*.xml',
54+
'*.txt',
55+
'*.json',
56+
'*.dist',
5757
'.php_cs*',
5858
'.scrutinizer',
5959
'.gitignore',
@@ -126,11 +126,7 @@ foreach ($directories as $directory) {
126126

127127
$casePattern = preg_replace_callback('/([a-z])/i', 'prepareWord', $pattern);
128128

129-
foreach (glob($directory . '/' . $casePattern) as $file) {
130-
131-
if (pathinfo($file, PATHINFO_EXTENSION) === 'php') {
132-
continue;
133-
}
129+
foreach (glob($directory . '/' . $casePattern, GLOB_BRACE) as $file) {
134130

135131
echo 'delete: ' . $file . PHP_EOL;
136132

readme.md

+28-21
Original file line numberDiff line numberDiff line change
@@ -6,61 +6,68 @@ Cleanup
66
[![Latest Unstable Version](https://poser.pugx.org/visavi/cleanup/v/unstable)](https://packagist.org/packages/visavi/cleanup)
77
[![License](https://poser.pugx.org/visavi/cleanup/license)](https://packagist.org/packages/visavi/cleanup)
88

9-
### Cleaning composer vendor directory
9+
## Cleaning composer vendor directory
1010

1111
It cleans up any tests, descriptions, documentation, examples, etc.
1212

13+
* .git
14+
* .github
1315
* test
1416
* tests
15-
* Tests
1617
* travis
1718
* demo
1819
* example
1920
* examples
2021
* doc
2122
* docs
22-
* README*
23-
* LICENSE*
24-
* CHANGELOG*
25-
* FAQ*
26-
* CONTRIBUTING*
27-
* HISTORY*
28-
* UPGRADING*
29-
* UPGRADE*
23+
* license
24+
* changelog*
25+
* changes*
26+
* faq*
27+
* contributing*
28+
* history*
29+
* upgrading*
30+
* upgrade*
3031
* package*
3132
* readme*
32-
* .travis.yml
33-
* .scrutinizer
34-
* .yml
35-
* phpunit.xml*
36-
* phpunit.php
33+
* {,.}*.yml
3734
* *.md
35+
* *.xml
36+
* *.txt
37+
* *.json
38+
* *.dist
39+
* .php_cs*
40+
* .scrutinizer
3841
* .gitignore
42+
* .gitattributes
43+
* .editorconfig
44+
* dockerfile
3945
* composer.json
46+
* composer.lock
4047

41-
### Installing
48+
## Installing
4249

4350
```
4451
composer require visavi/cleanup
4552
```
4653

47-
### Run
54+
## Run
4855
```
4956
./vendor/bin/cleanup
5057
```
5158

52-
### Option
59+
## Option
5360
include - include new rules pattern
5461

5562
exclude - excludes from the pattern rule
5663

5764
*the list of arguments must be passed by a comma*
5865

59-
### Example
66+
## Example
6067
```
61-
./vendor/bin/cleanup --include *.lock,*.txt --exclude doc,docs,test
68+
./vendor/bin/cleanup --include *.zip,*.rar --exclude doc,docs,test
6269
```
6370

64-
### License
71+
## License
6572

6673
The class is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT)

0 commit comments

Comments
 (0)