* WIP

* Working locally

* Upgrade lanyon

* Upgrade Lanyon to v0.0.12

* Tweaks

* Simplify example scripts
This commit is contained in:
Kevin van Zonneveld
2016-11-30 14:57:40 +01:00
committed by GitHub
parent 57ebf1569d
commit 74a701a66e
33 changed files with 6139 additions and 97 deletions

49
website/_scripts/deploy.sh Executable file
View File

@ -0,0 +1,49 @@
#!/usr/bin/env bash
# This file:
#
# - Builds website for production
# - Force pushes that to the gh-pages branch
# - On travis, make sure you have encrypted the GHPAGES_URL var
#
# Usage:
#
# ./deploy.sh
#
# Based on a template by BASH3 Boilerplate v2.0.0
# http://bash3boilerplate.sh/#authors
#
# The MIT License (MIT)
# Copyright (c) 2013 Kevin van Zonneveld and contributors
# You are not obligated to bundle the LICENSE file with your b3bp projects as long
# as you leave these references intact in the header comments of your source files.
set -o errexit
set -o errtrace
set -o nounset
set -o pipefail
set -o xtrace
echo "--> Deploying to GitHub pages.."
if [ "${TRAVIS:-}" = "true" ]; then
git config --global user.name 'lekevbot'
git config --global user.email 'bot@kvz.io'
fi
if type yarn; then
yarn
else
npm install
fi
npm run web:build:production
pushd website/_site
[ -d .git ] || git init
echo 'This branch is just a deploy target. Do not edit. You changes will be lost.' |tee README.md
git checkout -B gh-pages
git add --all .
git commit -nm "Update website by ${USER}" || true
git remote add origin ${GHPAGES_URL} || true
git push origin gh-pages:refs/heads/gh-pages || git push origin gh-pages:refs/heads/gh-pages --force > /dev/null
popd

73
website/_scripts/inject.sh Executable file
View File

@ -0,0 +1,73 @@
#!/usr/bin/env bash
# This file:
#
# - Injects markdown files into the ./website directory
# - Changes them a little to make them more suitable for Jekyll building
#
# Usage:
#
# ./inject.sh
#
# Based on a template by BASH3 Boilerplate v2.0.0
# http://bash3boilerplate.sh/#authors
#
# The MIT License (MIT)
# Copyright (c) 2013 Kevin van Zonneveld and contributors
# You are not obligated to bundle the LICENSE file with your b3bp projects as long
# as you leave these references intact in the header comments of your source files.
# Exit on error. Append || true if you expect an error.
set -o errexit
# Exit on error inside any functions or subshells.
set -o errtrace
# Do not allow use of undefined vars. Use ${VAR:-} to use an undefined VAR
set -o nounset
# Catch the error in case mysqldump fails (but gzip succeeds) in `mysqldump |gzip`
set -o pipefail
# Turn on traces, useful while debugging but commented out by default
# set -o xtrace
# Set magic variables for current file, directory, os, etc.
__dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
__file="${__dir}/$(basename "${BASH_SOURCE[0]}")"
__base="$(basename ${__file} .sh)"
# Offer the main template for download as http://bash3boilerplate.sh/main.sh
cp -v main.sh website/
for doc in "README" "FAQ" "CHANGELOG"; do
targetName="$(echo "${doc}" | awk '{print tolower($0)}')"
permalink="/${targetName}/"
subtitle="$(tr '[:lower:]' '[:upper:]' <<< ${targetName:0:1})${targetName:1} | "
redirectFrom="/${doc}.md/"
backLink="\n\n<a href=\"/\">&laquo; Home</a>"
if [ "${doc}" = "README" ]; then
targetName="index"
permalink="/"
subtitle=""
redirectFrom="nothing"
backLink=""
fi
cat <<EOF > website/${targetName}.md
---
layout: default
permalink: ${permalink}
redirect_from: ${redirectFrom}
title: ${subtitle}BASH3 Boilerplate Template for writing better Bash scripts
warning: This page is generated by ${__base}.sh based on ${doc}.md, please don't edit ${targetName}.md directly.
---
EOF
# If '<!--more-->' exists, only inject what comes after it, so you can have e.g. a ToC or buildbuttons
# on GitHub, without that also rendering in the site (site may have its own ToC rendering for instance)
if grep '<!--more-->' ${doc}.md; then
cat ${doc}.md |sed -n -e '/<!--more-->/,$p' | tail -n +2 >> website/${targetName}.md
else
cat ${doc}.md >> website/${targetName}.md
fi
# Add a "<- Back Home" link, if any
echo -e $backLink >> website/${targetName}.md
echo "--> written website/${targetName}.md"
done