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

implemented 'basher upgrade --all' #120

Merged
merged 2 commits into from
Mar 7, 2024
Merged
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
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" ]
}
Loading