Sha256: f4eb61a86f3b4e14aa89a4d8bd4ba59a6bc6ca36d6ee214ce3bdd5908c6491cd

Contents?: true

Size: 950 Bytes

Versions: 1

Compression:

Stored size: 950 Bytes

Contents

module Hope
  
  module Server
    ROOT_DIR = File.dirname(File.expand_path(__FILE__))
    class App < Sinatra::Base
      
      configure do
        puts "Configure with reloader..."
        require 'sinatra/reloader'
        register Sinatra::Reloader

        also_reload "lib/**/*.rb"
      end

      set :views,  "#{Hope::Server::ROOT_DIR}/views"
      set :public, "#{Hope::Server::ROOT_DIR}/public"
      set :static, true

      # Helpers
      helpers   Hope::Server::Helpers

      # Resources
      register  Hope::Server::Resources::Engine
      register  Hope::Server::Resources::Statement
      register  Hope::Server::Resources::Source

      get "/?" do
        erb :app
      end
      
      get "/bootstrap" do
        respond_with({
          :engines => Hope.engines.values.map { |e| e.serializable_hash },
          :sources => Hope::Source.sources.values.map(&:serializable_hash)
        })
      end
      
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
hope-0.1.0-java lib/hope/server/app.rb