14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
# File 'lib/jmv.rb', line 14
def do_GET(_request, response)
metadata_file = @server.config[:ResourcePath]
metadata = read metadata_file
context = {
'app' => {
'name' => 'Jekyll Metadata file Viewer',
'version' => JMV::VERSION,
},
'data' => {
'path' => metadata_file,
'data' => metadata,
'json' => JSON.pretty_generate(metadata),
}
}
template_contents = File.binread(TEMPLATE_PATH)
rendered_contents = Liquid::Template.parse(template_contents).render(context)
response.status = 200
response['Content-Type'] = 'text/html'
response.body = rendered_contents
end
|