Add CloudFlare purging helper

This commit is contained in:
Rico Sta. Cruz 2017-10-13 03:58:52 +08:00
parent 5c6a897401
commit b8ee6a8171
No known key found for this signature in database
GPG Key ID: CAAD38AE2962619A
2 changed files with 31 additions and 0 deletions

View File

@ -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
```

23
_support/cf-purge.sh Executable file
View File

@ -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'"