ruhoh/ruhoh.rb — pull request #48 by celadevra (2012-06-22 03:32:11+00:00)
Title: Changes to allow customize deploy path for self-hosting

Hi, first please allow me to thank you for bringing ruhoh.

When I deploy ruhoh to my VPS on Linode, I encountered a problem: my blog sits at http://idenizen.net/blog, for testing purposes, I decided to put ruhoh compiled files under http://idenizen.net/ruhoh. When I browse the url, I find that all asset links and permalinks are all pointing to /, e.g. http://idenizen.net/assets/... . It seems that although you have `production_url` in `config.yml`, the urls generated doesn't respect this variable. This can be circumvented by using a virtual host, but currently that's not my idea about my website.

Thus I changed the files a bit, mostly under `lib/ruhoh`, to make ruhoh recognize the path it is in on the server. Moreover, I set up another variable in `config.yml` in my ruhoh blog, namely `dev_url`. Both `production_url` and `dev_url` defaults to `/`, and when `config.env` is set to `production`, `production_url` overrides `dev_url`, otherwise `dev_url` is used when `config.env` is set to anything else. This enables one to preview changes to the blog locally, and by switching to `production`, one can easily upload the results to the production server. Please see celadevra/celadevra.ruhoh.com@bb49362 for my config. Also, I find that after these changes, the `div.navbar>div.navbar-inner>a.brand` doesn't give the correct root url, therefore I also changed the layout under the theme a bit, please see the above blob as well.

I tested these changes with my own blog, both locally and on my VPS. As you may already find out, I am not too familiar with Ruby (I learn some of it from your code :), so please indulge me for the bugs. Also, if ruhoh as of now actually supports deploying to places like somehost.com/your/path, please let me know how. Much appreciated.