Sha256: 2d4ad01fc9549e86a99c616b34f00bad59a242b564ff50af8243c23c786f330c
Contents?: true
Size: 1.83 KB
Versions: 2
Compression:
Stored size: 1.83 KB
Contents
module Gumdrop module Server class << self def start(opts={}) # Opts opts.reverse_merge! :auto_run => true, :cache_data => false Gumdrop.config.merge! opts require 'sinatra' set :port, Gumdrop.config.port if Gumdrop.config.port get '/' do redirect '/index.html' end get '/*' do file_path= params[:splat].join('/') matches= Dir["source/#{file_path}*"] if matches.length > 0 Gumdrop.site= Gumdrop.layouts= Gumdrop.generators= Hash.new do |hash, key| templates= Dir["source/**/#{key}*"] if templates.length > 0 Content.new( templates[0] ) else puts "NOT FOUND: #{key}" nil end end Gumdrop.partials= Hash.new do |hash, key| templates= Dir["source/**/_#{key}*"] if templates.length > 0 Content.new( templates[0] ) else puts "NOT FOUND: #{key}" nil end end content= Content.new matches[0] if content.useLayout? content_type :css if content.ext == '.css' # Meh? content_type :js if content.ext == '.js' # Meh? content_type :xml if content.ext == '.xml' # Meh? content.render else send_file matches[0] end else puts "NOT FOUND: #{file_path}" "#{file_path} Not Found" end end if Gumdrop.config.auto_run Sinatra::Application.run! else Sinatra::Application end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
gumdrop-0.2.3 | lib/gumdrop/server.rb |
gumdrop-0.2.2 | lib/gumdrop/server.rb |