lib/attractor/reporter.rb in attractor-0.3.1 vs lib/attractor/reporter.rb in attractor-0.3.2
- old
+ new
@@ -62,17 +62,22 @@
puts 'Generating an HTML report'
FileUtils.mkdir_p './attractor_output'
+ File.open('./attractor_output/logo.svg', 'w') { |file| file.write(logo) }
File.open('./attractor_output/main.css', 'w') { |file| file.write(css) }
File.open('./attractor_output/index.html', 'w') { |file| file.write(render) }
puts "Generated HTML report at #{File.expand_path './attractor_output/index.html'}"
Launchy.open(File.expand_path('./attractor_output/index.html'))
end
+ def logo
+ File.read(File.expand_path('../../app/assets/images/attractor_logo.svg', __dir__))
+ end
+
def css
File.read(File.expand_path('../../app/assets/stylesheets/main.css', __dir__))
end
def render
@@ -98,10 +103,14 @@
def css
File.read(File.expand_path('../../app/assets/stylesheets/main.css', __dir__))
end
+ def logo
+ File.read(File.expand_path('../../app/assets/images/attractor_logo.svg', __dir__))
+ end
+
def watch
@suggestions = @suggester.suggest
app = serve_via_rack
@@ -123,9 +132,11 @@
def route(path_info)
case path_info
when /main.css$/
[200, { 'Content-Type' => 'text/css' }, [css]]
+ when /logo.svg$/
+ [200, { 'Content-Type' => 'image/svg+xml' }, [logo]]
else
[200, { 'Content-Type' => 'text/html' }, [render]]
end
end
end