Some ideas

Jul 2, 2010 at 7:28 AM
Edited Jul 2, 2010 at 7:30 AM
Hi, Great project. I was thinking of building someone similar. I don't have the time. Here are the notes I kept, perhaps they will be useful for your project. Good luck! Brian - Goals - edit in VS with full c# - simple (opinionated) - simplify multi-environment config with optional features - extensible - editable/compilable/debuggable with Visual Studio + Resharper - Features - "cake edit" will create temp sln and csproj and open Visual Studio for quick editing and then delete files when done. - cruise integration - probably want to have identical output to nant for existing tools to parse - specify framework version - simple encryption method - a verify method that will do anything it can to verify the script is correct - read in all config files and ensure they point to real properties - or perhaps do this everytime? - automatically look for extensions in common locations (e.g. .\tools\cake\) - perhaps add to "path" and tools subfolders with exes in them - include basic sample script for a default tool stack (targets for Test (nunit), TestCoverage (ncover), Deploy (console, web, clickonce, webservice), Clean, Run) - Questions - can we use extention methods to create "tasks" - property replacement - do we need it? (e.g. var buildDir = "@{projectDir}\builds") - how can we do compile-time verification? - can we do better for path manipulation - making sure we have slashes? a "Path" class with + overload? - environment specific properties / behaviour - use dynamic (.net 4) - derrived classes? - simple key=value text files - c# code without class/method wrapper? - methods with specific name ConfigureForDev() on partial class (this is nice in that you can have one or several config files) - also want machine and person specific? - e.g. config\, - could mark "Local" properties (e.g. db name) as overwritable and then overwrite in machine-specific config files - in "Local" section set Database.Name = "@{Local.Database.Name}" - maybe convention for machine-specific properties, but let develop handle environment-specific - extension of build file? - .cake, .build, .make - .cs allows editing in other tools - paths: use forward slash to avoid @ or \\ escaping? - logging: how do we show the currently executing "target" name? -> users must code "Print" statements? codeplex shake --------------------------------------- #pragma reference c:\dev\Cake.dll // hardcoded reference for SnipetCompiler plugin? using System.Net; // automatically guess at references using MyCompany.MyProject // automatically guess? look in current folder? specific subfolders? public class MyProject : Cake // use base class OR partial class? { private string projectDir = ".\"; private string toolsDir = projectDir + @"tools\"; private string buildDir = projectDir.AddPath(@"builds\"); // string extension method for folder manipulation? public void Default() { // default target? // also see // what is this syntax? Default => [:Build, :Test] } // public void methods are targets public void Clean() { MSBuild.Target("clean").Run(); Delete(@"\\*\\bin") Delete(@"\\*\\obj") } public void Test() { nunit("myproject.dll") } private void nunit(string arg1) { private string nunit = @"tools\nunit\bin\nunit.exe" Exec.Command(nunit).Arg("/a", arg1).Run(); // by default quote arguments that contain spaces } public void Deloy() { Copy("from", "to"); Copy(Files(".cs").IncludeAllSubfolders, "to"); Copy(".cs".IncludeAllSubfolders(), "to") // use string extension method to output filespec? Copy.From("from") .ToFolder("to") .Overwrite() .WithPropertyReplacement .OverwriteOnlyIfOlder .Run(); // or instead of above use "new" keyword? new CopyTask().From("from").ToFolder... // use DOS command names rather than making new names Del(); Rm(); } public void MakeReadOnly() { Files("c:\temp") .Exclude("*.tmp") .Exclude(new MyFileSpec()) .Where(file => file.ModifiedDate > DateTime.Today.AddDays(-1)) .ForEach(file => FileInfo.SetReadOnly(file)); } private void CanDepend() { Depends(x => x.Clean); // can use AOP to intercept calls not made with Depends(), but is it necessary? Depends(x => x.compile) // can we depend on private methods? would be nice } public void CanReceiveArgument(int hello) { // invoke with "cake CanReceiveArgument abc" // could optionally have int as return value } private Exec SqlPlus { get { return new Exec().Path("c:\progra~1\mmsql\sqlplus.exe").Param("\b"); } } public void CreateDatabase() { SqlPlus .Param("\s", "create_database.sql") .Run(); } } // ALTERNATIVE! Use yaml and dynamic object public partial class Cake { private void ConfigureForDev() { // doesn't need to be public... doesn't look like a task buildDir = @"g:\sandbox\compile"; } }
Jul 2, 2010 at 7:31 AM
Nice, you cannot post code in a discussion forum for software development! If you are interested and formatted version, you can contact me by email: Good luck with your project! Brian
Sep 6, 2010 at 11:32 AM

Hi Brian, thanks for your ideas and sorry about the late reply. I have sent you an email.