Skip to content

Commit db70f0a

Browse files
authored
Merge pull request #6 from doctrine/ch-ch-changes
Assume install directory is `docs/` instead of project root
2 parents 235d535 + 788b854 commit db70f0a

File tree

4 files changed

+22
-3838
lines changed

4 files changed

+22
-3838
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
vendor
2+
composer.lock

README.md

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,31 @@
11
# Doctrine Docs Builder
22

33
A package for generating Doctrine repo docs in a unified way. Its purpose is to abstract the underlying method away from
4-
the generating command. It assumes the input directory is in `docs/en` at the root of the repo (for now).
4+
the generating command. It assumes:
5+
6+
- it's run from the project root, and
7+
- the docs reside in `docs/en/`.
8+
9+
It uses [phpdocumentor](https://github.com/phpDocumentor/guides) tooling for parsing the RST files.
10+
11+
This project is considered an internal tool and therefore, you shouldn't use this project in your application. This
12+
repository doesn't provide any support, and doesn't guarantee backward compatibility. Any or the entire project can
13+
change, or even disappear, at any moment without prior notice.
514

615
## Usage:
716

817
```shell
9-
composer require --dev doctrine/docs-builder
10-
./vendor/bin/build-docs.sh [<output>]
18+
composer require --dev doctrine/docs-builder -d docs
19+
./docs/vendor/bin/build-docs.sh [<output>]
1120
```
1221

13-
The output directory defaults to `output` at the root of your project.
22+
The output directory defaults to `docs/output`.
1423

1524
Optionally, declare a script in your root `composer.json` for convenience:
1625

1726
```
1827
"scripts": {
19-
"docs": "./vendor/bin/build-docs.sh @additional_args"
28+
"docs": "./docs/vendor/bin/build-docs.sh @additional_args"
2029
}
2130
```
2231

bin/build-docs.sh

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env sh
22

3-
usage="$(basename "$0") [-h] [<outputDir>] -- generate the docs to given output dir [default: output]"
3+
usage="$(basename "$0") [-h] [<outputDir>] -- generate docs to given output dir [default: docs/output]"
44

55
# shellcheck disable=SC2034
66
if getopts ":h" option
@@ -9,23 +9,19 @@ then
99
exit
1010
fi
1111

12-
rootDir=$PWD
13-
14-
inputDir="docs/en"
12+
docsRoot="$PWD/docs"
1513

1614
outputArg="${1}"
1715
firstChar=$(echo "$1" | cut -c1-1)
1816

1917
if [ "$firstChar" != "/" ] && [ "$firstChar" != "" ]
2018
then
21-
# Output directory should be relative to working directory
22-
outputArg="$rootDir/$outputArg"
19+
# The output path provided is not an absolute path;
20+
# therefore treat the path as relative to the working dir (project root).
21+
outputArg="$docsRoot/$outputArg"
2322
fi
2423

25-
defaultOutputDir="$rootDir/output"
24+
defaultOutputDir="$docsRoot/output"
2625
outputDir="${outputArg:-${defaultOutputDir:-default}}"
2726

28-
baseDir=$(dirname "$(dirname "$0")")
29-
output=$(composer install -d "$baseDir" 2>&1) || print "$output"
30-
31-
"$baseDir/vendor/bin/guides" -vvv --no-progress --fail-on-log "$rootDir/$inputDir" --output="$outputDir"
27+
"$docsRoot/vendor/bin/guides" -vvv --no-progress --fail-on-log "$docsRoot/en" --output="$outputDir"

0 commit comments

Comments
 (0)