Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
122 lines (104 sloc) 4.44 KB
properties {
$base_dir = Split-Path $psake.build_script_file
$build_dir = "$base_dir\build\"
$sln = "$base_dir\Restfulie.sln"
$tools_dir = "$base_dir\Tools"
$result_dir = "$build_dir\results"
$global:config = 'debug'
$version = if ($env:build_number -ne $NULL) { $env:build_number } else { '0.5.5' }
$buildNumber = $version + '.0'
$source_dir = "$base_dir\Restfulie.Server"
$dist_dir = "$base_dir\release"
}
task default -depends Test
task ci -depends clean, release, commonAssemblyInfo, test, dist
Task Clean {
delete_directory $build_dir
}
task Release {
$global:config = 'release'
}
task Compile -depends Clean {
Write-Host "Building Solution $sln" -ForegroundColor Green
Exec { msbuild "$sln" /t:Clean /t:Build /p:Configuration=Automated$config /p:OutDir=$build_dir/$config/ /v:m /nologo }
}
task Test -depends Compile {
create_directory($result_dir)
exec { & $tools_dir\nunit\nunit-console-x86.exe $build_dir/$config/Restfulie.Server.Tests.dll /nologo /nodots /xml=$result_dir\Restfulie.xml }
}
task commonAssemblyInfo {
$commit = git log -1 --pretty=format:%H
create-commonAssemblyInfo "$buildNumber" "$commit" "$source_dir\CommonAssemblyInfo.cs"
}
task dist {
create_directory $dist_dir
copy_file "$build_dir\$config\Restfulie.Server.dll" "$dist_dir"
copy_file "$build_dir\$config\Restfulie.Server.pdb" "$dist_dir"
copy_file "$result_dir\Restfulie.xml" "$dist_dir"
create-nuspec "$buildNumber"
}
function global:copy_file($source, $destination){
create_directory $destination
Copy-Item $source $destination
}
function global:delete_directory($directory_name) {
rd $directory_name -recurse -force -ErrorAction SilentlyContinue | out-null
}
function global:create_directory($directory_name) {
mkdir $directory_name -ErrorAction SilentlyContinue | out-null
}
function global:create-commonAssemblyInfo($version, $commit, $filename) {
$date = Get-Date
"using System;
using System.Reflection;
using System.Runtime.InteropServices;
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.4927
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
[assembly: ComVisibleAttribute(false)]
[assembly: AssemblyTitleAttribute(""Restfulie.NET"")]
[assembly: AssemblyVersionAttribute(""$version"")]
[assembly: AssemblyFileVersionAttribute(""$version"")]
[assembly: AssemblyCopyrightAttribute(""Copyright Mauricio Aniche 2010-" + $date.Year + """)]
[assembly: AssemblyProductAttribute(""Restfulie.NET"")]
[assembly: AssemblyTrademarkAttribute(""$commit"")]
[assembly: AssemblyCompanyAttribute("""")]
[assembly: AssemblyConfigurationAttribute(""release"")]
[assembly: AssemblyInformationalVersionAttribute(""$version"")]" | out-file $filename -encoding "ASCII"
}
function global:create-nuspec($package_version)
{
Write-Host "Generating nuspec for version: $package_version"
"<?xml version=""1.0""?>
<package xmlns=""http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd"">
<metadata>
<id>restfulie.net</id>
<version>$package_version</version>
<authors>Mauricio Aniche, Pedro Reys, Guilherme Silveira and Felipe Seixas</authors>
<owners>Mauricio Aniche</owners>
<licenseUrl>https://github.com/caelum/restfulie/blob/master/LICENSE</licenseUrl>
<projectUrl>http://restfulie.caelum.com.br/</projectUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Extend ASP.NET MVC to enable the creation of RESTFul api and hypermedia aware resources.</description>
<language>en-US</language>
<tags>REST HTTP API</tags>
<dependencies>
<dependency id=""Castle.Core"" version=""2.5.2"" />
<dependency id=""Newtonsoft.Json"" version=""4.0.8"" />
<dependency id=""AspNetMvc"" version=""[3.0.20105.1]"" />
</dependencies>
</metadata>
<files>
<file src=""$dist_dir\Restfulie.Server.dll"" target=""lib""/>
<file src=""$dist_dir\Restfulie.Server.pdb"" target=""lib""/>
<file src=""$dist_dir\Restfulie.xml"" />
<file src=""$source_dir\**\*.cs"" target=""src"" />
</files>
</package>" | out-file $build_dir\Restfulie.Server.nuspec -encoding "ASCII"
}