|
3 | 3 | set +x; |
4 | 4 |
|
5 | 5 | AUTH_JSON=${1:-~/.composer/auth.json}; # Path to an auth.json file allowing to install the targeted edition and version |
6 | | -OUTPUT_DIR=${2:-./docs/api/php_api/php_api_reference}; # Path to the directory where the built PHP API Reference is hosted |
| 6 | +PHP_API_OUTPUT_DIR=${2:-./docs/api/php_api/php_api_reference}; # Path to the directory where the built PHP API Reference is hosted |
| 7 | +REST_API_OUTPUT_FILE=${3:-./docs/api/rest_api/rest_api_reference/rest_api_reference.html}; # Path to the REST API Reference file |
7 | 8 |
|
8 | 9 | DXP_EDITION='commerce'; # Edition from and for which the Reference is built |
9 | | -DXP_VERSION='5.0.x-dev'; # Version from and for which the Reference is built |
| 10 | +DXP_VERSION='5.0.0-rc1'; # Version from and for which the Reference is built |
10 | 11 | DXP_ADD_ONS=(automated-translation rector); # Packages not included in $DXP_EDITION but added to the Reference, listed without their vendor "ibexa" |
11 | 12 | DXP_EDITIONS=(oss headless experience commerce); # Available editions ordered by ascending capabilities |
12 | 13 | SF_VERSION='7.2'; # Symfony version used by Ibexa DXP |
13 | 14 | PHPDOC_VERSION='3.8.0'; # Version of phpDocumentor used to build the Reference |
14 | | -PHPDOC_CONF="$(pwd)/tools/php_api_ref/phpdoc.dist.xml"; # Absolute path to phpDocumentor configuration file |
15 | | -#PHPDOC_CONF="$(pwd)/tools/php_api_ref/phpdoc.dev.xml"; # Absolute path to phpDocumentor configuration file |
| 15 | +PHPDOC_CONF="$(pwd)/tools/api_refs/phpdoc.dist.xml"; # Absolute path to phpDocumentor configuration file |
| 16 | +#PHPDOC_CONF="$(pwd)/tools/api_refs/phpdoc.dev.xml"; # Absolute path to phpDocumentor configuration file |
16 | 17 | PHPDOC_TEMPLATE_VERSION='3.8.0'; # Version of the phpDocumentor base template set |
17 | | -PHPDOC_DIR="$(pwd)/tools/php_api_ref/.phpdoc"; # Absolute path to phpDocumentor resource directory (containing the override template set) |
| 18 | +PHPDOC_DIR="$(pwd)/tools/api_refs/.phpdoc"; # Absolute path to phpDocumentor resource directory (containing the override template set) |
| 19 | +REDOCLY_CONFIG="$(pwd)/tools/api_refs/redocly.yaml"; # Absolute path to Redocly configuration file |
| 20 | +REDOCLY_TEMPLATE="$(pwd)/tools/api_refs/redocly.hbs"; # Absolute path to Redocly wrapping template |
| 21 | +OPENAPI_FIX="$(pwd)/tools/api_refs/openapi.php"; # A script editing and fixing few things on the dumped schema (should be temporary and fixes reported to source) |
18 | 22 |
|
19 | 23 | PHP_BINARY="php -d error_reporting=`php -r 'echo E_ALL & ~E_DEPRECATED;'`"; # Avoid depreciation messages from phpDocumentor/Reflection/issues/529 when using PHP 8.2 or higher |
20 | 24 | TMP_DXP_DIR=/tmp/ibexa-dxp-phpdoc; # Absolute path of the temporary directory in which Ibexa DXP will be installed and the PHP API Reference built |
21 | 25 | FORCE_DXP_INSTALL=1; # If 1, empty the temporary directory, install DXP from scratch, build, remove temporary directory; if 0, potentially reuse the DXP already installed in temporary directory, keep temporary directory for future uses. |
22 | | -BASE_DXP_BRANCH='master'; # Branch from and for which the Reference is built when using a dev branch as version |
23 | | -VIRTUAL_DXP_VERSION='5.0.0'; # Version for which the reference is supposedly built when using dev branch as version |
| 26 | +BASE_DXP_BRANCH=''; # Branch from and for which the Reference is built when using a dev branch as version |
| 27 | +VIRTUAL_DXP_VERSION=''; # Version for which the reference is supposedly built when using dev branch as version |
24 | 28 |
|
25 | | -if [ ! -d $OUTPUT_DIR ]; then |
26 | | - echo -n "Creating ${OUTPUT_DIR}… "; |
27 | | - mkdir -p $OUTPUT_DIR; |
| 29 | +if [ ! -d $PHP_API_OUTPUT_DIR ]; then |
| 30 | + echo -n "Creating ${PHP_API_OUTPUT_DIR}… "; |
| 31 | + mkdir -p $PHP_API_OUTPUT_DIR; |
28 | 32 | if [ $? -eq 0 ]; then |
29 | 33 | echo 'OK'; |
30 | 34 | else |
31 | 35 | exit 1; |
32 | 36 | fi; |
33 | 37 | fi; |
34 | | -OUTPUT_DIR=$(realpath $OUTPUT_DIR); # Transform to absolute path before changing the working directory |
| 38 | +PHP_API_OUTPUT_DIR=$(realpath $PHP_API_OUTPUT_DIR); # Transform into absolute path before changing the working directory |
| 39 | +REST_API_OUTPUT_FILE=$(realpath $REST_API_OUTPUT_FILE); # Transform into absolute path before changing the working directory |
35 | 40 |
|
36 | 41 | if [ 1 -eq $FORCE_DXP_INSTALL ]; then |
37 | 42 | echo 'Remove temporary directory…'; |
@@ -59,6 +64,13 @@ if [ 0 -eq $DXP_ALREADY_EXISTS ]; then |
59 | 64 | fi; |
60 | 65 | composer config repositories.ibexa composer https://updates.ibexa.co; |
61 | 66 | composer require ibexa/$DXP_EDITION:$DXP_VERSION --no-interaction --update-with-all-dependencies --no-install --ignore-platform-reqs --no-scripts; |
| 67 | + elif [[ "$DXP_VERSION" == *"-rc"* ]]; then |
| 68 | + composer create-project ibexa/website-skeleton:$DXP_VERSION . --no-interaction --ignore-platform-reqs --no-scripts --stability=rc; |
| 69 | + if [ -n "$AUTH_JSON" ]; then |
| 70 | + cp $AUTH_JSON ./; |
| 71 | + fi; |
| 72 | + composer config repositories.ibexa composer https://updates.ibexa.co; |
| 73 | + composer require ibexa/$DXP_EDITION:$DXP_VERSION --no-interaction --update-with-all-dependencies --no-install --ignore-platform-reqs --no-scripts; |
62 | 74 | else |
63 | 75 | composer create-project ibexa/$DXP_EDITION-skeleton:$DXP_VERSION . --no-interaction --no-install --ignore-platform-reqs --no-scripts; |
64 | 76 | if [ -n "$AUTH_JSON" ]; then |
@@ -179,21 +191,36 @@ if [ $? -eq 0 ]; then |
179 | 191 | ./php_api_reference/js/searchIndex.js \ |
180 | 192 | > ./php_api_reference/js/searchIndex.new.js; |
181 | 193 | mv -f ./php_api_reference/js/searchIndex.new.js ./php_api_reference/js/searchIndex.js; |
182 | | - echo -n "Copy phpDocumentor output to ${OUTPUT_DIR}… "; |
183 | | - cp -rf ./php_api_reference/* $OUTPUT_DIR; |
| 194 | + echo -n "Copy phpDocumentor output to ${PHP_API_OUTPUT_DIR}… "; |
| 195 | + cp -rf ./php_api_reference/* $PHP_API_OUTPUT_DIR; |
184 | 196 | echo -n 'Remove surplus… '; |
185 | 197 | while IFS= read -r line; do |
186 | 198 | file="$(echo $line | sed -r 's/Only in (.*): (.*)/\1\/\2/')"; |
187 | | - if [[ $file = $OUTPUT_DIR/* ]]; then |
| 199 | + if [[ $file = $PHP_API_OUTPUT_DIR/* ]]; then |
188 | 200 | rm -rf $file; |
189 | 201 | fi; |
190 | | - done <<< "$(diff -qr ./php_api_reference $OUTPUT_DIR | grep 'Only in ')"; |
| 202 | + done <<< "$(diff -qr ./php_api_reference $PHP_API_OUTPUT_DIR | grep 'Only in ')"; |
191 | 203 | echo 'OK.'; |
192 | 204 | else |
193 | | - echo 'A phpDocumentor error prevents reference update.'; |
| 205 | + echo 'A phpDocumentor error prevents PHP Reference update.'; |
194 | 206 | exit 3; |
195 | 207 | fi; |
196 | 208 |
|
| 209 | +if [ 0 -eq $DXP_ALREADY_EXISTS ]; then |
| 210 | + echo 'Set up DXP recipes…'; |
| 211 | + git init && git add . && git commit -m "Installed Ibexa Commerce" > /dev/null; |
| 212 | + composer recipes:install ibexa/$DXP_EDITION --force --reset --no-interaction; |
| 213 | +fi; |
| 214 | + |
| 215 | +echo 'Dump REST OpenAPI schema… '; |
| 216 | +$PHP_BINARY bin/console ibexa:openapi --yaml \ |
| 217 | + | sed "s@info:@info:\n x-logo:\n url: 'https://doc.ibexa.co/en/latest/images/ibexa-dxp-logo.png'@" \ |
| 218 | +> openapi.yaml; |
| 219 | +echo 'Fix REST OpenAPI schema… '; |
| 220 | +$PHP_BINARY $OPENAPI_FIX; |
| 221 | +echo 'Build REST Reference… '; |
| 222 | +redocly build-docs openapi.yaml --output $REST_API_OUTPUT_FILE --config $REDOCLY_CONFIG --template $REDOCLY_TEMPLATE; |
| 223 | + |
197 | 224 | if [ 1 -eq $FORCE_DXP_INSTALL ]; then |
198 | 225 | echo 'Remove temporary directory…'; |
199 | 226 | rm -rf $TMP_DXP_DIR; |
|
0 commit comments