Hello Rails List!
Thanks to those who commented on my prior thread about credit card handling; some smart, smart people on this list.
Here’s another one for you: I have a client for whom I’m building a site. They insist on using their existing webhost, which runs PHP 4.3. OK, cool.
Luckily, for now, the site is going to be largely static. I could use, say, Dreamweaver and build everything using Dreamweaver templates, but I would much rather hang the site off Rails for the following reasons:
Dreamweaver is US$400. Rails, SVN, and a text editor are free.
I’m likely to be more productive in Rails, since I haven’t touched Dreamweaver or its templating system for a few years.
Building it in Rails today offers a degree of futureproofing, for when the client calls me 6 months from now and says “we’d like to add a blog, a booking system, a forms repository, and oh… can we have the ability to edit everything over the web?”
OMGWTFBBQ. Rails is, like, my BFF xoxoxox <3
Then I got to thinking… I wonder if there’s a way to build a Rails site (which doesn’t use POST requests), and then dump the whole thing out – links, media, and all – to a set of static pages and files for launch on a plain webserver? I did a little searching on the web and on the Rails list; there were some folks a while back talking about using httrack, or wget to create a static mirror of a running Rails site. I gave it a shot with wget, and it showed some promise except for a few bugaboos:
“http://mydomain.com/controller/action” will get saved into a file named “action” in a “controller” directory. The lack of .htm extension on the file causes at least one webserver I tried this on to freak out and send the static file to the browser using a non-HTML content type. This, in turn, causes the HTML source to be displayed in the browser in plain text.
“http://mydomain.com/controller/action/” will fail (note the trailing slash) since no “action” directory exists. #1 and #2 could be solved if wget would simply save the output of “http://mydomain.com/controller/action” to a file named “index.htm” in a “controller/action” directory.
wget will save image/css/js files along with Rails’ new timestamping/cachebusting tack-on, resulting in filenames such as “image.gif?44702193412”. This will, of course, break the static site, since the webserver strips everything after the “?” when trying to access whatever file.
So – what do you think? Comments? Suggestions? Links to prior art that I might have missed?
Steven Luscher (BDes Hons., Provisional RGD)
c = Steven Luscher Design; w = [http://www.stevenluscherdesign.com](http://www.stevenluscherdesign.com)/