Skip to content

Commit

Permalink
Merge pull request #183 from nextcloud/refactor/rector
Browse files Browse the repository at this point in the history
  • Loading branch information
provokateurin authored Nov 13, 2024
2 parents fb17711 + 4b2d0f6 commit bb09a43
Show file tree
Hide file tree
Showing 17 changed files with 287 additions and 143 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test-repositories.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,15 @@ jobs:
- name: Generate OpenAPI
if: matrix.repositories != 'nextcloud/server'
working-directory: temp-repository/
run: ../generate-spec
run: ../bin/generate-spec

- name: Generate OpenAPI - Server
if: matrix.repositories == 'nextcloud/server'
working-directory: temp-repository/
run: |
for path in core apps/*; do
if [ ! -f "$path/.noopenapi" ]; then
../generate-spec "$path" "$path/openapi.json" || exit 1
../bin/generate-spec "$path" "$path/openapi.json" || exit 1
fi
done
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:

- name: Generate OpenAPI
working-directory: tests/
run: ../generate-spec
run: ../bin/generate-spec

- name: Check openapi changes
run: |
Expand Down
2 changes: 1 addition & 1 deletion .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@
->ignoreVCSIgnored(true)
->notPath('vendor')
->in(__DIR__)
->append(['generate-spec', 'merge-specs']);
->append(['generate-spec.php', 'merge-specs.php']);
return $config;
11 changes: 11 additions & 0 deletions bin/generate-spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env php
<?php

/**
* SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/

namespace OpenAPIExtractor;

include_once __DIR__ . '/../generate-spec.php';
11 changes: 11 additions & 0 deletions bin/merge-specs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env php
<?php

/**
* SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/

namespace OpenAPIExtractor;

include_once __DIR__ . '/../generate-spec.php';
12 changes: 7 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"description": "A tool for extracting OpenAPI specifications from Nextcloud source code",
"license": "AGPL-3.0-or-later",
"bin": [
"generate-spec",
"merge-specs"
"bin/generate-spec",
"bin/merge-specs"
],
"config": {
"sort-packages": true
Expand All @@ -23,12 +23,14 @@
},
"require-dev": {
"nextcloud/coding-standard": "^1.2",
"nextcloud/ocp": "dev-master"
"nextcloud/ocp": "dev-master",
"rector/rector": "^1.2"
},
"scripts": {
"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",
"lint": "find . -name \\*.php -not -path './tests/*' -not -path './vendor/*' -not -path './build/*' -print0 | xargs -0 -n1 php -l",
"cs:check": "php-cs-fixer fix --dry-run --diff",
"cs:fix": "php-cs-fixer fix",
"test:unit": "cd tests && ../generate-spec"
"test:unit": "cd tests && ../bin/generate-spec",
"rector": "rector && composer cs:fix"
}
}
121 changes: 119 additions & 2 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit bb09a43

Please sign in to comment.