Remove old scripts, modify manual syncing doc script (#1549)
Maintenance! Removes all the old scripts now used, and adds a "manual" doc sync maintenance script which we have yet to automate. Signed-off-by: Charlie Drage <charlie@charliedrage.com> Signed-off-by: Charlie Drage <charlie@charliedrage.com>
This commit is contained in:
@@ -1,13 +1,11 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
|
||||
## README:
|
||||
## This script is ran by running:
|
||||
## cd script
|
||||
## ./manual-docs-sync.sh
|
||||
##
|
||||
## This will take all documentation from the /docs folder of the master dir, add jekyll-related-metadata
|
||||
## and push to the gh-pages branch.
|
||||
## This will take all documentation from the /docs folder of the master dir and push to the gh-pages branch (granted you have access)
|
||||
|
||||
DOCS_REPO_NAME="kompose"
|
||||
DOCS_REPO_URL="git@github.com:kubernetes/kompose.git"
|
||||
@@ -24,49 +22,9 @@ cd "$DOCS_REPO_NAME"
|
||||
git checkout gh-pages
|
||||
git checkout master docs
|
||||
|
||||
# Remove README.md from docs folder as it isn't relevant
|
||||
rm docs/README.md
|
||||
|
||||
# Use introduction.md instead as the main index page
|
||||
mv docs/introduction.md index.md
|
||||
|
||||
# Check that index.md has the appropriate Jekyll format
|
||||
index="index.md"
|
||||
if cat $index | head -n 1 | grep "\-\-\-";
|
||||
then
|
||||
echo "index.md already contains Jekyll format"
|
||||
else
|
||||
# Remove ".md" from the name
|
||||
name=${index::-3}
|
||||
echo "Adding Jekyll file format to $index"
|
||||
jekyll="---
|
||||
layout: default
|
||||
---
|
||||
"
|
||||
echo -e "$jekyll\n$(cat $index)" > $index
|
||||
fi
|
||||
|
||||
# clean-up the docs and convert to jekyll-friendly docs
|
||||
cd docs
|
||||
for filename in *.md; do
|
||||
if cat $filename | head -n 1 | grep "\-\-\-";
|
||||
then
|
||||
echo "$filename already contains Jekyll format"
|
||||
else
|
||||
# Remove ".md" from the name
|
||||
name=${filename::-3}
|
||||
echo "Adding Jekyll file format to $filename"
|
||||
jekyll="---
|
||||
layout: default
|
||||
permalink: /$name/
|
||||
redirect_from:
|
||||
- /docs/$name.md/
|
||||
---
|
||||
"
|
||||
echo -e "$jekyll\n$(cat $filename)" > $filename
|
||||
fi
|
||||
done
|
||||
cd ..
|
||||
# Copy it all over to the current directory
|
||||
cp -r docs/* .
|
||||
rm -r docs
|
||||
|
||||
git add --all
|
||||
|
||||
|
||||
Reference in New Issue
Block a user