Sha256: 7fbb2effb0f35c234a4cdbe8c433550cba6f2ac4e3c079e6323c4fced3cc219a
Contents?: true
Size: 1.79 KB
Versions: 4
Compression:
Stored size: 1.79 KB
Contents
#!/usr/bin/env ruby # # Project <%= @appname %> # # Created using bivouac on <%= Time.now %>. # Copyright (c) <%= Time.now.year %> __My__. All rights reserved. # require 'rubygems' require 'camping' require 'camping/session' require 'mime/types' require 'bivouac' include Bivouac # Load libs LIB = filePath( __FILE__, '..', 'lib' ) $:.unshift( LIB ) # Load plugins Dir.glob( filePath( __FILE__, '../plugins/**/init.rb' ) ).each { |p| require p } begin require 'erubis' ERB = Erubis::Eruby rescue MissingSourceFile require 'erb' end Camping.goes :<%= @appname %> module <%= @appname %> def render(m, layout=false) content = ERB.new(IO.read("#{File.dirname(__FILE__)}/views/#{m}.html")).result(binding) content = ERB.new(IO.read("#{File.dirname(__FILE__)}/views/layout.html")).result(binding) if layout return content end end # Load helpers from app/helpers files( 'helpers' ) { |file| require( file ) } # Load models from app/models files( 'models' ) { |file| require( file ) } # Load database schema from db/migrate files( '../db/migrate' ) { |file| require( file ) } # Load controllers from app/controllers files( 'controllers', :except => [File.basename(__FILE__)] ) { |file| require( file ) } module <%= @appname %>::Controllers class Public < R '/public/(.+)' PATH = filePath( __FILE__ ) def get file if file.include? '..' @status = '403' return '403 - Invalid path' else type = (MIME::Types.type_for(file)[0] || '/text/plain').to_s @headers['Content-Type'] = type @headers['X-Sendfile'] = File.join PATH, '..', 'public', file end end end end # Load create files( '../db' ) { |file| require( file ) } # Load postamble and configuration if __FILE__ == $0 files( '../config' ) { |file| require( file ) } end
Version data entries
4 entries across 4 versions & 1 rubygems