1
0
Fork 0

rename to omz-update

pull/5/head
Jonathan Dahan 13 years ago
parent e20c0578b1
commit 8559ad0ce7

@ -0,0 +1,40 @@
# Updates oh-my-zsh.
# Jonathan Dahan <jonathan@jedahan.com>
# This plugin adds auto-update support to omz.
#
# zstyle ':omz:plugin:update-omz' auto-commit 'yes'
# auto-commit will commit whatever upstream changes there are without review
# This will still favor local changes when conflict arive
#
# zstyle ':omz:plugin:update-omz' auto-update 'yes'
# auto-update will check for updates 6 hours from the last successful upgrade
function update-omz() {
current_path=$PWD
cd $HOME/.oh-my-zsh
zstyle -t ':omz:plugin:update-omz' auto-commit || local nocommit='--no-commit'
if git pull $nocommit --strategy=recursive -X ours origin master; then
zstyle -t ':omz:plugin:update-omz' color && printf "$FG[blue]"
printf 'Hooray! oh-my-zsh is up-to-date :)'
touch ~/.omz-update
else
zstyle -t ':omz:plugin:update-omz' color && printf "$FG[red]"
printf 'Oh no! There was an error updating oh-my-zsh :('
fi
cd "$current_path"
}
if zstyle -t ':omz:plugin:update-omz' auto-update; then
if [ -f ~/.omz-update ]; then
# update if ~/.omz-update was modified over 6 hours ago
if [ ~/.omz-update(Nmh+6) ]; then
update-omz
fi
else
update-omz
fi
fi

@ -1,45 +0,0 @@
# ------------------------------------------------------------------------------
# FILE: upgrade-oh-my-zsh.plugin.zsh
# DESCRIPTION: oh-my-zsh plugin file.
# AUTHOR: Jonathan Dahan <jonathan@jedahan.com>
# VERSION: 0.3.0
# ------------------------------------------------------------------------------
# This plugin adds upgrade_zsh(), a relatively safe manual upgrade.
# It also has two dangerous options that are off by default.
#
# zstyle ':omz:plugin:upgrade' auto-commit 'yes'
# auto-commit will commit whatever upstream changes there are without review
# This will still favor local changes when conflict arive
#
# zstyle ':omz:plugin:upgrade' auto-upgrade 'yes'
# auto-upgrade will check for updates 6 hours from the last successful upgrade
function upgrade_zsh() {
cd ~/.oh-my-zsh
current_path=$PWD
zstyle -t ':omz:plugin:update-omz' auto-commit || local nocommit='--no-commit'
if git pull $nocommit --strategy=recursive -X ours origin master; then
zstyle -t ':omz:plugin:update-omz' color && printf "$FG[blue]"
printf 'Hooray! oh-my-zsh is up-to-date :)'
touch ~/.zsh-upgrade
else
printf 'Oh no! There was an error upgrading oh-my-zsh :('
zstyle -t ':omz:plugin:update-omz' color && printf "$FG[red]"
fi
cd "$current_path"
}
if zstyle -t ':omz:plugin:upgrade' auto-upgrade; then
if [ -f ~/.zsh-upgrade ]; then
# upgrade if ~/.zsh-update was modified over 6 hours ago
if [ ~/.zsh-upgrade(Nmh+6) ]; then
upgrade_zsh
fi
else
upgrade_zsh
fi
fi
Loading…
Cancel
Save