Skip to content

Instantly share code, notes, and snippets.

@mslinn
Last active March 21, 2022 23:05
Show Gist options
  • Save mslinn/7a24efbcd675b5e53038497a1cde3ef7 to your computer and use it in GitHub Desktop.
Save mslinn/7a24efbcd675b5e53038497a1cde3ef7 to your computer and use it in GitHub Desktop.
Edit all Jekyll projects, one after the other, and rebuild each one
#!/bin/bash
set -e
# Commit changes, the comment does not matter, we are iterating over many files
function commit {
git add -A
git commit -m -
git push
}
function process_one {
commit
git pull
code .
read -p "Press Enter to continue working on the next project, Control-C to stop. "
commit
bundle install
NAME="$( basename -s .git "$( git remote get-url origin )" )"
gem uninstall "$NAME" -aIx --user-install --force
rake install:local
}
function process_all_files {
FILES=$( find "$jekyll/my_plugins" -maxdepth 1 -type d | tail -n +2 )
COUNT=$( echo "$FILES" | wc -l )
INDEX=1
HIGHLIGHT="\e[01;34m"
NORMAL='\e[00m'
for FILE in $FILES; do
printf "\n\n${HIGHLIGHT}#${INDEX}/${COUNT}: $( basename $X )$NORMAL\n"
cd "$FILE" > /dev/null
process_one "$@"
cd - > /dev/null
INDEX=$((INDEX+1))
done
}
process_all_files "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment