Convert library samples to stubs

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2019-09-03 19:14:15 +02:00
parent 6f769c5eea
commit f9f5f8dacd
No known key found for this signature in database
GPG Key ID: 76698F39D527CE8C
3 changed files with 6 additions and 11 deletions

View File

@ -70,7 +70,6 @@ COPY --from=docs/docker.github.io:v18.09 ${TARGET} ${TARGET}
# @todo find a way to build HTML in this stage, and still have them included in the navigation tree
FROM builderbase AS library-samples
COPY ./_scripts/fetch-library-samples.sh ./_scripts/
COPY ./_samples/boilerplate.txt ./_samples/
RUN bash ./_scripts/fetch-library-samples.sh
# Fetch upstream resources (reference documentation)

View File

@ -4,6 +4,8 @@
svn co https://github.com/docker-library/docs/trunk ./_samples/library || (echo "Failed library download" && exit 1)
# Remove symlinks to maintainer.md because they break jekyll and we don't use em
find ./_samples/library -maxdepth 9 -type l -delete
# Remove the top-level README because we don't want to generate a file for that
rm ./_samples/library/README.md
# Loop through the README.md files, turn them into rich index.md files
FILES=$(find ./_samples/library -type f -name 'README.md')
for f in ${FILES}
@ -12,7 +14,6 @@ do
justcurdir="${curdir##*/}"
if [ -e ${curdir}/README-short.txt ]
then
# shortrm=$(<${curdir}/README-short.txt)
shortrm=$(cat ${curdir}/README-short.txt)
fi
echo "Adding front-matter to ${f} ..."
@ -35,15 +36,10 @@ do
# gitrepo=$(<${curdir}/github-repo)
gitrepo=$(cat ${curdir}/github-repo)
echo >> ${curdir}/front-matter.txt
echo GitHub repo: \["${gitrepo}"\]\("${gitrepo}"\)\{: target="_blank"\} >> ${curdir}/front-matter.txt
echo >> ${curdir}/front-matter.txt
fi
cat ${curdir}/front-matter.txt ./_samples/boilerplate.txt > ${curdir}/header.txt
echo {% raw %} >> ${curdir}/header.txt
cat ${curdir}/header.txt ${curdir}/README.md > ${curdir}/index.md
echo {% endraw %} >> ${curdir}/index.md
rm -rf ${curdir}/front-matter.txt
rm -rf ${curdir}/header.txt
cat ${curdir}/front-matter.txt > ${curdir}/index.md
echo {% include library-samples.md %} >> ${curdir}/index.md
done
rm ./_samples/library/index.md
# Remove everything except for the index.md's we generated
find ./_samples/ ! -name 'index.md' -type f -exec rm -f {} +