Reorganize + give scripts appropriate extension

This commit is contained in:
Henrik Lissner 2015-12-13 06:46:47 -05:00
parent 4d2b9a0d14
commit 8fff11535e
4 changed files with 59 additions and 31 deletions

View file

@ -7,7 +7,7 @@
~/.vim/install.sh ~/.vim/install.sh
shopt -s extglob shopt -s extglob
for rcfile in "$HOME"/.dotfiles/!(bin|scripts|README.md|Gemfile*); do for rcfile in "$HOME"/.dotfiles/!(bin|scripts|README.md|install.sh|Gemfile*); do
filep="$HOME/."$(basename "$rcfile") filep="$HOME/."$(basename "$rcfile")
[ "$1" == "--force" ] && rm -f "$filep" [ "$1" == "--force" ] && rm -f "$filep"

View file

@ -1,4 +1,4 @@
#!/bin/sh #!/usr/bin/env zsh
# A cleanup script for attachments in my org-mode notes. # A cleanup script for attachments in my org-mode notes.
@ -20,7 +20,7 @@ is_orphaned_file() {
ag -Q "$1" >/dev/null ag -Q "$1" >/dev/null
} }
if [ "$1" == "-n" ]; then if [[ "$1" == "-n" ]]; then
DRY_RUN=1 DRY_RUN=1
echo "Running dry run!" echo "Running dry run!"
fi fi
@ -29,7 +29,7 @@ for folder in $(attachment_dirs); do
cd "$folder" cd "$folder"
for file in $(attachments_in_dir "$folder"); do for file in $(attachments_in_dir "$folder"); do
if ! is_orphaned_file "$file"; then if ! is_orphaned_file "$file"; then
[ -z "$DRY_RUN" ] && rm -f "$file" [[ -z "$DRY_RUN" ]] && rm -f "$file"
echo "Deleted '$file'" echo "Deleted '$file'"
fi fi
done done

View file

@ -1,27 +0,0 @@
#!/bin/zsh
set -e
brew update && brew upgrade --all
cd "$HOME/.emacs.d" && make update
local i
if [ -d ~/.rbenv ]; then
cd "$HOME/.rbenv" && git pull
for i in "$HOME"/.rbenv/plugins/*; do
cd "$i" && git pull
done
fi
if [ -d ~/.pyenv ]; then
cd "$HOME/.pyenv" && git pull
for i in "$HOME"/.pyenv/plugins/*; do
cd "$i" && git pull
done
fi
if [ -d ~/.zsh/zgen ]; then
source ~/.zsh/zgen/zgen.zsh
zgen selfupdate
zgen update
fi

55
scripts/update.zsh Executable file
View file

@ -0,0 +1,55 @@
#!/usr/bin/env zsh
set -e
indent() { sed 's/^/ /'; }
up-to-date() {
LOCAL=$(git rev-parse @)
REMOTE=$(git rev-parse @{u})
[[ "$LOCAL" == "$REMOTE" ]]
}
(( $+commands[brew] )) && {
echo "Updating homebrew"
{ brew update && brew upgrade --all; } | indent
}
[[ -f "$HOME/.emacs.d/Makefile" ]] && {
echo -n "Updating emacs"
cd "$HOME/.emacs.d" && make update | indent
}
local env=(rb py)
for i in $env
do
[[ -d "$HOME/.${i}env" ]] && {
echo "Updating ${i}env"
{
if ! up-to-date; then
echo "UPDATING"
git pull > /dev/null
fi
{
for plugin in "$HOME"/.${i}env/plugins/*
do
cd "$plugin"
if ! up-to-date; then
echo "+ UPDATING `basename ${plugin}`"
git pull > /dev/null
fi
done
} 2&>1 | indent
} 2&>1 | indent
}
done
[[ -d ~/.zsh/zgen ]] && {
echo "Updating zgen"
{
source "$HOME/.zsh/zgen/zgen.zsh"
zgen selfupdate
zgen update
} 2&>1 | indent
}