Sha256: 61d1bc61953f3f502ceb36e5de55e9c00abfc9e373880342926203a2ebc2b00a

Contents?: true

Size: 1.25 KB

Versions: 18

Compression:

Stored size: 1.25 KB

Contents

class App < Sinatra::Base

  helpers Asset::Helpers

  configure do
    # Settings
    set :app_file, __FILE__
    set :root, APP_ROOT
    set :views, APP_VIEWS

    # Turn this on in dev to see handler
    set :show_exceptions, MODE != 'production'
    set :raise_errors, false

    # Haml setup
    set :haml, {:format => :html5}
    set :haml, :layout => :'layout/layout'
    set :sass, {:cache_location => './tmp/sass-cache'}

    # Liquid setup
    Liquid::Template.file_system = Liquid::LocalFileSystem.new(APP_VIEWS)
    Liquid::Template.register_filter(::Asset::Filters)

    # Set up loggers and tmp files
    Dir.mkdir('./tmp') unless File.exists?('./tmp')
    Dir.mkdir('./log') unless File.exists?('./log')

    # Global loggers
    $log = Logger.new("./log/app.log")
    $errors = Logger.new("./log/errors.log")
  end

  # Disable caching of classes when not in production
  configure :development, :test do |c|
    Liquid.cache_classes = false
    Liquid::Template.error_mode = :strict
  end

  get('/') do
    erb(:index)
  end

  get('/liquid') do
    liquid(:index)
  end

  # Default not found page
  not_found do
    "404, Not found".tap{|m| puts m}
  end

  # Default error pages
  error(500..510) do
    "50X, Application error".tap{|m| puts m}
  end

end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
asset-0.2.4 app.rb
asset-0.2.3 app.rb
asset-0.2.2 app.rb
asset-0.2.1 app.rb
asset-0.2.0 app.rb
asset-0.1.14 app.rb
asset-0.1.13 app.rb
asset-0.1.12 app.rb
asset-0.1.11 app.rb
asset-0.1.10 app.rb
asset-0.1.9 app.rb
asset-0.1.8 app.rb
asset-0.1.7 app.rb
asset-0.1.6 app.rb
asset-0.1.5 app.rb
asset-0.1.4 app.rb
asset-0.1.3 app.rb
asset-0.1.2 app.rb