There was a bug where changed files would be `git pull`ed into the
current working directory instead of the proper plugin directory,
which is now fixed. Also, added some very basic logging to /tmp
zpe_config_dir="${HOME}/.config/zpe/"
zpe_plugin_dir="${zpe_config_dir}/plugins/"
zpe_tmp_dir="/tmp/zpe/"
zpe_config_dir="${HOME}/.config/zpe/"
zpe_plugin_dir="${zpe_config_dir}/plugins/"
zpe_tmp_dir="/tmp/zpe/"
+zpe_log_dir="/tmp/zpe/logs"
zpe-meta-pre() {
# Create necesary directories, check dependencies
[[ -d "${zpe_config_dir}" ]] || mkdir -p "${zpe_config_dir}"
[[ -d "${zpe_plugin_dir}" ]] || mkdir -p "${zpe_plugin_dir}"
zpe-meta-pre() {
# Create necesary directories, check dependencies
[[ -d "${zpe_config_dir}" ]] || mkdir -p "${zpe_config_dir}"
[[ -d "${zpe_plugin_dir}" ]] || mkdir -p "${zpe_plugin_dir}"
- [[ -d /tmp/zpe ]] || mkdir ${zpe_tmp_dir}
+ [[ -d "${zpe_tmp_dir}" ]] || mkdir ${zpe_tmp_dir}
+ [[ -d "${zpe_log_dir}" ]] || mkdir ${zpe_log_dir}
touch "${zpe_config_dir}"repositories
touch "${zpe_config_dir}"repositories
- [[ -x git ]] && echo "please install git"
+ [[ -x git ]] && echo "Please install git"
}
zpe-clone() {
# Clone all the repos in the config file recursively into the plugin directory
zpe-meta-pre
}
zpe-clone() {
# Clone all the repos in the config file recursively into the plugin directory
zpe-meta-pre
- cat ${zpe_config_dir}repositories | xargs -P10 -I{} git -C ${zpe_plugin_dir} clone {}
- echo "all plugins are downloaded"
+ cat ${zpe_config_dir}repositories | xargs -P10 -I{} git -C ${zpe_plugin_dir} clone {} -q --depth 1 &> "${zpe_log_dir}"/$(date -Iseconds)
+ echo "All plugins are downloaded"
}
zpe-pull() {
# Recursively pull
zpe-meta-pre
local find_dirs=$(find "${zpe_plugin_dir}" -name ".git" -type d)
}
zpe-pull() {
# Recursively pull
zpe-meta-pre
local find_dirs=$(find "${zpe_plugin_dir}" -name ".git" -type d)
- echo $find_dirs | xargs -P10 -I{} git --git-dir={} config pull.ff only
- echo $find_dirs | xargs -P10 -I{} git --git-dir={} pull > /dev/null
- echo "all plugins are up to date"
+ echo $find_dirs | xargs -P10 -I {} git --git-dir={} config pull.ff only
+ echo $find_dirs | xargs -P10 -I {} git --git-dir={} --work-tree={} pull &> "${zpe_log_dir}"/$(date -Iseconds)
+ echo "All plugins are up to date"
}
zpe-clean() {
# Remove cloned plugins not specified in the config file
zpe-meta-pre
}
zpe-clean() {
# Remove cloned plugins not specified in the config file
zpe-meta-pre
- echo -n "" > "${zpe_tmp_dir}"deletable
- echo -n "" > "${zpe_tmp_dir}"diff
-
find ${zpe_plugin_dir} -maxdepth 1 -type d -exec git -C {} config --get remote.origin.url \; > "${zpe_tmp_dir}"installed-urls
find ${zpe_plugin_dir} -maxdepth 1 -type d -exec git -C {} config --get remote.origin.url \; > "${zpe_tmp_dir}"installed-urls
- comm -23 <(sort ${zpe_tmp_dir}installed-urls) <(sort "${zpe_config_dir}"repositories) >> "${zpe_tmp_dir}"/diff
+ comm -23 <(sort ${zpe_tmp_dir}installed-urls) <(sort "${zpe_config_dir}"repositories) > "${zpe_tmp_dir}"/diff
+ echo -n "" > "${zpe_tmp_dir}"deletable
while read line; do
grep -l $line "$zpe_plugin_dir"/*/.git/config >> "${zpe_tmp_dir}"deletable
done < ${zpe_tmp_dir}diff
while read line; do
grep -l $line "$zpe_plugin_dir"/*/.git/config >> "${zpe_tmp_dir}"deletable
done < ${zpe_tmp_dir}diff