Add new tool to build gem

This commit is contained in:
Cotes Chung 2021-01-28 04:57:11 +08:00
parent adc117972a
commit 4a084eb681
3 changed files with 24 additions and 21 deletions

View file

@ -2,9 +2,10 @@
#
# Bump latest version to
# - _sass/jekyll-theme-chirpy.scss
# - assets/js/_commons/_copyright.js
# - assets/js/.copyright.js
# - assets/js/dist/*.js
# - jekyll-theme-chirpy.gemspec
# - package.json
#
# Required: gulp

22
tools/gem.sh Executable file
View file

@ -0,0 +1,22 @@
#!/usr/bin/env bash
#
# Create a ruby-gem pakcage with doc
#
# Required: rubygem, yard
set -eu
GEM_CONFIG="./jekyll-theme-chirpy.gemspec"
if [[ ! -f $GEM_CONFIG ]]; then
echo "Error: .gemspec file not found!"
exit -1
fi
if [[ -d doc ]]; then
rm -rf doc
fi
yard doc
gem build "$GEM_CONFIG"

View file

@ -1,20 +0,0 @@
#!/usr/bin/env bash
#
# Fetch Google Analytics Pageviews reporting cache
# and save as 'assets/data/pagevies.json'
#
# Requirement:
# - jq
# - wget
set -eu
WORK_DIR="$(dirname "$(dirname "$(realpath "$0")")")"
URL_FILE="${WORK_DIR}/_config.yml"
PV_CACHE="${WORK_DIR}/assets/js/data/pageviews.json"
PROXY_URL="$(grep "proxy_endpoint:" "$URL_FILE" | sed "s/.*: '//g;s/'.*//")"
wget "$PROXY_URL" -O "$PV_CACHE"
echo "ls $PV_CACHE"