Skip to content

Commit bb09a43

Browse files
Merge pull request #183 from nextcloud/refactor/rector
2 parents fb17711 + 4b2d0f6 commit bb09a43

17 files changed

+287
-143
lines changed

.github/workflows/test-repositories.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,15 +65,15 @@ jobs:
6565
- name: Generate OpenAPI
6666
if: matrix.repositories != 'nextcloud/server'
6767
working-directory: temp-repository/
68-
run: ../generate-spec
68+
run: ../bin/generate-spec
6969

7070
- name: Generate OpenAPI - Server
7171
if: matrix.repositories == 'nextcloud/server'
7272
working-directory: temp-repository/
7373
run: |
7474
for path in core apps/*; do
7575
if [ ! -f "$path/.noopenapi" ]; then
76-
../generate-spec "$path" "$path/openapi.json" || exit 1
76+
../bin/generate-spec "$path" "$path/openapi.json" || exit 1
7777
fi
7878
done
7979

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ jobs:
5050

5151
- name: Generate OpenAPI
5252
working-directory: tests/
53-
run: ../generate-spec
53+
run: ../bin/generate-spec
5454

5555
- name: Check openapi changes
5656
run: |

.php-cs-fixer.dist.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@
1515
->ignoreVCSIgnored(true)
1616
->notPath('vendor')
1717
->in(__DIR__)
18-
->append(['generate-spec', 'merge-specs']);
18+
->append(['generate-spec.php', 'merge-specs.php']);
1919
return $config;

bin/generate-spec

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/bin/env php
2+
<?php
3+
4+
/**
5+
* SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
6+
* SPDX-License-Identifier: AGPL-3.0-or-later
7+
*/
8+
9+
namespace OpenAPIExtractor;
10+
11+
include_once __DIR__ . '/../generate-spec.php';

bin/merge-specs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/bin/env php
2+
<?php
3+
4+
/**
5+
* SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
6+
* SPDX-License-Identifier: AGPL-3.0-or-later
7+
*/
8+
9+
namespace OpenAPIExtractor;
10+
11+
include_once __DIR__ . '/../generate-spec.php';

composer.json

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
"description": "A tool for extracting OpenAPI specifications from Nextcloud source code",
44
"license": "AGPL-3.0-or-later",
55
"bin": [
6-
"generate-spec",
7-
"merge-specs"
6+
"bin/generate-spec",
7+
"bin/merge-specs"
88
],
99
"config": {
1010
"sort-packages": true
@@ -23,12 +23,14 @@
2323
},
2424
"require-dev": {
2525
"nextcloud/coding-standard": "^1.2",
26-
"nextcloud/ocp": "dev-master"
26+
"nextcloud/ocp": "dev-master",
27+
"rector/rector": "^1.2"
2728
},
2829
"scripts": {
29-
"lint": "find . -name \\*.php -not -path './tests/*' -not -path './vendor/*' -not -path './build/*' -print0 | xargs -0 -n1 php -l && php -l generate-spec && php -l merge-specs",
30+
"lint": "find . -name \\*.php -not -path './tests/*' -not -path './vendor/*' -not -path './build/*' -print0 | xargs -0 -n1 php -l",
3031
"cs:check": "php-cs-fixer fix --dry-run --diff",
3132
"cs:fix": "php-cs-fixer fix",
32-
"test:unit": "cd tests && ../generate-spec"
33+
"test:unit": "cd tests && ../bin/generate-spec",
34+
"rector": "rector && composer cs:fix"
3335
}
3436
}

composer.lock

Lines changed: 119 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)