Sha256: fc5cc539acee4ac807ee90b0119d1fd681a9cd64f68c98bf74042caf2ce43ee5

Contents?: true

Size: 1.43 KB

Versions: 1

Compression:

Stored size: 1.43 KB

Contents

#!/usr/bin/ruby
require File.dirname(__FILE__) + '/../lib/request_log_analyzer'
require File.dirname(__FILE__) + '/../lib/command_line/arguments'

puts "Request log analyzer, by Willem van Bergen and Bart ten Brinke\n\n"

# Parse the arguments given via commandline
begin
  arguments = CommandLine::Arguments.parse do |command_line|
    command_line.switch(:guess_database_time, :g)
    command_line.switch(:fast, :f)
    command_line.switch(:colorize, :z)
    command_line.switch(:merb, :m)
    command_line.switch(:install, :i)
    command_line.flag(:output, :alias => :o)
    command_line.flag(:amount, :alias => :c)
    command_line.required_files = 1
  end
  
rescue CommandLine::Error => e
  puts "ARGUMENT ERROR: " + e.message
  puts
  load File.dirname(__FILE__) + "/../output/usage.rb"
  exit(0) 
end

if arguments[:install]
  if arguments.files.first == '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
  end
  exit(0)
end

$colorize = true if arguments[:colorize]

# Run the request_log_analyzer!
request_log_analyzer = RequestLogAnalyzer.new(arguments)
request_log_analyzer.analyze_this(arguments.files)


Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
wvanbergen-request-log-analyzer-0.3.4 bin/request-log-analyzer