Sha256: b2a6d0e7bfb86c5591e7325352bb047c3201c21d0365ae0e7f76c9881786ce8f

Contents?: true

Size: 1.52 KB

Versions: 5

Compression:

Stored size: 1.52 KB

Contents

class SetHeader
  def initialize(app, header, value)
    @app = app
    @header = header
    @value = value
  end

  def call(env)
    status, headers, body = @app.call(env)
    headers[@header] = @value
    [status, headers,body]
  end
end

Praxis::Application.configure do |application|

  application.handler 'xml', Praxis::Handlers::XML

  application.middleware SetHeader, 'Spec-Middleware', 'used'

  application.bootloader.use SimpleAuthenticationPlugin, config_file: 'config/authentication.yml'
  application.bootloader.use AuthorizationPlugin

  # enable "development-mode" options
  application.config.praxis.validate_responses = true
  application.config.praxis.validate_response_bodies = true
  application.config.praxis.show_exceptions = true

  # Silly callback code pieces to test that the deferred callbacks work even for sub-stages
  application.bootloader.after :app, :controllers do
    $after_app_controllers = :worked
  end
  application.bootloader.after :app do
    raise "After sub-stage hooks not working!" unless $after_app_controllers == :worked
  end


  application.layout do
    layout do
      map :initializers, 'config/initializers/**/*'
      map :design, 'design/' do
        map :api, 'api.rb'
        map :media_types, '**/media_types/**/*'
        map :resources, '**/resources/**/*'
      end
      map :app, 'app/' do
        map :models, 'models/**/*'
        map :concerns, '**/concerns/**/*'
        map :controllers, '**/controllers/**/*'
        map :responses, '**/responses/**/*'
      end
    end
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
praxis-2.0.pre.5 spec/spec_app/config/environment.rb
praxis-2.0.pre.4 spec/spec_app/config/environment.rb
praxis-2.0.pre.3 spec/spec_app/config/environment.rb
praxis-2.0.pre.2 spec/spec_app/config/environment.rb
praxis-2.0.pre.1 spec/spec_app/config/environment.rb