Skip to content

Commit

Permalink
Use Doctum in replacement of Sami
Browse files Browse the repository at this point in the history
Signed-off-by: William Desportes <williamdes@wdes.fr>
  • Loading branch information
williamdes committed Jul 18, 2020
1 parent 802b49b commit ab0b0e3
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 44 deletions.
10 changes: 5 additions & 5 deletions develdocs/build.sh
Expand Up @@ -20,14 +20,14 @@ for repo in phpmyadmin sql-parser motranslator shapefile simple-math ; do
# Clean output
rm -rf "$BUILDER_REPO/develdocs/output/$repo/"
# Generate config file
nice -19 "$BUILDER_REPO/develdocs/sami.php" \
nice -19 "$BUILDER_REPO/develdocs/doctum.php" \
--root "$BUILDER_ROOT/$repo" \
--build-dir "$BUILDER_REPO/develdocs/output/$repo/" \
--cache-dir "$BUILDER_REPO/develdocs/tmp/$repo/" \
--output-config "$BUILDER_REPO/develdocs/sami-$repo.php" \
--title-of-composer
--slug "phpmyadmin/$repo" \
--output-config "$BUILDER_REPO/develdocs/doctum-$repo.php"
# Render
nice -19 "$BUILDER_REPO/develdocs/vendor/bin/sami.php" update "$BUILDER_REPO/develdocs/sami-$repo.php"
nice -19 "$BUILDER_REPO/develdocs/vendor/bin/doctum.php" update "$BUILDER_REPO/develdocs/doctum-$repo.php"
# Delete config file
rm "$BUILDER_REPO/develdocs/sami-$repo.php"
rm "$BUILDER_REPO/develdocs/doctum-$repo.php"
done
2 changes: 1 addition & 1 deletion develdocs/composer.json
@@ -1,5 +1,5 @@
{
"require": {
"sami/sami": "^4.0"
"code-lts/doctum": "^5.0"
}
}
36 changes: 36 additions & 0 deletions develdocs/doctum.php
@@ -0,0 +1,36 @@
#!/usr/bin/php
<?php
$_CLI = getopt('', array('slug:', 'root:', 'build-dir:', 'cache-dir:', 'output-config:', 'title::', 'title-of-composer'));

$SOURCE = 'src';

if (is_dir($_CLI['root'] . '/src') === false) {
$SOURCE = 'libraries';
}

$_CLI['root'] = rtrim($_CLI['root'], '/') . '/';

$output = '<?php
/**
* This file has been generated by phpmyadmin/scripts/develdocs/build.sh
* @see https://github.com/phpmyadmin/scripts/blob/master/develdocs/doctum.php
* @see https://github.com/phpmyadmin/scripts/blob/master/develdocs/build.sh
*/
use Doctum\Doctum;
use Symfony\Component\Finder\Finder;
use Doctum\RemoteRepository\GitHubRemoteRepository;
$iterator = Finder::create()
->files()
->name(\'*.php\')
->in(\'' . $_CLI['root'] . $SOURCE . '\');
return new Doctum($iterator, [
\'title\' => json_decode(file_get_contents(\'' . $_CLI['root'] . 'composer.json\'))->description,
\'build_dir\' => \'' . $_CLI['build-dir'] . '\',
\'cache_dir\' => \'' . $_CLI['cache-dir'] . '\',
\'remote_repository\' => new GitHubRemoteRepository(\'' . $_CLI['slug'] . '\', \'' . $_CLI['root'] . '\'),
]);
';

file_put_contents($_CLI['output-config'], $output);
38 changes: 0 additions & 38 deletions develdocs/sami.php

This file was deleted.

0 comments on commit ab0b0e3

Please sign in to comment.