Commit 9e6f0ffc authored by Coraline Ehmke's avatar Coraline Ehmke

Closes #2

parent 7f04b62a
......@@ -9,8 +9,8 @@ module Snuffle
def check(path="./")
summaries = []
file_list(path).each do |path_to_file|
Snuffle::Node.delete_all
puts "Checking #{path_to_file}..."
Snuffle::Node.delete_all
summary = Snuffle::SourceFile.new(path_to_file: path_to_file).summary
html_report(summary, summary.source)
summaries << summary
......
......@@ -27,8 +27,11 @@ module Snuffle
end
def output_path
FileUtils.mkpath(root_path)
root_path
return @output_path if @output_path
path = root_path
path << "/" + summary.path_to_results if summary
FileUtils.mkpath(path)
@output_path = root_path
end
def path_to_results
......@@ -36,7 +39,7 @@ module Snuffle
end
def filename
base = summary.class_filename
base = "#{summary.filename}"
base + file_extension
end
......
......@@ -93,7 +93,7 @@
%tr{class: "#{i % 2 == 1 ? 'odd' : 'even'} #{summary.has_results? ? '' : 'faint'}"}
%td
- if summary.has_results?
%a{href: "source/#{summary.class_filename}.htm"}
%a{href: "source/#{summary.path_to_results}/#{summary.filename}.htm"}
= summary.path_to_file
- else
= summary.path_to_file
......
......@@ -4,12 +4,16 @@ module Snuffle
include PoroPlus
attr_accessor :class_name, :path_to_file, :cohorts, :latent_objects, :source
def class_filename
self.class_name.downcase.gsub(' ', '_')
def has_results?
self.cohorts.count != 0 || self.latent_objects.count != 0
end
def has_results?
self.cohorts.count != 0 || self.latent_objects.count != 0
def path_to_results
self.path_to_file.split("/")[0..-2].join('/')
end
def filename
path_to_file.split("/")[-1]
end
end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment