Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
soraxas committed May 29, 2020
1 parent adc9c19 commit 6c1fe46
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 2 deletions.
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

0 comments on commit 6c1fe46

Please sign in to comment.