Sha256: f76e99619b69dc3ba06f02960dbc9c5b08c4f9b3840a78cdfa7570b6a86f671e

Contents?: true

Size: 1.11 KB

Versions: 5

Compression:

Stored size: 1.11 KB

Contents

require 'sinatra/base'
require 'sinatra/json'
require 'yajl'

require_relative '../web'
require_relative 'data'

module Growbot
  module Web
    class App < Sinatra::Base
      configure do
        set :root, File.expand_path(File.dirname(__FILE__))

        set :public_folder, File.join(settings.root, '..', '..', '..', 'public')

        set :haml, format: :html5, layout: :layout
        set :scss, views: File.join(settings.root, 'views/sass')
        if ENV['RACK_ENV'].eql? 'production'
          set :scss, style: :compressed,
            cache: true,
            cache_location: '/tmp/growbot-sass-cache'
        else
          set :scss, style: :expanded
        end

        set :coffee, views: File.join(settings.root, 'views/coffee'),
          cache: true,
          cache_location: '/tmp/growbot-coffee-cache'

      end

      get '/' do
        haml :index
      end

      get '/data.json' do
        json Data.new.get
      end

      get '/stylesheets/:sheet.css' do
        scss params[:sheet].to_sym
      end

      get '/javascripts/:script.js' do
        coffee params[:script].to_sym
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
growbot-web-0.0.6 lib/growbot/web/app.rb
growbot-web-0.0.5 lib/growbot/web/app.rb
growbot-web-0.0.4 lib/growbot/web/app.rb
growbot-web-0.0.2 lib/growbot/web/app.rb
growbot-web-0.0.1 lib/growbot/web/app.rb