Skip to content

Commit 1d6e6e6

Browse files
committed
add scripts
1 parent 8a4c5c4 commit 1d6e6e6

File tree

3 files changed

+87
-3
lines changed

3 files changed

+87
-3
lines changed

scripts/init_kickstart.sh

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/usr/bin/env bash
2+
3+
# WARNING: this will reset the project to the Kickstart template!
4+
5+
# Update Academic
6+
source ../update_academic.sh
7+
8+
#################################################
9+
10+
# Install demo config
11+
rsync -av ../themes/academic/exampleSite/config/ ../config/
12+
13+
# Install demo user
14+
rsync -av ../themes/academic/exampleSite/content/author/ ../content/author/
15+
16+
# Install an example instance of each widget type
17+
rsync -av --exclude gallery/ ../themes/academic/exampleSite/content/home/ ../content/home/
18+
19+
# Install indices
20+
rsync -av ../themes/academic/exampleSite/content/post/_index.md ../content/post/_index.md
21+
rsync -av ../themes/academic/exampleSite/content/publication/_index.md ../content/publication/_index.md
22+
rsync -av ../themes/academic/exampleSite/content/talk/_index.md ../content/talk/_index.md
23+
24+
# Skip static dir - do not import the demo's media library
25+
26+
#################################################
27+
28+
# Post processing
29+
30+
# Deactivate Hero
31+
sed -i '' -e 's/active = true/active = false/' ../content/home/hero.md
32+
33+
# Manual Steps:
34+
# - content/home/project.md: Re-comment out project widget filters
35+
# - content/home/teaching.md: Re-modify title and content & set gradient background instead of image
36+
# - content/home/hero.md: Clear `hero_media` value & set gradient background instead of image

update_academic.sh

+48-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,55 @@
11
#!/usr/bin/env bash
22

3-
# Display available updates to Academic.
3+
# Source Themes Academic: Theme updater
4+
# Checks for available updates and then asks to install any updates.
5+
# https://sourcethemes.com/academic/
6+
#
7+
# Command: bash ./update_academic.sh
8+
9+
# Check for prerequisites.
10+
if [ ! -d .git ]; then
11+
echo "ERROR: This tool is for Git repositories only."
12+
exit 1;
13+
fi
14+
15+
# Function to update Academic
16+
function install_update () {
17+
# Apply any updates
18+
git submodule update --remote --merge
19+
20+
# - Update Netlify.toml with required Hugo version
21+
if [ -f ./netlify.toml ]; then
22+
version=$(sed -n 's/^min_version = //p' themes/academic/theme.toml)
23+
sed -i '' -e "s/HUGO_VERSION = .*/HUGO_VERSION = $version/g" ./netlify.toml
24+
fi
25+
26+
echo
27+
echo "View the release notes at: https://sourcethemes.com/academic/updates"
28+
echo "If there are breaking changes, the config and/or front matter of content" \
29+
"may need upgrading by following the steps in the release notes."
30+
}
31+
32+
# Display currently installed version (although could be between versions if updated to master rather than tag)
33+
version=$(sed -n 's/^version = "//p' themes/academic/data/academic.toml)
34+
echo -e "Source Themes Academic v$version\n"
35+
36+
# Display available updates
37+
echo -e "Checking for updates...\n"
438
cd themes/academic
539
git fetch
640
git log --pretty=oneline --abbrev-commit --decorate HEAD..origin/master
741
cd ../../
842

9-
# Update Academic.
10-
git submodule update --remote --merge
43+
title="Do you wish to install the above updates?"
44+
prompt="Choose an option and press Enter:"
45+
options=("Yes" "No")
46+
47+
echo "$title"
48+
PS3="$prompt "
49+
select opt in "${options[@]}"; do
50+
case $opt in
51+
Yes ) install_update; break;;
52+
No ) break;;
53+
* ) break;;
54+
esac
55+
done

view.sh

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/usr/bin/env bash
2+
3+
hugo --i18n-warnings server

0 commit comments

Comments
 (0)