Skip to content

Instantly share code, notes, and snippets.

@ohmybrew ohmybrew/buster.sh
Last active Feb 21, 2018

Embed
What would you like to do?
Buster for Ghost
#!/bin/bash
echo "Clearing static folder"
rm -rf static/*;
echo "Generating static content..."
buster generate
echo "Fixing links to https"
find static -name *.html -type f -exec sed -i -e 's#http://localhost:2368#https://ohmybrew.com#g' {} \;
find static -name *.css -type f -exec sed -i -e 's#http://fonts.gstatic.com#https://fonts.gstatic.com#g' {} \;
find static -name *.html -type f -exec sed -i -e 's#http://code.jquery.com#https://code.jquery.com#' {} \;
echo "Fixing some blog posts"
find static -name *.html -type f -exec sed -i -e 's#open https://ohmybrew.com#open http://localhost:2368#g' {} \;
find static -name *.html -type f -exec sed -i -e 's#domain=https://ohmybrew.com#domain=http://localhost:2368#g' {} \;
find static -name *.html -type f -exec sed -i -e 's#s\#https://ohmybrew.com#s\#http://localhost:2368#g' {} \;
echo "Removing index.html from links"
find static -name *.html -type f -exec sed -i -e 's#/index.html#/#g' {} \;
echo "Fixing other files"
find -E static -regex '.*\.(xml|xsl|txt)' -type f -exec sed -i -e 's#http://localhost:2368#https://ohmybrew.com#g' {} \;
find -E static -regex '.*\.(xml|xsl|txt)' -type f -exec sed -i -e 's#localhost:2368#ohmybrew.com#g' {} \;
echo "Remove all sed generated files"
find -E static -regex '(.*)-e' -type f -exec rm {} \;
echo "Move files from copy static"
cp copy/* static/;
if [ "$1" == "--deploy" ]; then
buster deploy
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.