{"action":"opened","issue":{"url":"https://api.github.com/repos/cake-build/cake/issues/356","labels_url":"https://api.github.com/repos/cake-build/cake/issues/356/labels{/name}","comments_url":"https://api.github.com/repos/cake-build/cake/issues/356/comments","events_url":"https://api.github.com/repos/cake-build/cake/issues/356/events","html_url":"https://github.com/cake-build/cake/issues/356","id":101015420,"number":356,"title":"CodeCake/Cake.Embedded: a \"code based\" approach to  Cake-build","user":{"login":"olivier-spinelli","id":1583378,"avatar_url":"https://avatars.githubusercontent.com/u/1583378?v=3","gravatar_id":"","url":"https://api.github.com/users/olivier-spinelli","html_url":"https://github.com/olivier-spinelli","followers_url":"https://api.github.com/users/olivier-spinelli/followers","following_url":"https://api.github.com/users/olivier-spinelli/following{/other_user}","gists_url":"https://api.github.com/users/olivier-spinelli/gists{/gist_id}","starred_url":"https://api.github.com/users/olivier-spinelli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/olivier-spinelli/subscriptions","organizations_url":"https://api.github.com/users/olivier-spinelli/orgs","repos_url":"https://api.github.com/users/olivier-spinelli/repos","events_url":"https://api.github.com/users/olivier-spinelli/events{/privacy}","received_events_url":"https://api.github.com/users/olivier-spinelli/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-08-14T13:55:34Z","updated_at":"2015-08-14T13:55:34Z","closed_at":null,"body":"I actually have an idea in mind. A strange one may be... but an interesting one I believe. I'm a little bit reluctant to express it before having gained credibility from all of you. But... well... let's go!\r\n\r\nThe idea is named \"CodeCake\". It is an alternative to scripting (I can imagine how difficult it could be for guys who designed a project around scripting to consider this approach!). It relies on a cs project in the solution that can be a console application and even a GUI application (winForm or WPF or whatever activated by a -gui (or -ui)  switch.\r\n\r\nThe scripts are replaced with classes with a default ctor: below is a (working) example from the POC I'm working on:\r\n\r\n ```csharp\r\n    class Build : CodeCakeHost\r\n    {\r\n        public Build()\r\n        {\r\n            var configuration = Cake.Argument( \"configuration\", \"Release\" );\r\n\r\n            // Define directories.\r\n            var buildDir = Cake.Directory( \"./src/Example/bin\" ) + Cake.Directory( configuration );\r\n\r\n            Task( \"Clean\" )\r\n                .Does( () =>\r\n                {\r\n                    Cake.CleanDirectory( buildDir );\r\n                } );\r\n\r\n            Task( \"Restore-NuGet-Packages\" )\r\n                .IsDependentOn( \"Clean\" )\r\n                .Does( () =>\r\n                {\r\n                    Cake.NuGetRestore( \"./src/Example.sln\" );\r\n                } );\r\n\r\n            Task( \"Build\" )\r\n                .IsDependentOn( \"Restore-NuGet-Packages\" )\r\n                .Does( () =>\r\n                {\r\n                    Cake.MSBuild( \"./src/Example.sln\", new MSBuildSettings()\r\n                        .UseToolVersion( MSBuildToolVersion.NET45 )\r\n                        .SetVerbosity( Verbosity.Minimal )\r\n                        .SetConfiguration( configuration ) );\r\n                } );\r\n\r\n            Task( \"Run-Unit-Tests\" )\r\n                .IsDependentOn( \"Build\" )\r\n                .Does( () =>\r\n                {\r\n                    Cake.XUnit2( \"./src/**/bin/\" + configuration + \"/*.Tests.dll\" );\r\n                } );\r\n\r\n            Task( \"Default\" )\r\n                .IsDependentOn( \"Run-Unit-Tests\" );\r\n        }\r\n    }\r\n```\r\nThere is really nothing more to it (except the required using namespaces): the `Cake` that appears here is a property exposed by the base CodeCakeHost class that is actually just an alias to the `Context` property (extension methods apply and intellisense magics operates).\r\n\r\n\r\nThe overall process of working with CodeCake is the following:\r\n\r\n- Create a new project from a VS Project CodeCake template.\r\n- This project has one sample Build script that you can edit with all the intellisense support you can dream of.\r\n- This application depends solely on NuGet packages:\r\n  - Cake.Core\r\n  - CodeCake\r\n  - Cake.Common\r\n  - NuGet.CommandLine\r\n  - Any other extension packages you may need.\r\n- To trigger a release, just compile and run it... \r\n    - ...and this is where the -gui switch may come into play: a user interface can be scaffolded from:\r\n      - the existing CodeCakeHost classes in the project and their expected arguments/configurations.\r\n      - any helpers/utilities (automatically registered by reflection) offered in any NuGet extension packages. \r\n- For unattended builds (CI), the first thing to do is to MSBuild the CodeCake project and runs it (or one of its \"scripts\"). (And, yes, I know, there is still a small chicken-and-eggs issue here to restore the NuGet packages...)\r\n\r\nNote: To honor the \"scripting promise\", simply install the Cake.Scripting NuGet package in the CodeCake project and (Oh! Magic!) you can use:\r\n\r\n ```csharp\r\nCake.CakeExecuteExpression(\r\n    \"Information(\\\"Hello {0}!\\\", Argument<string>(\\\"name\\\"));\",\r\n    new CakeSettings {\r\n        ToolPath=\"./Cake.exe\" ,\r\n        Arguments = new Dictionary<string, string>{{\"name\", \"World\"}}\r\n        });\r\n```\r\nor \r\n\r\n ```csharp\r\nCake.CakeExecuteScript(\"./helloworld.cake\");\r\n```\r\nfrom your build \"scripts\".\r\n\r\nThis is it. My long term goal is to provide a very simple (with no coupling to the IDE or the system - NuGet packages only) way to build/deploy/distribute/use a potentially unlimited of tools for the developer (for instance the classical \"licence header processor\", you need it but do not want to deploy a vsix for such little things).\r\n"}}