Cache nuget.exe in %LocalAppData% instead of downloading it everytime

This commit is contained in:
Pranav K 2014-02-01 17:32:55 -08:00
parent 1964e884e1
commit 3ac3af1daf
2 changed files with 24 additions and 9 deletions

View File

@ -1,10 +1,18 @@
@echo off @echo off
cd %~dp0 cd %~dp0
IF EXIST .nuget\NuGet.exe goto restore SETLOCAL
SET CACHED_NUGET=%LocalAppData%\NuGet\NuGet.exe
IF EXIST %CACHED_NUGET% goto copynuget
echo Downloading latest version of NuGet.exe... echo Downloading latest version of NuGet.exe...
IF NOT EXIST %LocalAppData%\NuGet md %LocalAppData%\NuGet
@powershell -NoProfile -ExecutionPolicy unrestricted -Command "$ProgressPreference = 'SilentlyContinue'; Invoke-WebRequest 'https://www.nuget.org/nuget.exe' -OutFile '%CACHED_NUGET%'"
:copynuget
IF EXIST .nuget\nuget.exe goto restore
md .nuget md .nuget
@powershell -NoProfile -ExecutionPolicy unrestricted -Command "$ProgressPreference = 'SilentlyContinue'; Invoke-WebRequest 'https://www.nuget.org/nuget.exe' -OutFile '.nuget\NuGet.exe'" copy %CACHED_NUGET% .nuget\nuget.exe > nul
:restore :restore
IF EXIST packages\KoreBuild goto run IF EXIST packages\KoreBuild goto run

View File

@ -1,12 +1,19 @@
@echo off @echo off
cd %~dp0 cd %~dp0
IF EXIST .nuget\NuGet.exe goto part2 SETLOCAL
echo Downloading latest version of NuGet.exe... SET CACHED_NUGET=%LocalAppData%\NuGet\NuGet.exe
mkdir .nuget
@powershell -NoProfile -ExecutionPolicy unrestricted -Command "((new-object net.webclient).DownloadFile('https://nuget.org/nuget.exe', '.nuget\NuGet.exe'))"
:part2 IF EXIST %CACHED_NUGET% goto copynuget
set EnableNuGetPackageRestore=true echo Downloading latest version of NuGet.exe...
.nuget\NuGet.exe install Sake -version 0.2 -o packages IF NOT EXIST %LocalAppData%\NuGet md %LocalAppData%\NuGet
@powershell -NoProfile -ExecutionPolicy unrestricted -Command "$ProgressPreference = 'SilentlyContinue'; Invoke-WebRequest 'https://www.nuget.org/nuget.exe' -OutFile '%CACHED_NUGET%'"
:copynuget
IF EXIST .nuget\nuget.exe goto build
md .nuget
copy %CACHED_NUGET% .nuget\nuget.exe > nul
:build
.nuget\nuget.exe install Sake -version 0.2 -o packages
packages\Sake.0.2\tools\Sake.exe -I build -f makefile.shade %* packages\Sake.0.2\tools\Sake.exe -I build -f makefile.shade %*