forked from colonelpanic/dotfiles
[Emacs] Delete org-page generating git-hooks
This commit is contained in:
parent
9e56ced1dd
commit
f7c0923500
@ -1,16 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
SOURCE="${BASH_SOURCE[0]}"
|
|
||||||
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
|
|
||||||
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
|
|
||||||
SOURCE="$(readlink "$SOURCE")"
|
|
||||||
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
|
|
||||||
done
|
|
||||||
THIS_DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
|
|
||||||
|
|
||||||
source "$THIS_DIR/../util.sh"
|
|
||||||
|
|
||||||
if readme_was_updated; then
|
|
||||||
update_index
|
|
||||||
commit_index_changes
|
|
||||||
fi
|
|
@ -1,20 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
TOP_LEVEL="$(git rev-parse --show-toplevel)"
|
|
||||||
HOOK_DIR="$TOP_LEVEL/.git/hooks"
|
|
||||||
|
|
||||||
THIS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
||||||
SOURCE_DIR="$THIS_DIR/git-hooks"
|
|
||||||
|
|
||||||
for hook in "$SOURCE_DIR"/*; do
|
|
||||||
filename=$(basename "$hook")
|
|
||||||
source="$SOURCE_DIR/$filename"
|
|
||||||
dest="$HOOK_DIR/$filename"
|
|
||||||
# If the hook already exists, is executable, and is not a symlink
|
|
||||||
if [ -e "$dest" ]; then
|
|
||||||
mv "$dest" "$dest.local"
|
|
||||||
fi
|
|
||||||
echo "linking $source to $dest"
|
|
||||||
ln -s "$source" "$dest"
|
|
||||||
chmod 755 "$dest"
|
|
||||||
done
|
|
@ -1,6 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
THIS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
||||||
source "$THIS_DIR/util.sh"
|
|
||||||
|
|
||||||
update_index
|
|
@ -1,21 +0,0 @@
|
|||||||
# -*- mode: sh -*-
|
|
||||||
EMACS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )"
|
|
||||||
TOP_LEVEL="$(git rev-parse --show-toplevel)"
|
|
||||||
TARGET="$EMACS_DIR/README.org"
|
|
||||||
REPOSITORY_NAME="$(realpath --relative-to="$TOP_LEVEL" "$TARGET")"
|
|
||||||
|
|
||||||
readme_was_updated() {
|
|
||||||
git diff HEAD HEAD~1 --name-only | grep --quiet "$REPOSITORY_NAME"
|
|
||||||
}
|
|
||||||
|
|
||||||
update_index () {
|
|
||||||
emacsclient -e "(with-current-buffer (find-file-noselect \"$TARGET\")
|
|
||||||
(let ((org-export-headline-levels 10))
|
|
||||||
(org-html-export-to-html)))"
|
|
||||||
cp -f "$EMACS_DIR/README.html" "$TOP_LEVEL/index.html"
|
|
||||||
}
|
|
||||||
|
|
||||||
commit_index_changes () {
|
|
||||||
git add "$TOP_LEVEL/index.html"
|
|
||||||
git commit -m "[Emacs] Update github pages index file"
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user