Skip to content

Commit eae1ed4

Browse files
felipecrsMarco Vermeulen
authored andcommitted
Do not return error when package is already installed
1 parent 59ef424 commit eae1ed4

File tree

5 files changed

+9
-6
lines changed

5 files changed

+9
-6
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,4 @@ mongo.json
1818
out/
1919
sdkman-cli.iml
2020
target/
21+
bin/test/

src/main/bash/sdkman-install.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ function __sdk_install() {
2828

2929
if [[ -d "${SDKMAN_CANDIDATES_DIR}/${candidate}/${VERSION}" || -L "${SDKMAN_CANDIDATES_DIR}/${candidate}/${VERSION}" ]]; then
3030
echo ""
31-
__sdkman_echo_red "Stop! ${candidate} ${VERSION} is already installed."
32-
return 1
31+
__sdkman_echo_yellow "${candidate} ${VERSION} is already installed."
32+
return 0
3333
fi
3434

3535
if [[ ${VERSION_VALID} == 'valid' ]]; then

src/test/cucumber/install_candidate.feature

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ Feature: Install Candidate
3535
And the candidate "grails" version "1.3.9" is available for download
3636
And the candidate "grails" version "1.3.9" is already installed and default
3737
When I enter "sdk install grails 1.3.9"
38-
Then I see "Stop! grails 1.3.9 is already installed."
39-
And the exit code is 1
38+
Then I see "grails 1.3.9 is already installed."
39+
And the exit code is 0
4040

4141
Scenario: Install a candidate and auto-answer to make it default
4242
Given the system is bootstrapped

src/test/cucumber/local_developement_versions.feature

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ Feature: Local Development Versions
1717
And the candidate "groovy" version "2.1-SNAPSHOT" is already linked to "/tmp/groovy-core"
1818
And the system is bootstrapped
1919
When I enter "sdk install groovy 2.1-SNAPSHOT /tmp/groovy-core"
20-
Then I see "Stop! groovy 2.1-SNAPSHOT is already installed."
20+
Then I see "groovy 2.1-SNAPSHOT is already installed."
21+
And the exit code is 0
2122
And the candidate "groovy" version "2.1-SNAPSHOT" is linked to "/tmp/groovy-core"
2223

2324
Scenario: Uninstall a local development version

src/test/cucumber/service_unavailable.feature

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@ Feature: Service Unavailable
6868
Given the candidate "grails" version "2.1.0" is already installed and default
6969
And the system is bootstrapped
7070
When I enter "sdk install grails 2.1.0"
71-
Then I see "Stop! grails 2.1.0 is already installed."
71+
Then I see "grails 2.1.0 is already installed."
72+
And the exit code is 0
7273

7374
# uninstall command
7475

0 commit comments

Comments
 (0)