Sha256: 67fdfedee49f6d2c6f1bae38ec9c9263387751ea3aca9ee10903a1b4a91299b4
Contents?: true
Size: 1.06 KB
Versions: 3
Compression:
Stored size: 1.06 KB
Contents
module JsSpec module Resources class WebRoot attr_reader :public_path def initialize(public_path) @public_path = ::File.expand_path(public_path) end def locate(name) case name when 'specs' Resources::Dir.new(JsSpec::Server.spec_root_path, "/specs") when 'core' Resources::Dir.new(JsSpec::Server.core_path, "/core") when 'implementations' Resources::Dir.new(JsSpec::Server.implementation_root_path, "/implementations") when 'suites' Resources::Suite when 'runners' Resources::Runners.new else potential_file_in_public_path = "#{public_path}/#{name}" if ::File.directory?(potential_file_in_public_path) Resources::Dir.new(potential_file_in_public_path, "/#{name}") elsif ::File.exists?(potential_file_in_public_path) Resources::File.new(potential_file_in_public_path, "/#{name}") else raise "Invalid path: #{name}" end end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
js_spec-0.1.0 | lib/js_spec/resources/web_root.rb |
js_spec-0.2.0 | lib/js_spec/resources/web_root.rb |
js_spec-0.2.1 | lib/js_spec/resources/web_root.rb |