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.0.5 lib/pact_broker/doc/controllers/app.rb
pact_broker-2.0.4 lib/pact_broker/doc/controllers/app.rb
pact_broker-2.0.3 lib/pact_broker/doc/controllers/app.rb
pact_broker-2.0.2 lib/pact_broker/doc/controllers/app.rb
pact_broker-2.0.1 lib/pact_broker/doc/controllers/app.rb
pact_broker-2.0.0 lib/pact_broker/doc/controllers/app.rb
pact_broker-2.0.0.beta.8 lib/pact_broker/doc/controllers/app.rb
pact_broker-2.0.0.beta.7 lib/pact_broker/doc/controllers/app.rb
pact_broker-2.0.0.beta.6 lib/pact_broker/doc/controllers/app.rb
pact_broker-1.18.0 lib/pact_broker/doc/controllers/app.rb
pact_broker-2.0.0.beta.5 lib/pact_broker/doc/controllers/app.rb
pact_broker-1.18.0.beta.1 lib/pact_broker/doc/controllers/app.rb
pact_broker-1.17.2 lib/pact_broker/doc/controllers/app.rb
pact_broker-1.17.1 lib/pact_broker/doc/controllers/app.rb
pact_broker-2.0.0.beta.4 lib/pact_broker/doc/controllers/app.rb
pact_broker-2.0.0.beta.3 lib/pact_broker/doc/controllers/app.rb
pact_broker-2.0.0.beta.2 lib/pact_broker/doc/controllers/app.rb
pact_broker-2.0.0.beta.1 lib/pact_broker/doc/controllers/app.rb
pact_broker-1.17.0 lib/pact_broker/doc/controllers/app.rb
pact_broker-1.16.0 lib/pact_broker/doc/controllers/app.rb