Sha256: 26cc382c148d21f0824e265f9325eebbbc2a798f9eb2e166da46599002480216
Contents?: true
Size: 1.02 KB
Versions: 1
Compression:
Stored size: 1.02 KB
Contents
module Mado class App < Sinatra::Base set :root, File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "app")) set :sass, cache: false configure :development do require "sinatra/reloader" register Sinatra::Reloader end helpers do def markdown_dir @markdown_dir ||= File.dirname(settings.markdown_path) end end get '/' do @page_title = File.basename(settings.markdown_path) slim :index end get "/css/application.css" do sass :application end get "/js/application.js" do coffee :application end get "/emoji/*" do emoji_path = Mado::Markdown.emoji_path(params[:splat][0]) if File.exist?(emoji_path) send_file emoji_path, disposition: "inline" else not_found end end get "/*" do path = File.expand_path(params[:splat][0], markdown_dir) if File.exist?(path) send_file path, disposition: "inline" else not_found end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mado-0.2.1 | lib/mado/app.rb |