Skip to content
This repository has been archived by the owner on Jan 30, 2020. It is now read-only.

Commit

Permalink
Merge pull request #42 from paulbouwer/41-set-active-version
Browse files Browse the repository at this point in the history
Issue #41 - Set version as active when installing (if only one)
  • Loading branch information
paulbouwer committed Feb 21, 2015
2 parents 3c3b946 + 6bcdfe4 commit 183ebb4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
9 changes: 8 additions & 1 deletion src/bin/svm
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@ _svm_install_version() {
local nuget_package=""
local download_path=""
local nuget_package_path=""
local installed_version_count=0

install_version_info=$(_svm_get_installversion_info "$version")
record_url=$(_svm_parse_url_from_installversioninfo_record "$install_version_info")
Expand All @@ -285,7 +286,13 @@ _svm_install_version() {
# remove download folder - with safety check that path starts with temp folder
if [[ $download_path == $TEMP_PATH* ]]; then rm -fr $download_path; fi
_svm_info_message "Version '$version' is now available."
_svm_info_message "Consider using svm use <version> to set it as the active scriptcs version."

installed_version_count=`ls "$VERSIONS_PATH" | wc -l`
if [ $installed_version_count -eq 1 ]; then
_svm_use_version "$version"
else
_svm_info_message "Consider using svm use <version> to set it as the active scriptcs version."
fi

else
_svm_error_message "Version '$version' is already installed in versions folder '$VERSIONS_PATH'."
Expand Down
9 changes: 8 additions & 1 deletion src/bin/svm.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,14 @@ function Svm-InstallVersion
Remove-Item -Recurse -Force $downloadPath

Write-InfoMessage "Version '$version' is now available."
Write-InfoMessage "Consider using svm use <version> to set it as the active scriptcs version."
if ((Get-ChildItem $versionsPath -Directory -ErrorAction SilentlyContinue).Count -eq 1)
{
Svm-UseVersion $version
}
else
{
Write-InfoMessage "Consider using svm use <version> to set it as the active scriptcs version."
}
}

function Svm-RemoveVersion
Expand Down

0 comments on commit 183ebb4

Please sign in to comment.