rails_log_converter 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG.rdoc +2 -0
- data/Manifest +21 -0
- data/README.rdoc +42 -0
- data/Rakefile +46 -0
- data/bin/rails_log_converter +4 -0
- data/lib/core_ext/object.rb +9 -0
- data/lib/rails_log_converter/cli/execute.rb +61 -0
- data/lib/rails_log_converter/cli/options.rb +68 -0
- data/lib/rails_log_converter/cli.rb +31 -0
- data/lib/rails_log_converter/configuration.rb +10 -0
- data/lib/rails_log_converter/db/001_entry_migration.rb +29 -0
- data/lib/rails_log_converter/entry.rb +6 -0
- data/lib/rails_log_converter/parser.rb +111 -0
- data/lib/rails_log_converter/ui.rb +35 -0
- data/lib/rails_log_converter/version.rb +13 -0
- data/lib/rails_log_converter.rb +14 -0
- data/rails_log_converter.gemspec +47 -0
- data/spec/files/simple_log +55 -0
- data/spec/rails_log_converter/cli_spec.rb +20 -0
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +6 -0
- metadata +167 -0
data/CHANGELOG.rdoc
ADDED
data/Manifest
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
CHANGELOG.rdoc
|
2
|
+
Manifest
|
3
|
+
README.rdoc
|
4
|
+
Rakefile
|
5
|
+
bin/rails_log_converter
|
6
|
+
lib/core_ext/object.rb
|
7
|
+
lib/rails_log_converter.rb
|
8
|
+
lib/rails_log_converter/cli.rb
|
9
|
+
lib/rails_log_converter/cli/execute.rb
|
10
|
+
lib/rails_log_converter/cli/options.rb
|
11
|
+
lib/rails_log_converter/configuration.rb
|
12
|
+
lib/rails_log_converter/db/001_entry_migration.rb
|
13
|
+
lib/rails_log_converter/entry.rb
|
14
|
+
lib/rails_log_converter/parser.rb
|
15
|
+
lib/rails_log_converter/ui.rb
|
16
|
+
lib/rails_log_converter/version.rb
|
17
|
+
rails_log_converter.gemspec
|
18
|
+
spec/files/simple_log
|
19
|
+
spec/rails_log_converter/cli_spec.rb
|
20
|
+
spec/spec.opts
|
21
|
+
spec/spec_helper.rb
|
data/README.rdoc
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
= Rails Log Convert
|
2
|
+
|
3
|
+
A little app that will parse through a Rails log file and create an SQLite .db file. Allowing you to than run sql queries to find the information you need.
|
4
|
+
|
5
|
+
== Install
|
6
|
+
|
7
|
+
=== WARNING: This gem is still in early alpha
|
8
|
+
|
9
|
+
gem install rails_log_converter
|
10
|
+
|
11
|
+
== Usage
|
12
|
+
|
13
|
+
rails_log_converter production_file.log
|
14
|
+
|
15
|
+
== Todos
|
16
|
+
|
17
|
+
Need to add specs
|
18
|
+
Need to test data from a development log
|
19
|
+
Add ability to specify output
|
20
|
+
|
21
|
+
== License
|
22
|
+
|
23
|
+
Copyright (c) 2010 Andrew Kalek
|
24
|
+
|
25
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
26
|
+
a copy of this software and associated documentation files (the
|
27
|
+
"Software"), to deal in the Software without restriction, including
|
28
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
29
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
30
|
+
permit persons to whom the Software is furnished to do so, subject to
|
31
|
+
the following conditions:
|
32
|
+
|
33
|
+
The above copyright notice and this permission notice shall be
|
34
|
+
included in all copies or substantial portions of the Software.
|
35
|
+
|
36
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
37
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
38
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
39
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
40
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
41
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
42
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
require 'rake'
|
2
|
+
require 'spec/rake/spectask'
|
3
|
+
require "./lib/rails_log_converter/version"
|
4
|
+
|
5
|
+
begin
|
6
|
+
require 'echoe'
|
7
|
+
rescue LoadError
|
8
|
+
abort "You'll need to have `echoe' installed to use Echo's Rakefile"
|
9
|
+
end
|
10
|
+
|
11
|
+
|
12
|
+
version = RailsLogConverter::Version::STRING.dup
|
13
|
+
if ENV['SNAPSHOT'].to_i == 1
|
14
|
+
version << "." << Time.now.utc.strftime("%Y%m%d%H%M%S")
|
15
|
+
end
|
16
|
+
|
17
|
+
Echoe.new('rails_log_converter', version) do |p|
|
18
|
+
p.changelog = 'CHANGELOG.rdoc'
|
19
|
+
|
20
|
+
p.author = 'Andrew Kalek'
|
21
|
+
p.email = 'andrew.kalek@anlek.com'
|
22
|
+
|
23
|
+
p.ignore_pattern = ["tmp/*", "script/*", "Examples/*"]
|
24
|
+
|
25
|
+
p.summary = <<-DESC.strip.gsub(/\n\s+/, " ")
|
26
|
+
A little app that parses through your rails log file and converts it into a SQLite database.
|
27
|
+
DESC
|
28
|
+
|
29
|
+
p.url = "http://github.com/anlek/rails_log_converter"
|
30
|
+
p.rdoc_pattern = /^(lib|README.rdoc|CHANGELOG.rdoc)/
|
31
|
+
|
32
|
+
p.development_dependencies = ['rspec >=1.3', 'mocha >=0.9.8', 'yard >=0.5.3']
|
33
|
+
p.runtime_dependencies = ['sqlite3-ruby >=1.2.5', 'activerecord >=2.0']
|
34
|
+
end
|
35
|
+
|
36
|
+
spec_files = Rake::FileList["spec/**/*_spec.rb"]
|
37
|
+
|
38
|
+
desc "Run specs"
|
39
|
+
Spec::Rake::SpecTask.new do |t|
|
40
|
+
t.spec_files = spec_files
|
41
|
+
t.spec_opts = ["-c"]
|
42
|
+
end
|
43
|
+
|
44
|
+
task :default => :spec
|
45
|
+
|
46
|
+
Dir["#{File.dirname(__FILE__)}/tasks/*.rake"].sort.each { |ext| load ext }
|
@@ -0,0 +1,61 @@
|
|
1
|
+
module RailsLogConverter
|
2
|
+
class CLI
|
3
|
+
module Execute
|
4
|
+
def self.included(receiver)
|
5
|
+
receiver.extend ClassMethods
|
6
|
+
end
|
7
|
+
|
8
|
+
module ClassMethods
|
9
|
+
def execute
|
10
|
+
parse(ARGV).execute!
|
11
|
+
end
|
12
|
+
|
13
|
+
def setup_logger
|
14
|
+
ActiveRecord::Base.logger = Logger.new(Configuration.out_stream)
|
15
|
+
ActiveRecord::Base.logger.level = Logger::WARN
|
16
|
+
end
|
17
|
+
|
18
|
+
def create_database(path)
|
19
|
+
ActiveRecord::Base.establish_connection(
|
20
|
+
:adapter => "sqlite3",
|
21
|
+
:database => path
|
22
|
+
)
|
23
|
+
UI.puts "Saving output file to #{path}"
|
24
|
+
ActiveRecord::Base.connection
|
25
|
+
|
26
|
+
ActiveRecord::Migration.verbose = Configuration.debug?
|
27
|
+
ActiveRecord::Migrator.migrate(File.expand_path(File.dirname(__FILE__) + "/../db"), nil)
|
28
|
+
end
|
29
|
+
|
30
|
+
def close_database
|
31
|
+
ActiveRecord::Base.connection.disconnect!
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
def create_database
|
38
|
+
CLI.setup_logger
|
39
|
+
|
40
|
+
path = "#{directory_path}/#{database_name}"
|
41
|
+
File.delete path if File.exists?(path)
|
42
|
+
|
43
|
+
CLI.create_database(path)
|
44
|
+
end
|
45
|
+
|
46
|
+
def close_database
|
47
|
+
CLI.close_database
|
48
|
+
end
|
49
|
+
|
50
|
+
|
51
|
+
|
52
|
+
def execute!
|
53
|
+
create_database
|
54
|
+
Parser.parse_file(file_path)
|
55
|
+
close_database
|
56
|
+
UI.puts "[DONE]"
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
module RailsLogConverter
|
2
|
+
class CLI
|
3
|
+
module Options
|
4
|
+
module ClassMethods
|
5
|
+
# Return a new CLI instance with the given arguments pre-parsed and
|
6
|
+
# ready for execution.
|
7
|
+
def parse(args)
|
8
|
+
cli = new(args)
|
9
|
+
cli
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.included(receiver)
|
14
|
+
receiver.extend(ClassMethods)
|
15
|
+
end
|
16
|
+
|
17
|
+
|
18
|
+
# The hash of (parsed) command-line options
|
19
|
+
attr_reader :options
|
20
|
+
|
21
|
+
|
22
|
+
def option_parser
|
23
|
+
@option_parser ||= OptionParser.new do |opts|
|
24
|
+
script_name = File.basename($0)
|
25
|
+
opts.banner = "USAGE: #{script_name} log_file.log"
|
26
|
+
|
27
|
+
opts.on('-d', '--debug', 'Run application in debug mode') { |value| Configuration.debug = true }
|
28
|
+
|
29
|
+
opts.on("-h", "--help", "Show this message") do
|
30
|
+
UI.puts opts
|
31
|
+
exit
|
32
|
+
end
|
33
|
+
|
34
|
+
# Another typical switch to print the version.
|
35
|
+
opts.on("-v","--version", "Show version") do
|
36
|
+
UI.puts "#{script_name} version: #{RailsLogConverter::Version::STRING}"
|
37
|
+
exit
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def parse_options!
|
43
|
+
|
44
|
+
option_parser.parse!(args)
|
45
|
+
|
46
|
+
unless(args[0])
|
47
|
+
warn "Log file not given"
|
48
|
+
warn option_parser
|
49
|
+
exit
|
50
|
+
end
|
51
|
+
|
52
|
+
self.file_path = File.expand_path(args[0])
|
53
|
+
|
54
|
+
if !File.exists?(self.file_path)
|
55
|
+
warn "#{self.file_path}' does not exist."
|
56
|
+
exit
|
57
|
+
elsif !File.file?(self.file_path)
|
58
|
+
warn "#{self.file_path}' is not a file."
|
59
|
+
exit
|
60
|
+
elsif args.length > 2
|
61
|
+
warn "Too many arguments;"
|
62
|
+
warn option_parser
|
63
|
+
exit
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'optparse'
|
2
|
+
|
3
|
+
require 'rails_log_converter/cli/options'
|
4
|
+
require 'rails_log_converter/cli/execute'
|
5
|
+
|
6
|
+
module RailsLogConverter
|
7
|
+
class CLI
|
8
|
+
attr_reader :args
|
9
|
+
attr_accessor :file_path
|
10
|
+
include Execute, Options
|
11
|
+
|
12
|
+
def initialize(arguments, stdin=$stdin, stdout=$stdout)
|
13
|
+
@args = arguments.dup
|
14
|
+
RailsLogConverter::Configuration.in_stream = stdin
|
15
|
+
RailsLogConverter::Configuration.out_stream = stdout
|
16
|
+
parse_options!
|
17
|
+
end
|
18
|
+
|
19
|
+
def file_name
|
20
|
+
File.basename file_path
|
21
|
+
end
|
22
|
+
|
23
|
+
def directory_path
|
24
|
+
File.dirname file_path
|
25
|
+
end
|
26
|
+
|
27
|
+
def database_name
|
28
|
+
"#{file_name}.db"
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
class EntryMigration < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :entries do |t|
|
4
|
+
t.string :controller,
|
5
|
+
:action,
|
6
|
+
:ip,
|
7
|
+
:method,
|
8
|
+
:session_id,
|
9
|
+
:cookie_set,
|
10
|
+
:url
|
11
|
+
|
12
|
+
t.integer :req_per_sec,
|
13
|
+
:html_code
|
14
|
+
|
15
|
+
t.decimal :completed_time,
|
16
|
+
:database_time
|
17
|
+
|
18
|
+
t.text :parameters, :other
|
19
|
+
|
20
|
+
t.datetime :date
|
21
|
+
|
22
|
+
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.down
|
27
|
+
drop_table :entries
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,111 @@
|
|
1
|
+
module RailsLogConverter
|
2
|
+
class Parser
|
3
|
+
class << self
|
4
|
+
def parse_file(file_path)
|
5
|
+
parser = self.new()
|
6
|
+
parser.file_path = file_path
|
7
|
+
parser.parse_file
|
8
|
+
parser
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
def initialize
|
13
|
+
last_line = "not blank"
|
14
|
+
end
|
15
|
+
|
16
|
+
attr_accessor :file_path, :last_line
|
17
|
+
|
18
|
+
def current_entry
|
19
|
+
@current_entry ||= RailsLogConverter::Entry.new()
|
20
|
+
end
|
21
|
+
|
22
|
+
def parse_file
|
23
|
+
raise "File #{file_path} is missing" unless File.exists?(file_path)
|
24
|
+
UI.puts "Parsing File #{file_path}"
|
25
|
+
File.open(file_path, 'r').each_line do |line|
|
26
|
+
parse_line line.dup.chomp.strip
|
27
|
+
end
|
28
|
+
current_entry.save unless current_entry.controller.nil?
|
29
|
+
end
|
30
|
+
|
31
|
+
#######
|
32
|
+
private
|
33
|
+
#######
|
34
|
+
def parse_line(line)
|
35
|
+
case line
|
36
|
+
when /^Processing(.*)/
|
37
|
+
processing(line)
|
38
|
+
when /^Session ID(.*)/
|
39
|
+
session_id(line)
|
40
|
+
when /^Parameters(.*)/
|
41
|
+
parameters(line)
|
42
|
+
when /^Completed/
|
43
|
+
completed(line)
|
44
|
+
when ''
|
45
|
+
if(self.last_line == '')
|
46
|
+
current_entry.save
|
47
|
+
@current_entry = nil
|
48
|
+
UI.info ">> Creating new Entry object"
|
49
|
+
end
|
50
|
+
else
|
51
|
+
unknown(line)
|
52
|
+
end
|
53
|
+
self.last_line = line.dup
|
54
|
+
end
|
55
|
+
|
56
|
+
def processing(line)
|
57
|
+
log_line_as('processing', line)
|
58
|
+
ca = /(\w+)#(\w+)/.match(line)[0].split('#')
|
59
|
+
current_entry.controller = ca[0]
|
60
|
+
current_entry.action = ca[1]
|
61
|
+
|
62
|
+
current_entry.ip = /\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3}/.match(line)[0]
|
63
|
+
|
64
|
+
current_entry.method = /\[(\w+)\]/.match(line)[1]
|
65
|
+
|
66
|
+
current_entry.date = Time.parse(/\d{4}-\d{1,2}-\d{1,2}\s\d{1,2}:\d{2}:\d{2}/.match(line)[0])
|
67
|
+
rescue
|
68
|
+
unknown(line)
|
69
|
+
end
|
70
|
+
def session_id(line)
|
71
|
+
log_line_as('session_id', line)
|
72
|
+
current_entry.session_id = /\w+$/.match(line)[0]
|
73
|
+
rescue
|
74
|
+
unknown(line)
|
75
|
+
end
|
76
|
+
def parameters(line)
|
77
|
+
log_line_as('parameters', line)
|
78
|
+
begin
|
79
|
+
hash = eval(/\{\}|\{"(.*)"=>"?(.*)"?\}$/.match(line)[0])
|
80
|
+
current_entry.parameters = hash unless hash.empty?
|
81
|
+
rescue
|
82
|
+
UI.info "Error reading line: #{line}"
|
83
|
+
unknown(line)
|
84
|
+
end
|
85
|
+
end
|
86
|
+
def unknown(line)
|
87
|
+
log_line_as('*unknown*', line)
|
88
|
+
current_entry.other ||= []
|
89
|
+
current_entry.other << line
|
90
|
+
end
|
91
|
+
def completed(line)
|
92
|
+
log_line_as('completed', line)
|
93
|
+
current_entry.completed_time = $1 if /^Completed in ([\d.]*)[\s|ms]/.match(line)
|
94
|
+
current_entry.database_time = $1 if /DB: ([\d.]*)/.match(line)
|
95
|
+
current_entry.req_per_sec = $1 if /\((\d+)\sreqs\/sec\)/.match(line)
|
96
|
+
|
97
|
+
if /\|\s(\d*)\s(\w*)\s\[(.*)\]$/.match(line)
|
98
|
+
current_entry.html_code = $1
|
99
|
+
current_entry.url = $3
|
100
|
+
end
|
101
|
+
rescue
|
102
|
+
UI.info ">>> Error writing complete line: #{line}"
|
103
|
+
unknown(line)
|
104
|
+
end
|
105
|
+
|
106
|
+
def log_line_as(action, line)
|
107
|
+
message = "LINE: #{line}\n ACTION TAKEN: #{action}\n---"
|
108
|
+
UI.info message
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
module RailsLogConverter
|
2
|
+
class UI
|
3
|
+
class << self
|
4
|
+
def puts(msg)
|
5
|
+
Configuration.out_stream.puts(msg) if Configuration.out_stream
|
6
|
+
end
|
7
|
+
|
8
|
+
def info(msg)
|
9
|
+
Configuration.out_stream.puts(msg) if Configuration.out_stream && Configuration.debug?
|
10
|
+
end
|
11
|
+
|
12
|
+
def print(msg)
|
13
|
+
Configuration.out_stream.print(msg) if Configuration.out_stream
|
14
|
+
end
|
15
|
+
|
16
|
+
def gets
|
17
|
+
Configuration.in_stream ? Configuration.in_stream.gets : ''
|
18
|
+
end
|
19
|
+
|
20
|
+
def request(msg)
|
21
|
+
print(msg)
|
22
|
+
gets.chomp
|
23
|
+
end
|
24
|
+
|
25
|
+
def ask(msg)
|
26
|
+
request("#{msg} [yn] ") == 'y'
|
27
|
+
end
|
28
|
+
|
29
|
+
def abort(message='')
|
30
|
+
UI.puts message
|
31
|
+
Kernel.abort
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
$: << File.dirname(__FILE__)
|
2
|
+
require 'rubygems'
|
3
|
+
require 'sqlite3'
|
4
|
+
require 'active_record'
|
5
|
+
|
6
|
+
require 'core_ext/object'
|
7
|
+
|
8
|
+
require 'rails_log_converter/ui'
|
9
|
+
require 'rails_log_converter/version'
|
10
|
+
require 'rails_log_converter/configuration'
|
11
|
+
require 'rails_log_converter/entry'
|
12
|
+
require 'rails_log_converter/parser'
|
13
|
+
|
14
|
+
require 'rails_log_converter/cli'
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = %q{rails_log_converter}
|
5
|
+
s.version = "0.0.1"
|
6
|
+
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
|
+
s.authors = ["Andrew Kalek"]
|
9
|
+
s.date = %q{2010-04-19}
|
10
|
+
s.default_executable = %q{rails_log_converter}
|
11
|
+
s.description = %q{A little app that parses through your rails log file and converts it into a SQLite database.}
|
12
|
+
s.email = %q{andrew.kalek@anlek.com}
|
13
|
+
s.executables = ["rails_log_converter"]
|
14
|
+
s.extra_rdoc_files = ["CHANGELOG.rdoc", "README.rdoc", "lib/core_ext/object.rb", "lib/rails_log_converter.rb", "lib/rails_log_converter/cli.rb", "lib/rails_log_converter/cli/execute.rb", "lib/rails_log_converter/cli/options.rb", "lib/rails_log_converter/configuration.rb", "lib/rails_log_converter/db/001_entry_migration.rb", "lib/rails_log_converter/entry.rb", "lib/rails_log_converter/parser.rb", "lib/rails_log_converter/ui.rb", "lib/rails_log_converter/version.rb"]
|
15
|
+
s.files = ["CHANGELOG.rdoc", "Manifest", "README.rdoc", "Rakefile", "bin/rails_log_converter", "lib/core_ext/object.rb", "lib/rails_log_converter.rb", "lib/rails_log_converter/cli.rb", "lib/rails_log_converter/cli/execute.rb", "lib/rails_log_converter/cli/options.rb", "lib/rails_log_converter/configuration.rb", "lib/rails_log_converter/db/001_entry_migration.rb", "lib/rails_log_converter/entry.rb", "lib/rails_log_converter/parser.rb", "lib/rails_log_converter/ui.rb", "lib/rails_log_converter/version.rb", "rails_log_converter.gemspec", "spec/files/simple_log", "spec/rails_log_converter/cli_spec.rb", "spec/spec.opts", "spec/spec_helper.rb"]
|
16
|
+
s.homepage = %q{http://github.com/anlek/rails_log_converter}
|
17
|
+
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Rails_log_converter", "--main", "README.rdoc"]
|
18
|
+
s.require_paths = ["lib"]
|
19
|
+
s.rubyforge_project = %q{rails_log_converter}
|
20
|
+
s.rubygems_version = %q{1.3.6}
|
21
|
+
s.summary = %q{A little app that parses through your rails log file and converts it into a SQLite database.}
|
22
|
+
|
23
|
+
if s.respond_to? :specification_version then
|
24
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
25
|
+
s.specification_version = 3
|
26
|
+
|
27
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
28
|
+
s.add_runtime_dependency(%q<sqlite3-ruby>, [">= 1.2.5"])
|
29
|
+
s.add_runtime_dependency(%q<activerecord>, [">= 2.0"])
|
30
|
+
s.add_development_dependency(%q<rspec>, [">= 1.3"])
|
31
|
+
s.add_development_dependency(%q<mocha>, [">= 0.9.8"])
|
32
|
+
s.add_development_dependency(%q<yard>, [">= 0.5.3"])
|
33
|
+
else
|
34
|
+
s.add_dependency(%q<sqlite3-ruby>, [">= 1.2.5"])
|
35
|
+
s.add_dependency(%q<activerecord>, [">= 2.0"])
|
36
|
+
s.add_dependency(%q<rspec>, [">= 1.3"])
|
37
|
+
s.add_dependency(%q<mocha>, [">= 0.9.8"])
|
38
|
+
s.add_dependency(%q<yard>, [">= 0.5.3"])
|
39
|
+
end
|
40
|
+
else
|
41
|
+
s.add_dependency(%q<sqlite3-ruby>, [">= 1.2.5"])
|
42
|
+
s.add_dependency(%q<activerecord>, [">= 2.0"])
|
43
|
+
s.add_dependency(%q<rspec>, [">= 1.3"])
|
44
|
+
s.add_dependency(%q<mocha>, [">= 0.9.8"])
|
45
|
+
s.add_dependency(%q<yard>, [">= 0.5.3"])
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
Processing RegistrantsController#custom_field (for 99.255.99.166 at 2009-11-05 18:32:10) [GET]
|
2
|
+
Session ID: 3fd2af2cee13357a31104e3c0a0aa5f3
|
3
|
+
Parameters: {"object_name"=>"registration[new_parent_registrant]", "action"=>"custom_field", "product_id"=>"26", "authenticity_token"=>"99ba2d9db0d3e4cc40034bc87341ef65c7cd4e11", "registration_id"=>"cart", "controller"=>"registrants", "show_case_id"=>"2", "show_part_id"=>"5"}
|
4
|
+
Rendering registrants/custom_field
|
5
|
+
Completed in 0.02558 (39 reqs/sec) | Rendering: 0.00730 (28%) | DB: 0.02078 (81%) | 200 OK [http://www.example.com/show_cases/2/show_parts/5/registrations/cart/registrants/custom_field?object_name=registration%5Bnew_parent_registrant%5D&product_id=26&authenticity_token=99ba2d9db0d3e4cc40034bc87341ef65c7cd4e11]
|
6
|
+
|
7
|
+
|
8
|
+
Processing RegistrationsController#create (for 99.255.99.166 at 2009-11-05 18:32:14) [POST]
|
9
|
+
Session ID: 3fd2af2cee13357a31104e3c0a0aa5f3
|
10
|
+
Parameters: {"registration"=>{"new_parent_registrant"=>{"name"=> "bob","city"=>"guelph"}}, "action"=>"create", "authenticity_token"=>"99ba2d9db0d3e4cc40034bc87341ef65c7cd4e11", "controller"=>"registrations", "show_case_id"=>"2", "show_part_id"=>"5"}
|
11
|
+
Warning: SQLServer :lock option 'nil' not supported
|
12
|
+
Warning: SQLServer :lock option 'nil' not supported
|
13
|
+
Redirected to http://www.example.com/show_cases/2/show_parts/5/cart/registrant
|
14
|
+
Completed in 0.04851 (20 reqs/sec) | DB: 0.03705 (76%) | 302 Found [http://www.example.com/show_cases/2/show_parts/5/registrations]
|
15
|
+
|
16
|
+
|
17
|
+
Processing CartController#registrant (for 99.255.99.166 at 2009-11-05 18:32:14) [GET]
|
18
|
+
Session ID: 3fd2af2cee13357a31104e3c0a0aa5f3
|
19
|
+
Parameters: {"action"=>"registrant", "controller"=>"cart", "show_case_id"=>"2", "show_part_id"=>"5"}
|
20
|
+
Rendering template within layouts/application
|
21
|
+
Rendering cart/registrant
|
22
|
+
Completed in 0.01782 (56 reqs/sec) | Rendering: 0.00569 (31%) | DB: 0.01574 (88%) | 200 OK [http://www.example.com/show_cases/2/show_parts/5/cart/registrant]
|
23
|
+
|
24
|
+
|
25
|
+
Processing RegistrantsController#new (for 99.255.99.166 at 2009-11-05 18:32:15) [GET]
|
26
|
+
Session ID: 3fd2af2cee13357a31104e3c0a0aa5f3
|
27
|
+
Parameters: {"action"=>"new", "registration_id"=>"cart", "controller"=>"registrants", "show_case_id"=>"2", "show_part_id"=>"5"}
|
28
|
+
Warning: SQLServer :lock option 'nil' not supported
|
29
|
+
Rendering template within layouts/application
|
30
|
+
Rendering registrants/new
|
31
|
+
Completed in 0.15696 (6 reqs/sec) | Rendering: 0.02061 (13%) | DB: 0.12800 (81%) | 200 OK [http://www.example.com/show_cases/2/show_parts/5/registrations/cart/registrants/new]
|
32
|
+
|
33
|
+
|
34
|
+
Processing SessionController#destroy (for 76.10.176.141 at 2009-11-06 15:39:45) [GET]
|
35
|
+
Session ID: 1c9cbf429723b005fcdb4cb428747750
|
36
|
+
Parameters: {"action"=>"destroy", "controller"=>"session"}
|
37
|
+
Cookie set: auth_token=; path=/; expires=Thu, 01 Jan 1970 00:00:00 GMT
|
38
|
+
Redirected to http://www.example.com/show_cases/2/show_parts/5/registrations
|
39
|
+
Completed in 0.01725 (57 reqs/sec) | DB: 0.01598 (92%) | 302 Found [http://www.example.com/logout]
|
40
|
+
|
41
|
+
|
42
|
+
Processing RegistrationsController#index (for 76.10.176.141 at 2009-11-06 15:39:45) [GET]
|
43
|
+
Session ID: a7bf4c8b8ee0431f1643e76fcaf04258
|
44
|
+
Parameters: {"action"=>"index", "controller"=>"registrations", "show_case_id"=>"2", "show_part_id"=>"5"}
|
45
|
+
Redirected to http://www.example.com/show_cases/2/show_parts/5
|
46
|
+
Rendering template within layouts/application
|
47
|
+
|
48
|
+
|
49
|
+
Processing RegistrationsController#create (for 70.27.106.232 at 2009-11-06 15:41:06) [POST]
|
50
|
+
Session ID: 984b31d1c0f6104e186fb4eea5826a36
|
51
|
+
Parameters: {"registration"=>{"new_parent_registrant"=>{"city"=>"Toronto", "name" => "sam"}}, "action"=>"create", "authenticity_token"=>"3775abd6de916dd6d62e8ce6333e1f94a1615360", "controller"=>"registrations", "show_case_id"=>"2", "show_part_id"=>"5"}
|
52
|
+
Warning: SQLServer :lock option 'nil' not supported
|
53
|
+
Warning: SQLServer :lock option 'nil' not supported
|
54
|
+
Redirected to http://www.example.com/show_cases/2/show_parts/5/cart/registrant
|
55
|
+
Completed in 0.04703 (21 reqs/sec) | DB: 0.03621 (76%) | 302 Found [http://www.example.com/show_cases/2/show_parts/5/registrations]
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe RailsLogConverter::CLI do
|
4
|
+
before(:each) do
|
5
|
+
@output = IO.new(0)
|
6
|
+
@output.stubs(:puts)
|
7
|
+
@valid_args = ['spec/files/simple_log']
|
8
|
+
end
|
9
|
+
|
10
|
+
it "should run and finish fully" do
|
11
|
+
@output.expects(:puts).with('[DONE]')
|
12
|
+
lambda{ RailsLogConverter::CLI.new(@valid_args, nil, @output).execute! }.should_not raise_error
|
13
|
+
end
|
14
|
+
|
15
|
+
after(:all) do
|
16
|
+
#Remove Database file after you're done
|
17
|
+
database_file = File.expand_path("#{File.dirname(__FILE__)}/../../#{@valid_args[0]}.db")
|
18
|
+
File.delete(database_file) if File.exists?(database_file)
|
19
|
+
end
|
20
|
+
end
|
data/spec/spec.opts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--colour
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,167 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rails_log_converter
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
version: 0.0.1
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- Andrew Kalek
|
13
|
+
autorequire:
|
14
|
+
bindir: bin
|
15
|
+
cert_chain: []
|
16
|
+
|
17
|
+
date: 2010-04-19 00:00:00 -04:00
|
18
|
+
default_executable:
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: sqlite3-ruby
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
segments:
|
28
|
+
- 1
|
29
|
+
- 2
|
30
|
+
- 5
|
31
|
+
version: 1.2.5
|
32
|
+
type: :runtime
|
33
|
+
version_requirements: *id001
|
34
|
+
- !ruby/object:Gem::Dependency
|
35
|
+
name: activerecord
|
36
|
+
prerelease: false
|
37
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - ">="
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
segments:
|
42
|
+
- 2
|
43
|
+
- 0
|
44
|
+
version: "2.0"
|
45
|
+
type: :runtime
|
46
|
+
version_requirements: *id002
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: rspec
|
49
|
+
prerelease: false
|
50
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
segments:
|
55
|
+
- 1
|
56
|
+
- 3
|
57
|
+
version: "1.3"
|
58
|
+
type: :development
|
59
|
+
version_requirements: *id003
|
60
|
+
- !ruby/object:Gem::Dependency
|
61
|
+
name: mocha
|
62
|
+
prerelease: false
|
63
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - ">="
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
segments:
|
68
|
+
- 0
|
69
|
+
- 9
|
70
|
+
- 8
|
71
|
+
version: 0.9.8
|
72
|
+
type: :development
|
73
|
+
version_requirements: *id004
|
74
|
+
- !ruby/object:Gem::Dependency
|
75
|
+
name: yard
|
76
|
+
prerelease: false
|
77
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - ">="
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
segments:
|
82
|
+
- 0
|
83
|
+
- 5
|
84
|
+
- 3
|
85
|
+
version: 0.5.3
|
86
|
+
type: :development
|
87
|
+
version_requirements: *id005
|
88
|
+
description: A little app that parses through your rails log file and converts it into a SQLite database.
|
89
|
+
email: andrew.kalek@anlek.com
|
90
|
+
executables:
|
91
|
+
- rails_log_converter
|
92
|
+
extensions: []
|
93
|
+
|
94
|
+
extra_rdoc_files:
|
95
|
+
- CHANGELOG.rdoc
|
96
|
+
- README.rdoc
|
97
|
+
- lib/core_ext/object.rb
|
98
|
+
- lib/rails_log_converter.rb
|
99
|
+
- lib/rails_log_converter/cli.rb
|
100
|
+
- lib/rails_log_converter/cli/execute.rb
|
101
|
+
- lib/rails_log_converter/cli/options.rb
|
102
|
+
- lib/rails_log_converter/configuration.rb
|
103
|
+
- lib/rails_log_converter/db/001_entry_migration.rb
|
104
|
+
- lib/rails_log_converter/entry.rb
|
105
|
+
- lib/rails_log_converter/parser.rb
|
106
|
+
- lib/rails_log_converter/ui.rb
|
107
|
+
- lib/rails_log_converter/version.rb
|
108
|
+
files:
|
109
|
+
- CHANGELOG.rdoc
|
110
|
+
- Manifest
|
111
|
+
- README.rdoc
|
112
|
+
- Rakefile
|
113
|
+
- bin/rails_log_converter
|
114
|
+
- lib/core_ext/object.rb
|
115
|
+
- lib/rails_log_converter.rb
|
116
|
+
- lib/rails_log_converter/cli.rb
|
117
|
+
- lib/rails_log_converter/cli/execute.rb
|
118
|
+
- lib/rails_log_converter/cli/options.rb
|
119
|
+
- lib/rails_log_converter/configuration.rb
|
120
|
+
- lib/rails_log_converter/db/001_entry_migration.rb
|
121
|
+
- lib/rails_log_converter/entry.rb
|
122
|
+
- lib/rails_log_converter/parser.rb
|
123
|
+
- lib/rails_log_converter/ui.rb
|
124
|
+
- lib/rails_log_converter/version.rb
|
125
|
+
- rails_log_converter.gemspec
|
126
|
+
- spec/files/simple_log
|
127
|
+
- spec/rails_log_converter/cli_spec.rb
|
128
|
+
- spec/spec.opts
|
129
|
+
- spec/spec_helper.rb
|
130
|
+
has_rdoc: true
|
131
|
+
homepage: http://github.com/anlek/rails_log_converter
|
132
|
+
licenses: []
|
133
|
+
|
134
|
+
post_install_message:
|
135
|
+
rdoc_options:
|
136
|
+
- --line-numbers
|
137
|
+
- --inline-source
|
138
|
+
- --title
|
139
|
+
- Rails_log_converter
|
140
|
+
- --main
|
141
|
+
- README.rdoc
|
142
|
+
require_paths:
|
143
|
+
- lib
|
144
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
145
|
+
requirements:
|
146
|
+
- - ">="
|
147
|
+
- !ruby/object:Gem::Version
|
148
|
+
segments:
|
149
|
+
- 0
|
150
|
+
version: "0"
|
151
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
152
|
+
requirements:
|
153
|
+
- - ">="
|
154
|
+
- !ruby/object:Gem::Version
|
155
|
+
segments:
|
156
|
+
- 1
|
157
|
+
- 2
|
158
|
+
version: "1.2"
|
159
|
+
requirements: []
|
160
|
+
|
161
|
+
rubyforge_project: rails_log_converter
|
162
|
+
rubygems_version: 1.3.6
|
163
|
+
signing_key:
|
164
|
+
specification_version: 3
|
165
|
+
summary: A little app that parses through your rails log file and converts it into a SQLite database.
|
166
|
+
test_files: []
|
167
|
+
|