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



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/eris/lib/jasmine_config_overrides.rb', line 39

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("/#{eris_config.enyo_js_path}") { run Rack::EnyoJs.new(eris_config.enyo_js_path) }
    map("/usr/palm/frameworks") { run Rack::File.new(eris_config.enyo_root) }

    map("/__ERIS_RESOURCES__") { run Rack::File.new(File.expand_path(File.join(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