Permalink
Browse files

Adding Sakefile

  • Loading branch information...
1 parent 56e8009 commit 8e43978563927b0eff05b0f167dd37c962968b00 @lodejard lodejard committed May 10, 2012
View
@@ -0,0 +1,45 @@
+use-standard-lifecycle
+
+use namespace="System"
+use namespace="System.IO"
+use import="Files"
+
+var VERSION='0.1.0'
+var FULL_VERSION='${VERSION}-alpha-1'
+var AUTHORS='OWIN contributors'
+
+var KATANA_VERSION='0.1.1'
+var CORAL_VERSION='0.0.1'
+
+var BASE_DIR='${Directory.GetCurrentDirectory()}'
+var TARGET_DIR='${Path.Combine(BASE_DIR, "target")}'
+var BUILD_DIR='${Path.Combine(TARGET_DIR, "build")}'
+
+var HOME_DIR='${Environment.GetEnvironmentVariable("HOME")}'
+set HOME_DIR='${Environment.GetEnvironmentVariable("HOMEDRIVE") + Environment.GetEnvironmentVariable("HOMEPATH")}' if='string.IsNullOrEmpty(HOME_DIR)'
+
+#delete-target-dir target='clean'
+ directory delete='${TARGET_DIR}'
+
+#assembly-version target='initialize'
+ assemblyinfo each='var updateFile in Files.Include("src/**/AssemblyInfo.cs")' assemblyVersion='${VERSION}' assemblyInformationalVersion='${FULL_VERSION}'
+
+#build-sln target='compile'
+ build each='var projectFile in Files.Include("src/**/*.csproj")' configuration='Release'
+
+#start .compile
+ nuget-install package='Katana' packageVersion='${KATANA_VERSION}' outputDir='packages'
+ nuget-install package='Coral' packageVersion='${CORAL_VERSION}' outputDir='packages'
+ var katanaProgram='${BASE_DIR}\packages\Katana.${KATANA_VERSION}\bin\Katana.exe'
+ var coralProgram='${BASE_DIR}\packages\Coral.${CORAL_VERSION}\bin\Coral.exe'
+ @{
+ var port = 3000;
+ var text = Files.Include("src/**/Startup.cs")
+ .Select(x=>Path.GetDirectoryName(x))
+ .Select(x=>new {path=x, name=Path.GetFileName(x)})
+ .Select(x=>string.Format("{0}: cd {1} && {2} --server firefly --port {3}", x.name, x.path, katanaProgram, ++port))
+ .Aggregate("", (a,b) => a + "\r\n" + b);
+ Log.Info(string.Format("Writing Coral.txt\r\n{0}", text));
+ File.WriteAllText("Coral.txt", text);
+ }
+ exec-clr program='${coralProgram}' commandline='start'
View
6 build
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+export EnableNuGetPackageRestore=true
+mono --runtime=v4.0 "./.nuget/NuGet.exe" install Sake -pre -o packages
+mono $(find packages/Sake.*/tools/Sake.exe|sort -r|head -n1) -I "src/Sake.Library/Shared" "$@"
+
View
@@ -0,0 +1,10 @@
+@echo off
+cd %~dp0
+
+set EnableNuGetPackageRestore=true
+".nuget\NuGet.exe" install Sake -pre -o packages
+
+for /f "tokens=*" %%G in ('dir /AD /ON /B "packages\Sake.*"') do set __sake__=%%G
+"packages\%__sake__%\tools\Sake.exe" -I src\Sake.Library\Shared %*
+set __sake__=
+
@@ -1,4 +1,4 @@
-using System.Reflection;
+using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
@@ -27,5 +27,5 @@
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
+[assembly: AssemblyVersion("0.1.0")]
+[assembly: AssemblyFileVersion("0.1.0")]
@@ -38,8 +38,8 @@
<Reference Include="Gate, Version=0.3.4.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Gate.0.3.4\lib\net40\Gate.dll</HintPath>
</Reference>
- <Reference Include="Gate.Builder, Version=0.3.5.0, Culture=neutral, processorArchitecture=MSIL">
- <HintPath>..\..\packages\Gate.Builder.0.3.5\lib\net40\Gate.Builder.dll</HintPath>
+ <Reference Include="Gate.Builder, Version=0.3.4.0, Culture=neutral, processorArchitecture=MSIL">
+ <HintPath>..\..\packages\Gate.Builder.0.3.4\lib\net40\Gate.Builder.dll</HintPath>
</Reference>
<Reference Include="Gate.Hosts.AspNet, Version=0.3.4.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Gate.Hosts.AspNet.0.3.4\lib\net40\Gate.Hosts.AspNet.dll</HintPath>
@@ -1,4 +1,4 @@
-using System.Reflection;
+using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
@@ -27,5 +27,5 @@
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
+[assembly: AssemblyVersion("0.1.0")]
+[assembly: AssemblyFileVersion("0.1.0")]
@@ -7,13 +7,28 @@ public class Startup
{
public void Configuration(IAppBuilder builder)
{
- builder.RunDirect(
- (req, res) =>
+ builder
+ .Use<AppTaskDelegate>(LogRequests)
+ .RunDirect(App);
+ }
+
+ private void App(Request req, Response res)
+ {
+ res.ContentType = "text/plain";
+ res.Write("You did a {0} at {1}", req.Method, req.Path);
+ res.End();
+ }
+
+ private AppTaskDelegate LogRequests(AppTaskDelegate app)
+ {
+ return
+ env =>
{
- res.ContentType = "text/plain";
- res.Write("You did a {0} at {1}", req.Method, req.Path);
- res.End();
- });
+ var req = new Request(env);
+ req.TraceOutput.WriteLine("{0} {1}", req.Method, req.Path);
+
+ return app(env);
+ };
}
}
}
@@ -1,4 +1,4 @@
-using System.Reflection;
+using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
@@ -27,5 +27,5 @@
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
+[assembly: AssemblyVersion("0.1.0")]
+[assembly: AssemblyFileVersion("0.1.0")]
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
+using System.IO;
using System.Text;
using Owin;
@@ -9,7 +10,9 @@ public class Startup
{
public void Configuration(IAppBuilder builder)
{
- builder.Use<AppDelegate>(_ => App);
+ builder
+ .Use<AppTaskDelegate>(LogRequests)
+ .Use<AppDelegate>(_ => App);
}
private void App(IDictionary<string, object> env, ResultDelegate result, Action<Exception> fault)
@@ -31,5 +34,16 @@ private void App(IDictionary<string, object> env, ResultDelegate result, Action<
end(null);
});
}
+
+ private AppTaskDelegate LogRequests(AppTaskDelegate app)
+ {
+ return
+ env =>
+ {
+ var log = (TextWriter)env["host.TraceOutput"];
+ log.WriteLine("{0} {1}", env["owin.RequestMethod"], env["owin.RequestPath"]);
+ return app(env);
+ };
+ }
}
}

0 comments on commit 8e43978

Please sign in to comment.