From b8ee6a81711271b977465b6652faadbcee44418c Mon Sep 17 00:00:00 2001 From: "Rico Sta. Cruz" Date: Fri, 13 Oct 2017 03:58:52 +0800 Subject: [PATCH] Add CloudFlare purging helper --- CONTRIBUTING.md | 8 ++++++++ _support/cf-purge.sh | 23 +++++++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100755 _support/cf-purge.sh diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 93d5e4e87..f90514f60 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -89,3 +89,11 @@ So you want to fork this repo? Sure, here's what you need to know to whitelabel - All other GitHub pages gotchas apply (CNAME, etc). - Edit everything in `_data/` - this holds all 'config' for the site: ad IDs, strings, etc. - Edit `_config.yml` as well, lots of things may not apply to you. + +## CloudFlare purging + +The site devhints.io is backed by CloudFlare. Updates will take 2 days to propagate to the website by default. To make sure recent changes will propagate, use this helper script. It will give instructions on how manual selective cache purging can be done. + +```bash +./_support/cf-purge.sh +``` diff --git a/_support/cf-purge.sh b/_support/cf-purge.sh new file mode 100755 index 000000000..d214443f0 --- /dev/null +++ b/_support/cf-purge.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash +# Helper to copy the latest cheatsheets to the clipboard for CloudFlare +# purging. This ensures visitors will see new versions. + +( + git log "master@{3 days ago}..HEAD" --pretty="" --name-only \ + | grep -E '\.md$' \ + | grep -v -E 'CONTRIBUTING|README|Readme' \ + | grep -v -E '^_' \ + | sort \ + | uniq \ + | sed 's/\.md$//g' +) \ + | sed 's#^#https://devhints.io/#g' \ + | xargs echo https://devhints.io/ \ + | pbcopy + +echo "Copied to clipboard." +echo "Purge it here:" +echo "" +echo " https://www.cloudflare.com/a/caching/devhints.io" +echo "" +echo "Then click 'Purge Individual Files'"