lib/request_log_analyzer/controller.rb in request-log-analyzer-1.8.0 vs lib/request_log_analyzer/controller.rb in request-log-analyzer-1.8.1

- old
+ new

@@ -19,11 +19,11 @@ # Builds a RequestLogAnalyzer::Controller given parsed command line arguments # <tt>arguments<tt> A CommandLine::Arguments hash containing parsed commandline parameters. def self.build_from_arguments(arguments) - require File.dirname(__FILE__) + '/../mixins/gets_memory_protection' if arguments[:gets_memory_protection] + require 'mixins/gets_memory_protection' if arguments[:gets_memory_protection] options = {} # Copy fields options[:database] = arguments[:database] @@ -45,10 +45,11 @@ options[:report_sort] = arguments[:report_sort] options[:report_amount] = arguments[:report_amount] options[:mailhost] = arguments[:mailhost] options[:mailsubject] = arguments[:mailsubject] options[:silent] = arguments[:silent] + options[:parse_strategy] = arguments[:parse_strategy] # Apache format workaround if arguments[:rails_format] options[:format] = {:rails => arguments[:rails_format]} elsif arguments[:apache_format] @@ -153,11 +154,11 @@ output_args = {} output_object = nil if options[:output].is_a?(Class) output_class = options[:output] else - output_class = RequestLogAnalyzer::Output::const_get(options[:output]) + output_class = RequestLogAnalyzer::Output.const_get(options[:output]) end output_sort = options[:report_sort].split(',').map { |s| s.to_sym } output_amount = options[:report_amount] == 'all' ? :all : options[:report_amount].to_i @@ -181,18 +182,21 @@ else file_format = RequestLogAnalyzer::FileFormat.load(options[:format]) end # Kickstart the controller - controller = Controller.new( RequestLogAnalyzer::Source::LogParser.new(file_format, :source_files => options[:source_files]), - { :output => output_instance, - :database => options[:database], # FUGLY! - :yaml => options[:yaml], - :reset_database => options[:reset_database], - :no_progress => options[:no_progress], - :silent => options[:silent], - }) + controller = + Controller.new(RequestLogAnalyzer::Source::LogParser.new(file_format, + :source_files => options[:source_files], + :parse_strategy => options[:parse_strategy]), + { :output => output_instance, + :database => options[:database], # FUGLY! + :yaml => options[:yaml], + :reset_database => options[:reset_database], + :no_progress => options[:no_progress], + :silent => options[:silent] + }) # register filters if options[:after] || options[:before] filter_options = {} [:after, :before].each do |filter| @@ -281,18 +285,18 @@ end # Adds an aggregator to the controller. The aggregator will be called for every request # that is parsed from the provided sources (see add_source) def add_aggregator(agg) - agg = RequestLogAnalyzer::Aggregator.const_get(RequestLogAnalyzer::to_camelcase(agg)) if agg.kind_of?(Symbol) + agg = RequestLogAnalyzer::Aggregator.const_get(RequestLogAnalyzer.to_camelcase(agg)) if agg.kind_of?(Symbol) @aggregators << agg.new(@source, @options) end alias :>> :add_aggregator # Adds a request filter to the controller. def add_filter(filter, filter_options = {}) - filter = RequestLogAnalyzer::Filter.const_get(RequestLogAnalyzer::to_camelcase(filter)) if filter.kind_of?(Symbol) + filter = RequestLogAnalyzer::Filter.const_get(RequestLogAnalyzer.to_camelcase(filter)) if filter.kind_of?(Symbol) @filters << filter.new(source.file_format, @options.merge(filter_options)) end # Push a request through the entire filterchain (@filters). # <tt>request</tt> The request to filter.