Module: Jasmine

Defined in:
lib/eris/lib/jasmine_config_overrides.rb,
lib/eris/lib/jasmine_config_overrides.rb

Defined Under Namespace

Classes: Config

Class Method Summary collapse

Class Method Details

.app(config) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/eris/lib/jasmine_config_overrides.rb', line 20

def self.app(config)
  Rack::Builder.app do
    use Rack::Head
 
    map('/run.html')         { run Jasmine::Redirect.new('/') }
    map('/__suite__')        { run Jasmine::FocusedSuite.new(config) }
 
    map('/__JASMINE_ROOT__') { run Rack::File.new(Jasmine.root) }
    map(config.spec_path)    { run Rack::File.new(config.spec_dir) }
    map(config.root_path)    { run Rack::File.new(config.project_root) }
    eris_config = ErisConfig.new(:config_path => 'eris_config.json', :app_root => config.project_root)

    map("/usr/palm/frameworks") { run Rack::File.new(eris_config.enyo_root) }
    map("/__ERIS_RESOURCES__") { run Rack::File.new(File.expand_path(File.dirname(__FILE__), '/../js')) }

    map('/') do
      run Rack::Cascade.new([
        Rack::URLMap.new('/' => Rack::File.new(config.src_dir)),
        Jasmine::RunAdapter.new(config)
      ])
    end
  end
end