From f47c2e6d45ef4760ce6556e3a8991e92a0acf421 Mon Sep 17 00:00:00 2001 From: Peter Forret Date: Thu, 29 Feb 2024 22:51:44 +0100 Subject: [PATCH 1/2] implemented 'basher upgrade --all' --- libexec/basher-upgrade | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/libexec/basher-upgrade b/libexec/basher-upgrade index 078b733..f86db17 100755 --- a/libexec/basher-upgrade +++ b/libexec/basher-upgrade @@ -14,6 +14,15 @@ if [ "$1" == "--complete" ]; then exec basher-list fi +if [ "$1" == "--all" ]; then + basher-outdated | + while read -r package; do + echo "# $package" + basher-upgrade "$package" + done + exit 0 +fi + package="$1" if [ -z "$package" ]; then From 06bef5c8ebb4374d536172b0dd66337abbdb9c14 Mon Sep 17 00:00:00 2001 From: Peter Forret Date: Wed, 6 Mar 2024 19:49:16 +0100 Subject: [PATCH 2/2] Added extra test in basher-upgrade.bats --- tests/basher-upgrade.bats | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/tests/basher-upgrade.bats b/tests/basher-upgrade.bats index 07b37ee..b69d743 100644 --- a/tests/basher-upgrade.bats +++ b/tests/basher-upgrade.bats @@ -69,3 +69,27 @@ load test_helper assert [ ! -e "${BASHER_INSTALL_BIN}/second" ] } + +@test "upgrade -all upgrades all packages" { + mock_clone + create_package username/package1 + basher-install username/package1 + create_package username/package2 + basher-install username/package2 + create_exec username/package1 "second" + create_exec username/package2 "second" + + basher-upgrade --all + + run basher-outdated + assert_output "" + + assert [ -e "${BASHER_INSTALL_BIN}/second" ] + + remove_exec username/package1 "second" + run basher-outdated + assert_output "username/package1" + basher-upgrade username/package1 + + assert [ ! -e "${BASHER_INSTALL_BIN}/second" ] +}