diff --git a/README.md b/README.md index 883f30a..1190163 100644 --- a/README.md +++ b/README.md @@ -20,9 +20,7 @@ This is the open source implementation of the [LinkeData.Center SDaaS™ product ``` docker compose up -d --build -docker compose exec cli sdaas -bats tests/{unit,functional,system} -exit +docker compose exec cli sdaas bats tests/{unit,functional,system} docker compose down ``` @@ -92,10 +90,10 @@ To push a new docker image to docker hub: ``` docker login # input the docker hub credentials... -VERSION="4.0.0-rc1" -docker build -t linkeddatacenter/sdaas-ce:4.0.0-rc1 . -docker tag linkeddatacenter/sdaas-ce:4.0.0-rc1 linkeddatacenter/sdaas-ce -docker push linkeddatacenter/sdaas-ce:4.0.0-rc1 +VERSION="4.0.0-rc2" +docker build -t linkeddatacenter/sdaas-ce:$VERSION . +docker tag linkeddatacenter/sdaas-ce:$VERSION linkeddatacenter/sdaas-ce +docker push linkeddatacenter/sdaas-ce:$VERSION docker push linkeddatacenter/sdaas-ce:latest ``` diff --git a/modules/core b/modules/core index 2e4aed0..3000331 100644 --- a/modules/core +++ b/modules/core @@ -107,6 +107,13 @@ sd_abort() { exit 2 } +sd_return_first_non_zero() { + for element in "$@"; do + if [[ $element -ne 0 ]]; then + return $element + fi + done +} sd_include() { local forceFlag=0 diff --git a/tests/unit/coreTest.bats b/tests/unit/coreTest.bats index 24c1c70..257d09c 100644 --- a/tests/unit/coreTest.bats +++ b/tests/unit/coreTest.bats @@ -119,3 +119,21 @@ function teardown { [ "$status" -eq 0 ] [[ "${lines[0]}" == "http%3A%2F%2Fw3.org%2F%3Ftest%23name" ]] } + + +########## sd_return_first_non_zero + +@test "sd_return_first_non_zero" { + + #run sd_return_first_non_zero 0 + #[ "$status" -eq 0 ] + + run sd_return_first_non_zero 0 0 0 0 + [ "$status" -eq 0 ] + + run sd_return_first_non_zero 0 1 2 3 + [ "$status" -eq 1 ] + + run sd_return_first_non_zero 0 0 2 3 + [ "$status" -eq 2 ] +}