Sha256: e065a678c0256d433f4eeeee1be5844c1e17847f2d58a7f0f852ddbafd3cc9d2
Contents?: true
Size: 1.33 KB
Versions: 3
Compression:
Stored size: 1.33 KB
Contents
require 'thor' require 'snuffle' module Snuffle class CLI < Thor desc "snuffle check PATH_TO_FILES", "Example: snuffle app/models/" def check(path="./") summaries = [] file_list(path).each do |path_to_file| 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 end create_html_index(summaries, path) puts "Results written to #{results_files.last}" end default_task :check attr_accessor :last_file private def file_list(start_file) if File.directory?(start_file) return Dir.glob(File.join(start_file, "**", "*")).select{|n| n =~ /\.rb$/} else return [start_file] end end def report(summary, source) text_report(summary) cvs_report(summary) end def create_html_index(summaries, start_path) results_files << Snuffle::Formatters::HtmlIndex.new(summaries, start_path).export end def html_report(summary, source) return unless summary.cohorts.count > 0 || summary.latent_objects.count > 0 results_files << Snuffle::Formatters::Html.new(summary, source).export end def results_files @results_files ||= [] end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
snuffle-0.14.2 | lib/snuffle/cli.rb |
snuffle-0.14.1 | lib/snuffle/cli.rb |
snuffle-0.14.0 | lib/snuffle/cli.rb |