Skip to content

Instantly share code, notes, and snippets.

@dmccreary
Created May 25, 2020 19:06
Show Gist options
  • Save dmccreary/72e016bc554109d14290950ce33d4dc8 to your computer and use it in GitHub Desktop.
Save dmccreary/72e016bc554109d14290950ce33d4dc8 to your computer and use it in GitHub Desktop.
Add mkdocs files to a github repository.
#!/bin/sh
# add mkdocs to git repository
if [ $# -eq 0 ]
then
echo "No arguments supplied. Exiting."
exit 1
fi
if [ -d $1 ]
then
echo "Source directory $1 exists."
else
echo "Error: Source directory \"$1\" does not exist. Exiting."
exit 404
fi
# Here is the directory that has the templates.
# you can clone it from http://github.com/dmccreary/mkdocs-templates
TEMPLATE_DIR=/Users/dan/ws/mkdocs-templates/coderdojo
if [ -d $TEMPLATE_DIR ]
then
echo "Template directory $TEMPLATE_DIR exists."
else
echo "Error: Template directory \"$TEMPLATE_DIR\" does not exist. Exiting."
exit 404
fi
# if the docs dir does not exist then copy the source to it
if [ ! -d $TEMPLATE_DIR/docs]
then
echo "copying docs template"
cp -r $TEMPLATE_DIR/docs $1
fi
# if the .gitignore file does not exist then copy it
if [ ! !f $1/.gitignore]
then
echo "copying .gitignore"
cp $TEMPLATE_DIR/.gitignore $1
fi
if [ !f -f $1/mkdocs.ymp]
then
echo "copying "
cp $TEMPLATE_DIR/mkdocs.yml $1
fi
echo "Adding mkdocs files to $1 from $TEMPLATE_DIR"
echo "working"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment