-
-
Save rdumont/9775973 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/bin/sh | |
SOLUTION_FILE="src/Foo.sln" | |
MSBUILD_PATH="C:/Windows/Microsoft.NET/Framework64/v4.0.30319/MSBuild.exe" | |
NUGET_PATH="nuget" | |
NUGET_SOURCE="https://www.myget.org/F/myfeed/" | |
NUNIT_PATH="src/Packages/NUnit.Runners.2.6.3/tools/nunit-console.exe" | |
NUGET_PROJECTS=("src/Foo.Client/Foo.Client.csproj") | |
TEST_ASSEMBLIES=("src/Tests/Foo.FirstProject.Tests/bin/Release/Foo.FirstProject.Tests.dll" | |
"src/Tests/Foo.SecondProject.Tests/bin/Release/Foo.SecondProject.Tests.dll") | |
SPEC_ASSEMBLIES=("src/Tests/Foo.FirstProject.Specs/bin/Release/Foo.FirstProject.Specs.dll" | |
"src/Tests/Foo.SecondProject.Specs/bin/Release/Foo.SecondProject.Specs.dll") | |
# Default | |
if [ "$1" == "" ] || [ "$1" == "all" ]; then | |
echo " --- make: NuGet Restore, Build solution and Run NUnit tests" | |
make restore && make build && make test | |
# Restore NuGet Packages | |
elif [ "$1" == "restore" ]; then | |
echo | |
echo " --- make: NuGet Restore" | |
$NUGET_PATH restore "$SOLUTION_FILE" | |
# Build Solution | |
elif [ "$1" == "build" ]; then | |
echo " --- make: Build solution" | |
$MSBUILD_PATH "$SOLUTION_FILE" /verbosity:m /property:Configuration=Release /target:Clean,Build | |
# Run Tests | |
elif [ "$1" == "test" ]; then | |
echo " --- make: Run NUnit tests" | |
$NUNIT_PATH "${TEST_ASSEMBLIES[@]}" | |
# Run Specs | |
elif [ "$1" == "spec" ]; then | |
echo " --- make: Run SpecFlow specs" | |
$NUNIT_PATH "${SPEC_ASSEMBLIES[@]}" | |
# Pack NuGet Packages | |
elif [ "$1" == "pack" ]; then | |
echo " --- make: Build NuGet package" | |
if test ! -e "nuget"; then mkdir "nuget"; fi | |
rm nuget/* | |
for ((i = 0; i < ${#NUGET_PROJECTS[@]}; i++)); do | |
$NUGET_PATH pack "${NUGET_PROJECTS[$i]}" -o nuget -Build -p Configuration=Release | |
echo | |
done | |
# Push NuGet Packages | |
elif [ "$1" == "push" ]; then | |
echo " --- make: Push NuGet package" | |
for f in `ls nuget`; do | |
$NUGET_PATH push "nuget/$f" -Source $NUGET_SOURCE | |
echo | |
done | |
# Command not found | |
else | |
echo " --- make failed: Command '$1' not found" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment