0.0
No commit activity in last 3 years
No release in over 3 years
Allows rendering of static HTML and mote-angular template files
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

>= 0
 Project Readme

Hobbit Hole

===========

Simple gem for rendering static and mote files in hobbit. Also adds some useful shortcuts that are found in Sinatra.

Why use hobbit?

It's faster than Sinatra. In total it's less than 200 lines of code, so you can easily poke around and understand why things work the way they do.

The easiest way to get started is to use the-shire seed which has the hobbit-hole gem built in. Simply clone the repo to your projects directory, rename the folder, then cd in and run rake. You'll have to add your own git-hub remotes after that.

How to Use:

To server a static html page:

get '/' do
  render_static('index.html')
end

Useful shortcuts:

  redirect('/path')  # redirects to the given url
  session            # access the rack session
  params[:key]       # return parameter for given key

Default path for views is public/views. This is also the default path for layouts, and the default layout is layout.mote
!! NOTE currently only angular-mote syntax is supported !!

% #ruby code
% result = 2 + 2
2 + 2 = ~{result}~

To alter the default views path, default layouts path, or default layout, override the following methods in custom-hobbit.rb:

def views_path
  'public/views'
end
def layouts path
  "#{views_path}"
end
def default_layout
  "#{layouts_path}/layout.mote"
end

ToDo:

* Improve documentation * Allow for both mote AND mote-angular files.