9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
# File 'lib/tau/server.rb', line 9
def self.start
set :server, SERVER
set :port, Defaults::PORT
get FILE_PATH_EXP do |path|
path = File.expand_path File.join(CODE_DIR, path)
show_list_of_files_on path if File.directory? path
send_file path if File.exist? path
engine = Enginer.engine_for_render_to path
if engine != nil
engine.render_file engine.source_for(path)
else
raise Sinatra::NotFound
end
end
not_found do
show_list_of_files_on File.expand_path(CODE_DIR), "No such file or directory"
end
run!
end
|