add scripts

This commit is contained in:
George Cushen 2019-02-20 17:55:45 +00:00
parent 8a4c5c482f
commit 1d6e6e629e
3 changed files with 87 additions and 3 deletions

36
scripts/init_kickstart.sh Normal file
View File

@ -0,0 +1,36 @@
#!/usr/bin/env bash
# WARNING: this will reset the project to the Kickstart template!
# Update Academic
source ../update_academic.sh
#################################################
# Install demo config
rsync -av ../themes/academic/exampleSite/config/ ../config/
# Install demo user
rsync -av ../themes/academic/exampleSite/content/author/ ../content/author/
# Install an example instance of each widget type
rsync -av --exclude gallery/ ../themes/academic/exampleSite/content/home/ ../content/home/
# Install indices
rsync -av ../themes/academic/exampleSite/content/post/_index.md ../content/post/_index.md
rsync -av ../themes/academic/exampleSite/content/publication/_index.md ../content/publication/_index.md
rsync -av ../themes/academic/exampleSite/content/talk/_index.md ../content/talk/_index.md
# Skip static dir - do not import the demo's media library
#################################################
# Post processing
# Deactivate Hero
sed -i '' -e 's/active = true/active = false/' ../content/home/hero.md
# Manual Steps:
# - content/home/project.md: Re-comment out project widget filters
# - content/home/teaching.md: Re-modify title and content & set gradient background instead of image
# - content/home/hero.md: Clear `hero_media` value & set gradient background instead of image

View File

@ -1,10 +1,55 @@
#!/usr/bin/env bash
# Display available updates to Academic.
# Source Themes Academic: Theme updater
# Checks for available updates and then asks to install any updates.
# https://sourcethemes.com/academic/
#
# Command: bash ./update_academic.sh
# Check for prerequisites.
if [ ! -d .git ]; then
echo "ERROR: This tool is for Git repositories only."
exit 1;
fi
# Function to update Academic
function install_update () {
# Apply any updates
git submodule update --remote --merge
# - Update Netlify.toml with required Hugo version
if [ -f ./netlify.toml ]; then
version=$(sed -n 's/^min_version = //p' themes/academic/theme.toml)
sed -i '' -e "s/HUGO_VERSION = .*/HUGO_VERSION = $version/g" ./netlify.toml
fi
echo
echo "View the release notes at: https://sourcethemes.com/academic/updates"
echo "If there are breaking changes, the config and/or front matter of content" \
"may need upgrading by following the steps in the release notes."
}
# Display currently installed version (although could be between versions if updated to master rather than tag)
version=$(sed -n 's/^version = "//p' themes/academic/data/academic.toml)
echo -e "Source Themes Academic v$version\n"
# Display available updates
echo -e "Checking for updates...\n"
cd themes/academic
git fetch
git log --pretty=oneline --abbrev-commit --decorate HEAD..origin/master
cd ../../
# Update Academic.
git submodule update --remote --merge
title="Do you wish to install the above updates?"
prompt="Choose an option and press Enter:"
options=("Yes" "No")
echo "$title"
PS3="$prompt "
select opt in "${options[@]}"; do
case $opt in
Yes ) install_update; break;;
No ) break;;
* ) break;;
esac
done

3
view.sh Executable file
View File

@ -0,0 +1,3 @@
#!/usr/bin/env bash
hugo --i18n-warnings server