require 'crystal/profiles/web_require' # # Routes # Crystal::AbstractController.include Crystal::NamedRouter::Helper Crystal::ControllerContext.include Crystal::NamedRouter::Helper crystal.after :environment do crystal.register(:router, :depends_on => :environment) do Crystal::Router.new(:class, [ [:named_router, Crystal::NamedRouter.new], [:default_router, Crystal::DefaultRouter.new] ]) end end # # Conveyors # module Crystal::Processors crystal.after :environment do crystal.conveyors.web do |web| # conveyor web.use ConveyorLogger # http web.use HttpWriter, :content web.use PrepareParams web.use EvaluateFormat web.use HTTPLogger # html web.use ScopedParams # controller web.use ControllerErrorHandling, :content # router web.use Router, :class, :method_name # controller web.use ControllerLogger web.use ControllerCaller, :content web.build! end end end # # Rack # Crystal::RackAdapter.build_common_app do |builder| config = crystal.config # CommonLogger, ShowExceptions, Lint builder.use Rack::Lint if config.development? builder.use Crystal::StaticFiles, "#{config.root!}/public" if config.static? and config.root? and config.development? # use Rack::Session::Cookie, :key => 'rack.session', :domain => 'foo.com', :path => '/', :expire_after => 2592000, :secret => 'change_me' builder.use Rack::Session::Cookie, config.session.to_hash if config.session? # builder.use Rack::CommonLogger builder.use Rack::MethodOverride # builder.use ShowExceptions if config.show_exceptions? end