parent
b1a1f52331
commit
a2a1c637c9
28
dnvm.ps1
28
dnvm.ps1
|
|
@ -67,7 +67,7 @@ function _WriteOut {
|
||||||
|
|
||||||
### Constants
|
### Constants
|
||||||
$ProductVersion="1.0.0"
|
$ProductVersion="1.0.0"
|
||||||
$BuildVersion="beta7-10410"
|
$BuildVersion="beta8-15502"
|
||||||
$Authors="Microsoft Open Technologies, Inc."
|
$Authors="Microsoft Open Technologies, Inc."
|
||||||
|
|
||||||
# If the Version hasn't been replaced...
|
# If the Version hasn't been replaced...
|
||||||
|
|
@ -359,7 +359,7 @@ function Get-RuntimeAlias {
|
||||||
if($Aliases -eq $null) {
|
if($Aliases -eq $null) {
|
||||||
_WriteDebug "Scanning for aliases in $AliasesDir"
|
_WriteDebug "Scanning for aliases in $AliasesDir"
|
||||||
if(Test-Path $AliasesDir) {
|
if(Test-Path $AliasesDir) {
|
||||||
$Aliases = @(Get-ChildItem ($UserHome + "\alias\") | Select-Object @{label='Alias';expression={$_.BaseName}}, @{label='Name';expression={Get-Content $_.FullName }})
|
$Aliases = @(Get-ChildItem ($UserHome + "\alias\") | Select-Object @{label='Alias';expression={$_.BaseName}}, @{label='Name';expression={Get-Content $_.FullName }}, @{label='Orphan';expression={-Not (Test-Path ($RuntimesDir + "\" + (Get-Content $_.FullName)))}})
|
||||||
} else {
|
} else {
|
||||||
$Aliases = @()
|
$Aliases = @()
|
||||||
}
|
}
|
||||||
|
|
@ -396,18 +396,20 @@ function Get-RuntimeAliasOrRuntimeInfo(
|
||||||
filter List-Parts {
|
filter List-Parts {
|
||||||
param($aliases)
|
param($aliases)
|
||||||
|
|
||||||
$binDir = Join-Path $_.FullName "bin"
|
$location = ""
|
||||||
if (!(Test-Path $binDir)) {
|
|
||||||
return
|
$binDir = Join-Path $_.FullName "bin"
|
||||||
|
if ((Test-Path $binDir)) {
|
||||||
|
$location = $_.Parent.FullName
|
||||||
}
|
}
|
||||||
$active = IsOnPath $binDir
|
$active = IsOnPath $binDir
|
||||||
|
|
||||||
$fullAlias=""
|
$fullAlias=""
|
||||||
$delim=""
|
$delim=""
|
||||||
|
|
||||||
foreach($alias in $aliases) {
|
foreach($alias in $aliases) {
|
||||||
if($_.Name.Split('\', 2) -contains $alias.Name) {
|
if($_.Name.Split('\', 2) -contains $alias.Name) {
|
||||||
$fullAlias += $delim + $alias.Alias
|
$fullAlias += $delim + $alias.Alias + (&{if($alias.Orphan){" (missing)"}})
|
||||||
$delim = ", "
|
$delim = ", "
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -416,7 +418,7 @@ filter List-Parts {
|
||||||
$parts2 = $parts1[0].Split('-', 4)
|
$parts2 = $parts1[0].Split('-', 4)
|
||||||
|
|
||||||
if($parts1[0] -eq "$RuntimePackageName-mono") {
|
if($parts1[0] -eq "$RuntimePackageName-mono") {
|
||||||
$parts2 += "linux/darwin"
|
$parts2 += "linux/osx"
|
||||||
$parts2 += "x86/x64"
|
$parts2 += "x86/x64"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -426,7 +428,7 @@ filter List-Parts {
|
||||||
Runtime = $parts2[1]
|
Runtime = $parts2[1]
|
||||||
OperatingSystem = $parts2[2]
|
OperatingSystem = $parts2[2]
|
||||||
Architecture = $parts2[3]
|
Architecture = $parts2[3]
|
||||||
Location = $_.Parent.FullName
|
Location = $location
|
||||||
Alias = $fullAlias
|
Alias = $fullAlias
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -925,7 +927,7 @@ function dnvm-help {
|
||||||
_WriteOut -ForegroundColor $ColorScheme.Help_Header "commands: "
|
_WriteOut -ForegroundColor $ColorScheme.Help_Header "commands: "
|
||||||
Get-Command "$CommandPrefix*" |
|
Get-Command "$CommandPrefix*" |
|
||||||
ForEach-Object {
|
ForEach-Object {
|
||||||
if($Host.Version.MajorVersion -lt 3) {
|
if($Host.Version.Major -lt 3) {
|
||||||
$h = Get-Help $_.Name
|
$h = Get-Help $_.Name
|
||||||
} else {
|
} else {
|
||||||
$h = Get-Help $_.Name -ShowWindow:$false
|
$h = Get-Help $_.Name -ShowWindow:$false
|
||||||
|
|
@ -978,6 +980,10 @@ function dnvm-list {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$aliases | Where-Object {$_.Orphan} | ForEach-Object {
|
||||||
|
$items += $_ | Select-Object @{label='Name';expression={$_.Name}}, @{label='FullName';expression={Join-Path $RuntimesDir $_.Name}} | List-Parts $aliases
|
||||||
|
}
|
||||||
|
|
||||||
if($PassThru) {
|
if($PassThru) {
|
||||||
$items
|
$items
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
23
dnvm.sh
23
dnvm.sh
|
|
@ -2,7 +2,7 @@
|
||||||
# Source this file from your .bash-profile or script to use
|
# Source this file from your .bash-profile or script to use
|
||||||
|
|
||||||
# "Constants"
|
# "Constants"
|
||||||
_DNVM_BUILDNUMBER="beta7-10410"
|
_DNVM_BUILDNUMBER="beta8-15502"
|
||||||
_DNVM_AUTHORS="Microsoft Open Technologies, Inc."
|
_DNVM_AUTHORS="Microsoft Open Technologies, Inc."
|
||||||
_DNVM_RUNTIME_PACKAGE_NAME="dnx"
|
_DNVM_RUNTIME_PACKAGE_NAME="dnx"
|
||||||
_DNVM_RUNTIME_FRIENDLY_NAME=".NET Execution Environment"
|
_DNVM_RUNTIME_FRIENDLY_NAME=".NET Execution Environment"
|
||||||
|
|
@ -736,7 +736,7 @@ dnvm()
|
||||||
[[ ! -d $_DNVM_USER_PACKAGES ]] && echo "$_DNVM_RUNTIME_FRIENDLY_NAME is not installed." && return 1
|
[[ ! -d $_DNVM_USER_PACKAGES ]] && echo "$_DNVM_RUNTIME_FRIENDLY_NAME is not installed." && return 1
|
||||||
|
|
||||||
local searchGlob="$_DNVM_RUNTIME_PACKAGE_NAME-*"
|
local searchGlob="$_DNVM_RUNTIME_PACKAGE_NAME-*"
|
||||||
local runtimes="$(find $_DNVM_USER_PACKAGES -name "$searchGlob" \( -type d -or -type l \) -prune -exec basename {} \; | sort -t. -k2 -k3 -k4 -k1)"
|
local runtimes="$(find $_DNVM_USER_PACKAGES -name "$searchGlob" \( -type d -or -type l \) -prune -exec basename {} \;)"
|
||||||
|
|
||||||
[[ -z $runtimes ]] && echo 'No runtimes installed. You can run `dnvm install latest` or `dnvm upgrade` to install a runtime.' && return
|
[[ -z $runtimes ]] && echo 'No runtimes installed. You can run `dnvm install latest` or `dnvm upgrade` to install a runtime.' && return
|
||||||
|
|
||||||
|
|
@ -752,7 +752,12 @@ dnvm()
|
||||||
local format="%-20s %s\n"
|
local format="%-20s %s\n"
|
||||||
if [ -d "$_DNVM_ALIAS_DIR" ]; then
|
if [ -d "$_DNVM_ALIAS_DIR" ]; then
|
||||||
for __dnvm_file in $(find "$_DNVM_ALIAS_DIR" -name *.alias); do
|
for __dnvm_file in $(find "$_DNVM_ALIAS_DIR" -name *.alias); do
|
||||||
arr[$i]="$(basename $__dnvm_file | sed 's/\.alias//')/$(cat $__dnvm_file)"
|
if [ ! -d "$_DNVM_USER_PACKAGES/$(cat $__dnvm_file)" ]; then
|
||||||
|
arr[$i]="$(basename $__dnvm_file | sed 's/\.alias//')/missing/$(cat $__dnvm_file)"
|
||||||
|
runtimes="$runtimes $(cat $__dnvm_file)"
|
||||||
|
else
|
||||||
|
arr[$i]="$(basename $__dnvm_file | sed 's/\.alias//')/$(cat $__dnvm_file)"
|
||||||
|
fi
|
||||||
let i+=1
|
let i+=1
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
@ -767,8 +772,8 @@ dnvm()
|
||||||
printf "$formatString" "------" "-------" "-------" "----" "---------------" "-----"
|
printf "$formatString" "------" "-------" "-------" "----" "---------------" "-----"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local formattedHome=`(echo $_DNVM_USER_PACKAGES | sed s=$HOME=~=g)`
|
for f in `echo $runtimes | sort -t. -k2 -k3 -k4 -k1`; do
|
||||||
for f in `echo $runtimes`; do
|
local formattedHome=`(echo $_DNVM_USER_PACKAGES | sed s=$HOME=~=g)`
|
||||||
local active=""
|
local active=""
|
||||||
[[ $PATH == *"$_DNVM_USER_PACKAGES/$f/bin"* ]] && local active=" *"
|
[[ $PATH == *"$_DNVM_USER_PACKAGES/$f/bin"* ]] && local active=" *"
|
||||||
local pkgRuntime=$(__dnvm_package_runtime "$f")
|
local pkgRuntime=$(__dnvm_package_runtime "$f")
|
||||||
|
|
@ -780,9 +785,13 @@ dnvm()
|
||||||
local alias=""
|
local alias=""
|
||||||
local delim=""
|
local delim=""
|
||||||
for i in "${arr[@]}"; do
|
for i in "${arr[@]}"; do
|
||||||
if [[ ${i#*/} == "$pkgName.$pkgVersion" ]]; then
|
if [[ ${i##*/} == "$pkgName.$pkgVersion" ]]; then
|
||||||
alias+="$delim${i%/*}"
|
alias+="$delim${i%%/*}"
|
||||||
delim=", "
|
delim=", "
|
||||||
|
if [[ "${i%/*}" =~ \/missing$ ]]; then
|
||||||
|
alias+=" (missing)"
|
||||||
|
formattedHome=""
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue