# Orthorings Orthorings is a gem to interact with and display content from Orthor.com The 2 main things you can do with Orthorings are: * Define an entire site backed by Orthor with the included DSL (more on this below) * Display content on any page in your app using the included helper methods and the Orthorings class ## Installation As a gem (from gemcutter.org) sudo gem install orthorings --source http://gemcutter.org ## Configuration Add a new file (e.g. orthor_config.rb) with the something like the below to your startup directory (e.g. in Rails config/initializers) Orthorings.setup do |config| config.account_id = "orthor" config.caching :memory, 300, {} end You can specify any Moneta cache class as the first argument to config.caching, the second argument is expiry time in seconds. The third is any additional arguments you want passed to the cache class on initialize. ## DSL To make creating a new site backed by Orthor super easy, we've included a DSL that lets you define your site. You don't need to supply any view files, you only need to create your own custom layout to override the included dull one. Currently the DSL plays with Sinatra and Rails - the Sinatra Extension is included in lib/sinatra/orthor.rb, Rails support is provided by engine functionality (seen in app/ and config/). Here is some example usage (more docs to come, this is still a WIP and some aspects will change) Orthor::Site.define do cache_for 300 # in seconds, http caching layout :application keywords "your, site, specific, keywords" description "what's your site doing?" page "/", "Home" page "/about", "About Us" feed "/blog.rss", "Blog" do id "our-blog" end category "/writings" do keywords "lets, do, some, seo" description "a more apt description for this section of the site" page "/writings/why", "Why we write" page_path "/writings/:id" feed "/writings.rss" do id "our-writings" name "Our Writings" end category "/writings/announcements" do page_path "/writings/announcements/:id" end end end In the above example, every route defined will be handled by the Orthorings gem and rendered through your specified layout, easy! In rails, you will also get named routes based off of the orthor id, e.g. "our-blog" -> our_blog_path Inside of any block in the dsl, you can specify the orthor id, if you don't give an id, the dsl assumes the last fragment of the specified path is the orthor object id, e.g. "/writings" has an orthor id of "writings". Stay tuned for more examples and documentation. ## TODO Things that are being mulled over * Nav helpers (generate navigation based off of the DSL structure) * ...I'm sure there'll be something else here soon ## Example Usage (as provided by the OrthorHelper module, defined as class methods of Orthorings) orthor_content("content-item-id") or Orthorings.content("id") orthor_query("query-id") or Orthorings.query("id") orthor_category("category-id") or Orthorings.category("id") orthor_feed("feed-id") or Orthorings.feed("id") Copyright (c) 2009 Robotic Foo, released under the MIT license