#!/usr/bin/env ruby # ---------------------------- # Main program. # ---------------------------- patterns = [ [/^Processing /, "Pages served\n"], [/^ActiveRecord::RecordNotFound /, "ActiveRecord::RecordNotFound\n"], [/^ActionController::RoutingError /, "ActionController::RoutingError\n"], [/undefined method `alphabetize'/, "Alphabetize\n"], [/Forgot to pass :type into localization for :footer_created/, "Footer\n"] ] counts = {} counts.default = 0 count = 0 for filename in ARGV blank_lines = 0 File.readlines(filename).each do |line| if line.chomp == '' blank_lines += 1 else if blank_lines >= 2 no_match = true for pat, label in patterns if line =~ pat # count += 1 # counts[label] += 1 no_match = false end end if no_match counts[line] += 1 end end blank_lines = 0 end end end for k, v in counts print("#{v}: #{k}") end