Sha256: 5836f12750c196fdbd96f0e406183e8321676946a9274e0e5712c03ea39fb25d

Contents?: true

Size: 741 Bytes

Versions: 59

Compression:

Stored size: 741 Bytes

Contents

require 'padrino-core'
require 'redcarpet'

Tilt.prefer Tilt::RedcarpetTemplate

module PactBroker
  module Doc
    module Controllers
      class App < Padrino::Application

        set :root, File.join(File.dirname(__FILE__), '..')
        set :show_exceptions, true

        helpers do
          def resource_exists? rel_name
            File.exist? File.join(self.class.root, 'views', "#{rel_name}.markdown")
          end
        end

        get ":rel_name" do
          rel_name = params[:rel_name]
          if resource_exists? rel_name
            markdown rel_name.to_sym, {:layout_engine => :haml, layout: :'layouts/main'}, {}
          else
            response.status = 404
          end
        end

      end
    end
  end
end

Version data entries

59 entries across 59 versions & 1 rubygems

Version Path
pact_broker-2.12.0 lib/pact_broker/doc/controllers/app.rb
pact_broker-2.11.0 lib/pact_broker/doc/controllers/app.rb
pact_broker-2.10.0 lib/pact_broker/doc/controllers/app.rb
pact_broker-2.9.0 lib/pact_broker/doc/controllers/app.rb
pact_broker-2.9.0.beta.5 lib/pact_broker/doc/controllers/app.rb
pact_broker-2.8.0.beta.5 lib/pact_broker/doc/controllers/app.rb
pact_broker-2.8.0.beta.4 lib/pact_broker/doc/controllers/app.rb
pact_broker-2.7.0.beta.3 lib/pact_broker/doc/controllers/app.rb
pact_broker-2.7.0.beta.2 lib/pact_broker/doc/controllers/app.rb
pact_broker-2.7.0.beta.1 lib/pact_broker/doc/controllers/app.rb
pact_broker-2.6.0 lib/pact_broker/doc/controllers/app.rb
pact_broker-2.5.1 lib/pact_broker/doc/controllers/app.rb
pact_broker-2.5.0 lib/pact_broker/doc/controllers/app.rb
pact_broker-2.4.2 lib/pact_broker/doc/controllers/app.rb
pact_broker-2.4.1 lib/pact_broker/doc/controllers/app.rb
pact_broker-2.4.0 lib/pact_broker/doc/controllers/app.rb
pact_broker-2.3.0 lib/pact_broker/doc/controllers/app.rb
pact_broker-2.2.0 lib/pact_broker/doc/controllers/app.rb
pact_broker-2.1.1 lib/pact_broker/doc/controllers/app.rb
pact_broker-2.1.0 lib/pact_broker/doc/controllers/app.rb