Skip to content

Commit 97eb354

Browse files
committed
docs: build Dolibarr *.0 versions
1 parent 8589eca commit 97eb354

File tree

2 files changed

+46
-7
lines changed

2 files changed

+46
-7
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?php
2+
3+
use Doctum\Doctum;
4+
use Doctum\RemoteRepository\GitHubRemoteRepository;
5+
use Symfony\Component\Finder\Finder;
6+
use Doctum\Version\GitVersionCollection;
7+
8+
$rootDir = __DIR__ . '/';
9+
$sourceRootDir = $rootDir . 'sources/Dolibarr';
10+
11+
$iterator = Finder::create()
12+
->files()
13+
->name('*.php')
14+
->path('htdocs')
15+
->in($sourceRootDir);
16+
17+
$versions = GitVersionCollection::create(__DIR__)
18+
->addFromBranches('*.0');
19+
20+
return new Doctum($iterator, [
21+
'title' => 'Dolibarr',
22+
'build_dir' => $rootDir . '/Dolibarr',
23+
'cache_dir' => $rootDir . '/cache',
24+
'source_dir' => $rootDir,
25+
'versions' => $versions,
26+
'remote_repository' => new GitHubRemoteRepository('dolibarr/dolibarr', $sourceRootDir),
27+
'footer_link' => [
28+
'href' => 'https://github.com/Dolibarr/dolibarr',
29+
'rel' => 'noreferrer noopener',
30+
'target' => '_blank',
31+
'before_text' => 'This documentation is built for the',
32+
'link_text' => 'Dolibarr',
33+
'after_text' => 'project.',
34+
],
35+
]);

scripts/update-built-docs.sh

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ doDocsUpdate() {
4444

4545
FOLDER_NAME="$1"
4646
SOURCE_URL="$2"
47+
MODE="${3:-}"
4748
BUILD_DIR="./api-docs/$FOLDER_NAME"
4849
SOURCE_DIR="./api-docs/sources/$FOLDER_NAME"
4950

@@ -64,15 +65,17 @@ doDocsUpdate() {
6465

6566
rm -rfd "$SOURCE_DIR"
6667

67-
if [ ! -d "$SOURCE_DIR" ]; then
68-
mkdir "$SOURCE_DIR"
68+
if [ "$MODE" != "git" ]; then
69+
if [ ! -d "$SOURCE_DIR" ]; then
70+
mkdir "$SOURCE_DIR"
71+
fi
72+
# Download, extract and move
73+
curl -# -L -o $FOLDER_NAME.tar.gz "$SOURCE_URL"
74+
tar xzvf $FOLDER_NAME.tar.gz --strip-components=1 -C "$SOURCE_DIR" && rm $FOLDER_NAME.tar.gz
75+
else
76+
git clone "$SOURCE_URL" "$SOURCE_DIR"
6977
fi
7078

71-
# Download, extract and move
72-
curl -# -L -o $FOLDER_NAME.tar.gz "$SOURCE_URL"
73-
74-
tar xzvf $FOLDER_NAME.tar.gz --strip-components=1 -C "$SOURCE_DIR" && rm $FOLDER_NAME.tar.gz
75-
7679
du -sh "$SOURCE_DIR"
7780

7881
# Try as hard as possible to cleanup the dir
@@ -110,3 +113,4 @@ doDocsUpdate "mangopay2-php-sdk" "https://github.com/Mangopay/mangopay2-php-sdk/
110113
doDocsUpdate "tcpdf" "https://github.com/tecnickcom/TCPDF/archive/refs/heads/main.tar.gz"
111114
doDocsUpdate "DirectoryTree-ImapEngine" "https://github.com/DirectoryTree/ImapEngine/archive/refs/heads/master.tar.gz"
112115
doDocsUpdate "phpunit" "https://github.com/sebastianbergmann/phpunit/archive/refs/heads/main.tar.gz"
116+
doDocsUpdate "Dolibarr" "https://github.com/Dolibarr/dolibarr.git"

0 commit comments

Comments
 (0)