Sha256: 4c5a98e730723db28aa29a5961d086892408e197b69b9a92389a2c4cea6a11b1

Contents?: true

Size: 894 Bytes

Versions: 2

Compression:

Stored size: 894 Bytes

Contents

require 'sinatra/base'
require 'erb'

module Snapdragon
  class WebApplication < Sinatra::Base
    set :static, false
    set :root, ::File.expand_path('.', ::File.dirname(__FILE__))

    def initialize(app = nil, suite)
      super()
      @suite = suite
    end

    get "/run" do
      if @suite.jasmine_ver == "1"
        erb :run_v1
      else
        erb :run
      end
    end

    get "/jasmine/*" do |path|
      send_file ::File.expand_path(::File.join('../jasmine', path), ::File.dirname(__FILE__))
    end

    get "/jasmine_v1/*" do |path|
      send_file ::File.expand_path(::File.join('../jasmine_v1', path), ::File.dirname(__FILE__))
    end

    get "/resources/*" do |path|
      send_file ::File.expand_path(::File.join('resources', path), ::File.dirname(__FILE__))
    end

    get "/*" do |path|
      send_file ::File.expand_path(::File.join('.', path))
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
snapdragon-3.0.0 lib/snapdragon/web_application.rb
snapdragon-2.0.0 lib/snapdragon/web_application.rb