Sha256: 7b19126a8548267c7d9e67dfc4c4187b6e44783f04c2f431bdfc4329dffb380a

Contents?: true

Size: 1.19 KB

Versions: 2

Compression:

Stored size: 1.19 KB

Contents

module Coupler
  class Base < Sinatra::Base

    inst_dir = File.expand_path(File.join(File.dirname(__FILE__), "..", ".."))
    set :environment, Coupler.environment
    set :root, File.join(inst_dir, "webroot")
    set :static, true
    set :erb, :trim => '-'
    set :raise_errors, Proc.new { test? }
    set :show_exceptions, false
    set :dump_errors, true
    set :logging, Proc.new { !test? }
    set :methodoverride, true
    set :bind, '127.0.0.1'
    enable :sessions

    use Rack::Flash
    register Extensions::Connections
    register Extensions::Projects
    register Extensions::Resources
    register Extensions::Transformations
    register Extensions::Scenarios
    register Extensions::Matchers
    register Extensions::Results
    register Extensions::Jobs
    register Extensions::Transformers
    register Extensions::Imports
    register Extensions::Notifications
    register Extensions::Exceptions

    helpers do
      include Coupler::Helpers
      include Rack::Utils
      alias_method :h, :escape_html
    end

    get "/" do
      if Models::Project.count > 0
        redirect "/projects"
      else
        session[:first_use] = true
        erb :index
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
coupler-0.0.9-java lib/coupler/base.rb
coupler-0.0.8-java lib/coupler/base.rb