Sha256: 45736fbc2b0e5ac1a6d0c8f39f5b9a164ff4277aa435bf1f96e3dc4130daea0b

Contents?: true

Size: 1.83 KB

Versions: 3

Compression:

Stored size: 1.83 KB

Contents

require 'crystal_ext/profiles/web_ext_require'

# 
# Routes
# 
Crystal::HttpController.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
      
      # forgery protection
      web.use PrepareAutenticityToken
      
      # ensure no www
      web.use EnsureNoWww
    
      # 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


# 
# RackAdapter
# 
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 & 1 rubygems

Version Path
crystal_ext-0.0.7 lib/crystal_ext/profiles/web_ext.rb
crystal_ext-0.0.5 lib/crystal_ext/profiles/web_ext.rb
crystal_ext-0.0.4 lib/crystal_ext/profiles/web_ext.rb