Serving HTML from SVN

htmlclipThis is one of those posts that’s a little embarrassing to write. Just a little bit. Once I figured it out I kind of think it’s one of those things that a lot of people probably know about. But I didn’t and I never found any instructions so I’m putting them here in case somebody else can benefit.

I recently setup a project on Google Code (more on that later) that uses SVN to host the project files. I wanted to be able to easily host and update my project’s documentation so keeping that in SVN and serving that straight from there seemed optimal. Previously I had always made a spot on this server for my generated AS3 documentation. For that I had to generate it and then upload it here. Not exactly HARD but sometimes I would change the code and updating the documentation just seemed like a step I didn’t want to bother with. Plus, I see documentation the same as a binary. It’s a direct result of the project code.

So I added the documentation straight into my build script and now my /build folder has the binary (.swc) and a /doc folder with the generated documentation. Run build; commit. Done. Easy. Except it looks like poo because SVN serves up the files as text files. Good if you want to browse HTML files in an SVN server to see what’s in ‘em. But bad if you want to actually USE those HTML files.

rawhtml

To fix this I set the svn mime-type property on all of the files in the /doc folder (except for the images).  I found Tortise a much better tool for this then subclipse in Eclipse.  I just right-clicked on the top doc folder and added a property; selecting svn:mime-type and typing “text/html”.  I checked “Apply property recursively” to just apply it to ALL files and then I reverted the changes to the graphics files before I committed.

svn properties

Also make sure that your .css files are set to “text/css” otherwise your pages won’t use the CSS files in chrome or FireFox.  I committed those changes and boom.  Servin’ my projects generated html docs from SVN.

formattedhtml

Hope this helps somebody out there!  I really appreciate documentation; especially the generated kind.  It helps me to quickly grasp the code without actually looking at it.  Maybe this will help us see more of it!

Filed under uncategorized · Tagged with

Yea but . . .

Tell me what you're thinking.