Monday, 8 October 2012

Idea: dynamically fetching content from GitHub to show as website

I was thinking of a way to create a very simple way to package and consume an TeamMentor website, and NuGet come to mind (note that you can already consume TM's engine from NuGet via the TeamMentor.CoreLib package, which is the compilation of this VS project)

The problem is that on the WebSite layer (see code here) there are lots of files in there (namely the Html, Image, CSS and JS files) which we need to use.

Now we could create a NuGet package with these files, but that would still mean that the VS project would still have ALL of those files in there.

What I really want is to have access to all those files without actually seeing them (i.e only the custom changes should exist in the VS project file).

At the moment I can see two (kinda crazy ways) to do this:

  1. Package all files into a dll's resources section (like I did with O2's dll dependencies) - using an extra HttpHandler that  would try to match an HttpRequest to an file available (and serve it)
  2. Use the HttpHandler described above to get the files directly from GitHub  (i.e. http request to GitGub to the the files)
The 2nd option would be really cool, but quite a crazy one :)

You basically would have an AppHarbor hosted website whose content where being dynamically fetched (server-side) from GitHub :)

Now if only Asp.NET supported the packing of websites as a one file package