Sha256: 9eb8f1bd9ce4e54ebbb53af087bd236e1f7928e3c3ad77281a83904b7dde3f1d

Contents?: true

Size: 1.06 KB

Versions: 2

Compression:

Stored size: 1.06 KB

Contents

require 'redcarpet'
require 'sinatra/base'
require 'magic_reveal/slide_renderer'
require 'magic_reveal/index_libber'
require 'magic_reveal/project_config'

begin
  require 'better_errors'
  HAS_BETTER_ERRORS = true
rescue LoadError
  HAS_BETTER_ERRORS = false
end

module MagicReveal
  class App < Sinatra::Base
    if HAS_BETTER_ERRORS
      configure :development do
        use BetterErrors::Middleware
        BetterErrors.application_root = File.expand_path('../../..', __FILE__)
      end
    end

    set :public_folder, Dir.getwd

    get '/' do
      slides = Pathname.pwd + 'slides.md'
      markdown =  SlideRenderer.markdown_renderer
      libber = IndexLibber.new

      libber.author = Identifier.name
      libber.slides = markdown.render slides.read

      config = ProjectConfig.new(Pathname.pwd + 'config.json')
      libber.add_github_forkme config.json['github'] if config.json.key? 'github'

      libber.to_s
    end

    get '/index.js' do
      content_type :js
      config = ProjectConfig.new(Pathname.pwd + 'config.json')
      config.to_s
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
magic_reveal-2.4.0.4 lib/magic_reveal/app.rb
magic_reveal-2.4.0.3 lib/magic_reveal/app.rb