whatcodecraves.com

Build Status

This is the content and Rails app that serves whatcodecraves.com. Posts are written in markdown and stored in the posts folder.

Overview

An article is a folder with a markdown document named index.text. When an article is requested, it is rendered as html with the layout, and cached. Cache expiration is based on file modification timestamps.

Permalinks

The canonical permalink format is:

/posts/YYYY/MM/DD/some-dasherized-title

This will be matched against possible post paths. If a post cannot be found, a 404 will be shown.

Legacy urls are 301 redirected by DeprecatedRoutes middleware.

Assets

Post assets served from public.

Usage

There are utility rake tasks to manage posts and publishing:

rake util:crawl        # list all urls in site with status and referer

Development

git clone https://github.com/jch/whatcodecraves.com
bundle
cp config/env.sample .env  # customize this
rake
yard
foreman start

Documentation

Reference documentation can be found at http://rubydoc.info/github/jch/whatcodecraves.com.

Deployment

Staging lives on heroku.

rake deploy          # runs everything under `deploy`
rake deploy:warmup   # warm up Rack::Cache by crawling the site
rake deploy:sitemap  # generate a sitemap

Apache Passenger configuration on VPS:

# /etc/apache2/conf.d/passenger
LoadModule passenger_module /usr/local/rvm/gems/ruby-1.9.2-p180/gems/passenger-3.0.13/ext/apache2/mod_passenger.so
PassengerRoot /usr/local/rvm/gems/ruby-1.9.2-p180/gems/passenger-3.0.13
PassengerRuby /usr/local/rvm/wrappers/ruby-1.9.2-p180/ruby

To reload:

sudo service apache2 restart

TODO

  • server-side syntax highlighting - done clientside w/ js right now
  • code overflow scroll
  • helpers for linking to other posts
  • gemify to separate code from content
  • custom heroku buildpack