bin/request-log-analyzer in wvanbergen-request-log-analyzer-1.1.2 vs bin/request-log-analyzer in wvanbergen-request-log-analyzer-1.1.3
- old
+ new
@@ -1,18 +1,10 @@
#!/usr/bin/ruby
require File.dirname(__FILE__) + '/../lib/request_log_analyzer'
require File.dirname(__FILE__) + '/../lib/cli/command_line_arguments'
+require File.dirname(__FILE__) + '/../lib/cli/tools'
-def terminal_width(default = 81)
- IO.popen('stty -a') do |pipe|
- column_line = pipe.detect { |line| /(\d+) columns/ =~ line }
- width = column_line ? $1.to_i : default
- end
-rescue
- default
-end
-
# Parse the arguments given via commandline
begin
arguments = CommandLine::Arguments.parse do |command_line|
command_line.command(:install) do |install|
@@ -27,11 +19,11 @@
strip.switch(:keep_junk_lines, :j)
end
command_line.option(:format, :alias => :f, :default => 'rails')
command_line.option(:file, :alias => :e)
- command_line.switch(:assume_correct_order)
+ command_line.option(:parse_strategy, :default => 'assume-correct')
command_line.option(:aggregator, :alias => :a, :multiple => true)
command_line.option(:database, :alias => :d)
# filtering options
@@ -77,26 +69,9 @@
puts "run the following command in your application's root directory:"
puts
puts " request-log-analyzer install rails"
exit(0)
end
-
-def install_rake_tasks(install_type)
- if install_type == 'rails'
- require 'ftools'
- if File.directory?('./lib/tasks/')
- File.copy(File.dirname(__FILE__) + '/../tasks/request_log_analyzer.rake', './lib/tasks/request_log_analyze.rake')
- puts "Installed rake tasks."
- puts "To use, run: rake log:analyze"
- else
- puts "Cannot find /lib/tasks folder. Are you in your Rails directory?"
- puts "Installation aborted."
- end
- else
- raise "Cannot perform this install type! (#{install_type})"
- end
-end
-
case arguments.command
when :install
install_rake_tasks(arguments.parameters[0])
when :strip