Sha256: 35b4ee5a3aa95e3f0dc3f8b847638e5d0e4cef924d188f2ea71f95ee5d1e1bbe

Contents?: true

Size: 607 Bytes

Versions: 5

Compression:

Stored size: 607 Bytes

Contents

# encoding: UTF-8

module Spontaneous
  module Rack
    POWERED_BY = {
      "X-Powered-By" => "Spontaneous CMS v#{Spontaneous::VERSION}"
    }

    class AroundFront
      def initialize(app)
        @app = app
        @renderer = Spontaneous::Output.published_renderer
      end

      def call(env)
        status = headers = body = nil
        env[Rack::RENDERER] = @renderer
        Content.with_identity_map do
          Site.with_published do
            status, headers, body = @app.call(env)
          end
        end
        [status, headers.merge(POWERED_BY), body]
      end
    end

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
spontaneous-0.2.0.alpha7 lib/spontaneous/rack/around_front.rb
spontaneous-0.2.0.alpha6 lib/spontaneous/rack/around_front.rb
spontaneous-0.2.0.alpha5 lib/spontaneous/rack/around_front.rb
spontaneous-0.2.0.alpha4 lib/spontaneous/rack/around_front.rb
spontaneous-0.2.0.alpha3 lib/spontaneous/rack/around_front.rb