Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix #28 #84

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions libexec/basher-_deps
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
#
# Usage: basher _deps <package>
# Usage: basher _deps <package> [--get]
# Summary: Globally installs package runtime dependencies
#
# Installs the package dependencies, specified with the
Expand All @@ -10,6 +10,13 @@

set -e

case $1 in
--get)
get_deps="true"
shift
;;
esac

if [ "$#" -ne 1 ]; then
basher-help _deps
exit 1
Expand All @@ -28,5 +35,9 @@ IFS=: read -a deps <<< "$DEPS"

for dep in "${deps[@]}"
do
basher-install "$dep"
if [ -z "$get_deps" ]
basher-install "$dep"
else
echo "$dep"
fi
done
24 changes: 24 additions & 0 deletions libexec/basher-upgrade
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,29 @@ if [ -z "$name" ]; then
exit 1
fi

cd "${BASHER_PACKAGES_PATH}/$package"
git remote update > /dev/null 2>&1
if git symbolic-ref --short -q HEAD > /dev/null; then
if [ "$(git rev-list --count HEAD...HEAD@{upstream})" -eq 0 ]; then
# Exit when no need to upgrades. This also helps to avoid inf recursion even if
# some package happened to set itself to be its own dependencies.
exit
fi
fi

# unlink everything first
basher-_unlink-man "$package"
basher-_unlink-bins "$package"
basher-_unlink-completions "$package"
# upgrade the package
cd "${BASHER_PACKAGES_PATH}/$package"
git pull
# relink the package components
basher-_link-bins "$package"
basher-_link-man "$package"
basher-_link-completions "$package"
# upgrade any dependencies it needs
for dep in $(basher-_deps --get "$package")
do
basher-upgrade "$dep"
done