Created
June 24, 2011 03:19
-
-
Save joshuaflanagan/1044159 to your computer and use it in GitHub Desktop.
Example batch file to execute a tool from a Nuget package
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@ECHO OFF | |
SETLOCAL | |
REM This can be used for any .exe installed by a nuget package | |
REM Example usage: nuget_tool.bat nunit-console.exe myproject.tests.dll | |
SET TOOL=%1 | |
FOR /R %~dp0\source\packages %%G IN (%TOOL%) DO ( | |
IF EXIST %%G ( | |
SET TOOLPATH=%%G | |
GOTO FOUND | |
) | |
) | |
IF '%TOOLPATH%'=='' GOTO NOTFOUND | |
:FOUND | |
%TOOLPATH% %2 %3 %4 %5 %6 %7 %8 %9 | |
GOTO :EOF | |
:NOTFOUND | |
ECHO %TOOL% not found. | |
EXIT /B 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Usage: nunit_path = tool "NUnit", "nunit-console.exe" | |
def tool(package, tool) | |
File.join(Dir.glob(File.join(package_root,"#{package}.*")).sort.last, "tools", tool) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@ECHO OFF | |
SETLOCAL | |
REM You might prefer specific scripts for each tool. Makes the usage a bit easier. This is an example for NUnit. | |
FOR /R %~dp0\source\packages %%G IN (nunit-console.exe) DO ( | |
IF EXIST %%G ( | |
SET TOOLPATH=%%G | |
GOTO FOUND | |
) | |
) | |
IF '%TOOLPATH%'=='' GOTO NOTFOUND | |
:FOUND | |
%TOOLPATH% %* | |
GOTO :EOF | |
:NOTFOUND | |
ECHO nunit-console not found. | |
EXIT /B 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment