Restore dnvm scripts (#1761)

* Revert "Remove old artifacts from Home repo (#1754)"

This reverts commit 3b8fc8c650.

* Add back dnvm scripts
This commit is contained in:
Daniel Roth 2016-09-20 09:48:51 -07:00 committed by GitHub
parent 68e1275ab7
commit 96ba72a329
5 changed files with 3095 additions and 0 deletions

10
dnvm.cmd Normal file
View File

@ -0,0 +1,10 @@
@Echo off
for /f "delims=" %%i in ('PowerShell -NoProfile -NoLogo -ExecutionPolicy unrestricted -Command "[System.IO.Path]::GetTempFileName()"') do set DNVM_CMD_PATH_FILE="%%i.cmd"
PowerShell -NoProfile -NoLogo -ExecutionPolicy unrestricted -Command "[System.Threading.Thread]::CurrentThread.CurrentCulture = ''; [System.Threading.Thread]::CurrentThread.CurrentUICulture = '';$CmdPathFile='%DNVM_CMD_PATH_FILE%';& '%~dp0dnvm.ps1' %*"
IF EXIST %DNVM_CMD_PATH_FILE% (
CALL %DNVM_CMD_PATH_FILE%
DEL %DNVM_CMD_PATH_FILE%
)

1919
dnvm.ps1 Normal file

File diff suppressed because it is too large Load Diff

1061
dnvm.sh Normal file

File diff suppressed because it is too large Load Diff

17
dnvminstall.ps1 Normal file
View File

@ -0,0 +1,17 @@
$tempPath = Join-Path $env:TEMP "dnvminstall"
$dnvmPs1Path = Join-Path $tempPath "dnvm.ps1"
$dnvmCmdPath = Join-Path $tempPath "dnvm.cmd"
Write-Host "Using temporary directory: $tempPath"
if (!(Test-Path $tempPath)) { md $tempPath | Out-Null }
$webClient = New-Object System.Net.WebClient
$webClient.Proxy = [System.Net.WebRequest]::DefaultWebProxy
$webClient.Proxy.Credentials = [System.Net.CredentialCache]::DefaultNetworkCredentials
Write-Host "Downloading DNVM.ps1 to $dnvmPs1Path"
$webClient.DownloadFile('https://raw.githubusercontent.com/aspnet/Home/dev/dnvm.ps1', $dnvmPs1Path)
Write-Host "Downloading DNVM.cmd to $dnvmCmdPath"
$webClient.DownloadFile('https://raw.githubusercontent.com/aspnet/Home/dev/dnvm.cmd', $dnvmCmdPath)
Write-Host "Installing DNVM"
& $dnvmCmdPath setup

88
dnvminstall.sh Normal file
View File

@ -0,0 +1,88 @@
#!/usr/bin/env bash
_dnvmsetup_has() {
type "$1" > /dev/null 2>&1
return $?
}
_dnvmsetup_update_profile() {
local profile="$1"
local sourceString="$2"
if ! grep -qc 'dnvm.sh' $profile; then
echo "Appending source string to $profile"
echo "" >> "$profile"
echo $sourceString >> "$profile"
else
echo "=> Source string already in $profile"
fi
}
if [ -z "$DNX_USER_HOME" ]; then
eval DNX_USER_HOME=~/.dnx
fi
if ! _dnvmsetup_has "curl"; then
echo "dnvmsetup requires curl to be installed"
return 1
fi
if [ -z "$DNVM_SOURCE" ]; then
DNVM_SOURCE="https://raw.githubusercontent.com/aspnet/Home/dev/dnvm.sh"
fi
# Downloading to $DNVM_DIR
mkdir -p "$DNX_USER_HOME/dnvm"
if [ -s "$DNX_USER_HOME/dnvm/dnvm.sh" ]; then
echo "dnvm is already installed in $DNX_USER_HOME/dnvm, trying to update"
else
echo "Downloading dnvm as script to '$DNX_USER_HOME/dnvm'"
fi
curl -s "$DNVM_SOURCE" -o "$DNX_USER_HOME/dnvm/dnvm.sh" || {
echo >&2 "Failed to download '$DNVM_SOURCE'.."
return 1
}
echo
# Detect profile file if not specified as environment variable (eg: PROFILE=~/.myprofile).
if [ -z "$PROFILE" ]; then
if [ -f "$HOME/.bash_profile" ]; then
PROFILE="$HOME/.bash_profile"
elif [ -f "$HOME/.bashrc" ]; then
PROFILE="$HOME/.bashrc"
elif [ -f "$HOME/.profile" ]; then
PROFILE="$HOME/.profile"
fi
fi
if [ -z "$ZPROFILE" ]; then
if [ -f "$HOME/.zshrc" ]; then
ZPROFILE="$HOME/.zshrc"
fi
fi
SOURCE_STR="[ -s \"$DNX_USER_HOME/dnvm/dnvm.sh\" ] && . \"$DNX_USER_HOME/dnvm/dnvm.sh\" # Load dnvm"
if [ -z "$PROFILE" -a -z "$ZPROFILE" ] || [ ! -f "$PROFILE" -a ! -f "$ZPROFILE" ] ; then
if [ -z "$PROFILE" ]; then
echo "Profile not found. Tried ~/.bash_profile ~/.zshrc and ~/.profile."
echo "Create one of them and run this script again"
elif [ ! -f "$PROFILE" ]; then
echo "Profile $PROFILE not found"
echo "Create it (touch $PROFILE) and run this script again"
else
echo "Profile $ZPROFILE not found"
echo "Create it (touch $ZPROFILE) and run this script again"
fi
echo " OR"
echo "Append the following line to the correct file yourself:"
echo
echo " $SOURCE_STR"
echo
else
[ -n "$PROFILE" ] && _dnvmsetup_update_profile "$PROFILE" "$SOURCE_STR"
[ -n "$ZPROFILE" ] && _dnvmsetup_update_profile "$ZPROFILE" "$SOURCE_STR"
fi
echo "Type 'source $DNX_USER_HOME/dnvm/dnvm.sh' to start using dnvm"