Skip to content

Commit

Permalink
Merge pull request #120 from pforret/master
Browse files Browse the repository at this point in the history
implemented 'basher upgrade --all'
  • Loading branch information
juanibiapina authored Mar 7, 2024
2 parents 503d739 + 06bef5c commit 1e53053
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
9 changes: 9 additions & 0 deletions libexec/basher-upgrade
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
24 changes: 24 additions & 0 deletions tests/basher-upgrade.bats
Original file line number Diff line number Diff line change
Expand Up @@ -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" ]
}

0 comments on commit 1e53053

Please sign in to comment.