Sha256: 05b8f373eadecab5d44b6558bffc914d802cfd98e74560c6942126da33a283ac
Contents?: true
Size: 1.01 KB
Versions: 15
Compression:
Stored size: 1.01 KB
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 MAPPINGS = { 'webhooks-create' => 'webhooks', 'webhooks-webhooks' => 'webhooks', 'pact-webhooks' => 'webhooks', }.freeze helpers do def view_name_for rel_name MAPPINGS[rel_name] || rel_name end def resource_exists? rel_name File.exist? File.join(self.class.root, 'views', "#{view_name_for(rel_name)}.markdown") end end get ":rel_name" do rel_name = params[:rel_name] if resource_exists? rel_name markdown view_name_for(rel_name).to_sym, {:layout_engine => :haml, layout: :'layouts/main'}, {} else response.status = 404 end end end end end end
Version data entries
15 entries across 15 versions & 1 rubygems