⬆️ dnvm.ps1, dnvm.cmd, dnvm.sh

Source: AspNet/kvm@82929ba8a1
This commit is contained in:
ASP.NET Push Bot 2015-03-27 17:19:01 -07:00 committed by unknown
parent 8373764c61
commit c6547cce2a
2 changed files with 50 additions and 27 deletions

View File

@ -59,7 +59,7 @@ function _WriteOut {
### Constants ### Constants
$ProductVersion="1.0.0" $ProductVersion="1.0.0"
$BuildVersion="beta4-10347" $BuildVersion="beta5-10350"
$Authors="Microsoft Open Technologies, Inc." $Authors="Microsoft Open Technologies, Inc."
# If the Version hasn't been replaced... # If the Version hasn't been replaced...
@ -511,7 +511,7 @@ function Unpack-Package([string]$DownloadFile, [string]$UnpackFolder) {
try { try {
# Shell will not recognize nupkg as a zip and throw, so rename it to zip # Shell will not recognize nupkg as a zip and throw, so rename it to zip
$runtimeZip = [System.IO.Path]::ChangeExtension($DownloadFile, "zip") $runtimeZip = [System.IO.Path]::ChangeExtension($DownloadFile, "zip")
Rename-Item $runtimeFile $runtimeZip Rename-Item $DownloadFile $runtimeZip
# Use the shell to uncompress the nupkg # Use the shell to uncompress the nupkg
$shell_app=new-object -com shell.application $shell_app=new-object -com shell.application
$zip_file = $shell_app.namespace($runtimeZip) $zip_file = $shell_app.namespace($runtimeZip)
@ -1059,7 +1059,12 @@ function dnvm-install {
else { else {
_WriteOut "Compiling native images for $runtimeFullName to improve startup performance..." _WriteOut "Compiling native images for $runtimeFullName to improve startup performance..."
Write-Progress -Activity "Installing runtime" "Generating runtime native images" -Id 1 Write-Progress -Activity "Installing runtime" "Generating runtime native images" -Id 1
if ($DebugPreference -eq 'SilentlyContinue') {
Start-Process $CrossGenCommand -Wait -WindowStyle Hidden Start-Process $CrossGenCommand -Wait -WindowStyle Hidden
}
else {
Start-Process $CrossGenCommand -Wait -NoNewWindow
}
_WriteOut "Finished native image compilation." _WriteOut "Finished native image compilation."
} }
} }
@ -1173,6 +1178,40 @@ function dnvm-name {
Get-RuntimeName $VersionOrAlias $Architecture $Runtime Get-RuntimeName $VersionOrAlias $Architecture $Runtime
} }
# Checks if a specified file exists in the destination folder and if not, copies the file
# to the destination folder.
function Safe-Filecopy {
param(
[Parameter(Mandatory=$true, Position=0)] $Filename,
[Parameter(Mandatory=$true, Position=1)] $SourceFolder,
[Parameter(Mandatory=$true, Position=2)] $DestinationFolder)
# Make sure the destination folder is created if it doesn't already exist.
if(!(Test-Path $DestinationFolder)) {
_WriteOut "Creating destination folder '$DestinationFolder' ... "
New-Item -Type Directory $Destination | Out-Null
}
$sourceFilePath = Join-Path $SourceFolder $Filename
$destFilePath = Join-Path $DestinationFolder $Filename
if(Test-Path $sourceFilePath) {
_WriteOut "Installing '$Filename' to '$DestinationFolder' ... "
if (Test-Path $destFilePath) {
_WriteOut " Skipping: file already exists" -ForegroundColor Yellow
}
else {
Copy-Item $sourceFilePath $destFilePath -Force
}
}
else {
_WriteOut "WARNING: Unable to install: Could not find '$Filename' in '$SourceFolder'. "
}
}
<# <#
.SYNOPSIS .SYNOPSIS
Installs the version manager into your User profile directory Installs the version manager into your User profile directory
@ -1191,28 +1230,12 @@ function dnvm-setup {
$ScriptFolder = Split-Path -Parent $ScriptPath $ScriptFolder = Split-Path -Parent $ScriptPath
if(!(Test-Path $Destination)) { # Copy script files (if necessary):
New-Item -Type Directory $Destination | Out-Null Safe-Filecopy "$CommandName.ps1" $ScriptFolder $Destination
} Safe-Filecopy "$CommandName.cmd" $ScriptFolder $Destination
$ps1Command = Join-Path $ScriptFolder "$CommandName.ps1"
if(Test-Path $ps1Command) {
_WriteOut "Installing '$CommandName.ps1' to '$Destination' ..."
Copy-Item $ps1Command $Destination -Force
} else {
_WriteOut "WARNING: Could not find '$CommandName.ps1' in '$ScriptFolder'. Unable to install!"
}
$cmdCommand = Join-Path $ScriptFolder "$CommandName.cmd"
if(Test-Path $cmdCommand) {
_WriteOut "Installing '$CommandName.cmd' to '$Destination' ..."
Copy-Item $cmdCommand $Destination -Force
} else {
_WriteOut "WARNING: Could not find '$CommandName.cmd' in '$ScriptFolder'. Unable to install!"
}
# Configure Environment Variables # Configure Environment Variables
# Also, clean old user home values if present # Also, clean old user home values if present
# We'll be removing any existing homes, both # We'll be removing any existing homes, both
$PathsToRemove = @( $PathsToRemove = @(
"%USERPROFILE%\$DefaultUserDirectoryName", "%USERPROFILE%\$DefaultUserDirectoryName",

View File

@ -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="beta4-10347" _DNVM_BUILDNUMBER="beta5-10350"
_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"