Sha256: 7fb0504919097ab1393d924dda3d73caaf29491b7275b47d440c96db9400768a

Contents?: true

Size: 1.72 KB

Versions: 7

Compression:

Stored size: 1.72 KB

Contents


require 'cuba'
require 'da99_rack_protect'
require 'multi_json'
require 'www_app'

PATH = File.expand_path(File.dirname(__FILE__) + '../../..')

Rack::Mime::MIME_TYPES.merge!({".map" => "application/json"})

Cuba.use Da99_Rack_Protect do |c|
  c.config :host, :localhost if ENV['IS_DEV']
end

if ENV['IS_DEV']
  # Cuba.use Rack::ShowExceptions
end

PAGES = {
  :root => WWW_App.new {
      title { 'hello' }
      background 'lightgrey'
      font_family 'Ubuntu Mono, monospace'
      color '#2C2C2D'

      style {
        div {
          border '1px dotted #fff'
          margin '10px'
          padding '10px'
          float 'left'
          min_width '80px'
        }

        div.^(:prepend) {
          border '1px dashed #000'
        }

        div.^(:append) {
          border '1px solid #000'
        }
      }

      script :news, :good do
        div.^(:good) {
          span { 'GOOD: ' }
          span { :msg }
        }
      end

      script :news, :bad do
        div.^(:bad) { :msg }
      end

      script do
        div { text('First: '); span { :first } }
      end

      script do
        div { text('Last: '); span { :last } }
      end

      script do
        div {
          text "This is a movie: "
          span { :movie }
        }
      end

      script :prepend do
        div.^(:prepend) {
          text "TOP movie: "
          span { :movie }
        }
      end

      p {
        "Almost done."
      }

    } # === www_app
} # === PAGES

Cuba.use Rack::Static, :urls=>["/www_app-#{File.read(PATH + '/VERSION').strip}"], :root=>'Public'

Cuba.define do

  on get do
    on root do
      res.write PAGES[:root].to_html
    end

    on 'error' do
      something
    end
  end

end # === Cuba.define

run Cuba

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
www_app-2.3.0 playground/config.ru
www_app-2.1.3 playground/config.ru
www_app-2.1.1 playground/config.ru
www_app-2.1.0 playground/config.ru
www_app-2.0.2 playground/config.ru
www_app-2.0.1 playground/config.ru
www_app-2.0.0 playground/config.ru