Sha256: f6dab416d6aeb01e12d9b5bd254b3dc6b25018175c6d0ed0a4f88f4d0c9fc6f6

Contents?: true

Size: 1.33 KB

Versions: 3

Compression:

Stored size: 1.33 KB

Contents

#!/usr/bin/env ruby

#
#  Project <%= @appname %>
#
#  Created using bivouac on <%= Time.now %>.
#  Copyright (c) <%= Time.now.year %> __My__. All rights reserved.
#

LIB = File.join File.expand_path(File.dirname(__FILE__)), '..', 'lib'
$:.unshift( LIB )

require 'rubygems'
require 'camping'
require 'camping/session'
require 'mime/types'
require 'bivouac'

include Bivouac

Camping.goes :<%= @appname %>

# 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 views from app/views
files( 'views' ) { |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 = File.expand_path(File.dirname(__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 ) }

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
bivouac-0.0.5 lib/bivouac/template/application_goh.rb
bivouac-0.0.6 lib/bivouac/template/application_goh.rb
bivouac-0.0.4 lib/bivouac/template/application_goh.rb