Skip to content

Instantly share code, notes, and snippets.

@thechrisoshow
Created July 16, 2010 09:43
Show Gist options
  • Save thechrisoshow/478190 to your computer and use it in GitHub Desktop.
Save thechrisoshow/478190 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'sinatra'
set :public, "/Users/chris/work/cadburysvs/v2"
set :bundle_path, "/Users/chris/work/cadburysvs/v2/howtoplay/bundle/"
# stolen from http://github.com/cschneid/irclogger/blob/master/lib/partials.rb
# and made a lot more robust by me
# this implementation uses erb by default. if you want to use any other template mechanism
# then replace `erb` on line 13 and line 17 with `haml` or whatever
module Sinatra::Partials
def partial(template, *args)
file_path = options.bundle_path + template
File.open(file_path,'r') do |f|
f.read
end
end
end
helpers Sinatra::Partials
get '/' do
erb :application
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment