Sha256: 3b285ab51d2ef796aa9985dae38f4923299508a11cba7a2bc771ec5f789335d5

Contents?: true

Size: 1.71 KB

Versions: 3

Compression:

Stored size: 1.71 KB

Contents

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

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
crystal-0.0.13 lib/crystal/profiles/web.rb
crystal-0.0.12 lib/crystal/profiles/web.rb
crystal_ext-0.0.11 lib/crystal/profiles/web.rb