indy 0.3.4 → 0.4.0.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.travis.yml +8 -0
- data/Guardfile +12 -0
- data/History.txt +6 -0
- data/README.md +43 -14
- data/Rakefile +7 -0
- data/features/step_definitions/find_by.steps.rb +1 -1
- data/features/step_definitions/log_file.steps.rb +1 -1
- data/features/step_definitions/time.steps.rb +6 -6
- data/indy.gemspec +21 -13
- data/lib/indy.rb +10 -2
- data/lib/indy/indy.rb +87 -408
- data/lib/indy/log_definition.rb +115 -0
- data/lib/indy/log_formats.rb +15 -7
- data/lib/indy/search.rb +147 -0
- data/lib/indy/source.rb +143 -50
- data/lib/indy/time.rb +78 -0
- data/lib/indy/version.rb +1 -1
- data/performance/large.log +40000 -0
- data/performance/profile_spec.rb +7 -7
- data/performance/time_large_file_spec.rb +18 -0
- data/spec/helper.rb +5 -3
- data/spec/indy_private_spec.rb +24 -0
- data/spec/indy_spec.rb +153 -226
- data/spec/indy_struct_spec.rb +43 -0
- data/spec/log_definition_spec.rb +75 -0
- data/spec/log_format_spec.rb +62 -50
- data/spec/search_spec.rb +15 -25
- data/spec/source_spec.rb +43 -35
- data/spec/time_scope_spec.rb +162 -0
- data/spec/time_spec.rb +26 -192
- metadata +264 -164
- data/.autotest +0 -18
- data/.rvmrc +0 -1
- data/autotest/discover.rb +0 -2
- data/lib/indy/formats.rb +0 -3
- data/lib/indy/notes.txt +0 -9
- data/lib/indy/result_set.rb +0 -8
- data/lib/scanf.rb +0 -13
- data/spec/last_spec.rb +0 -42
- data/spec/result_set_spec.rb +0 -36
data/.autotest
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
begin
|
2
|
-
require 'autotest/growl'
|
3
|
-
rescue Exception
|
4
|
-
puts %{
|
5
|
-
Autotest/Autospec can use Growl (growl.info|growlforwindows.com) to assist with reporting errors.
|
6
|
-
This would require Growl for the appropriate platform (MAC|Windows) and the Ruby gem 'karl-autotest-growl'
|
7
|
-
}
|
8
|
-
sleep 4
|
9
|
-
end
|
10
|
-
|
11
|
-
Autotest.add_hook(:initialize) {|at|
|
12
|
-
at.add_exception %r{^\.git} # ignore Version Control System
|
13
|
-
at.add_exception %r{^./tmp} # ignore temp files, lest autotest will run again, and again...
|
14
|
-
at.add_mapping(%r{^lib/.*\.rb$}) {|f, _|
|
15
|
-
Dir['spec/**/*.rb']
|
16
|
-
}
|
17
|
-
nil
|
18
|
-
}
|
data/.rvmrc
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
rvm use 1.9.2
|
data/autotest/discover.rb
DELETED
data/lib/indy/formats.rb
DELETED
data/lib/indy/notes.txt
DELETED
data/lib/indy/result_set.rb
DELETED
data/lib/scanf.rb
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
|
2
|
-
require 'scanf'
|
3
|
-
|
4
|
-
f = File.open('spec/multiline.log')
|
5
|
-
|
6
|
-
first_capture_regexp = '\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}'
|
7
|
-
|
8
|
-
full_regexp = "^(#{first_capture_regexp})\\s+([A-Z]+)\\s+(.+?)(?=^#{first_capture_regexp}|\\z)"
|
9
|
-
|
10
|
-
f.read.scan(/#{full_regexp}/m) do |entry|
|
11
|
-
puts "Entry::::\n#{entry}"
|
12
|
-
end
|
13
|
-
|
data/spec/last_spec.rb
DELETED
@@ -1,42 +0,0 @@
|
|
1
|
-
require "#{File.dirname(__FILE__)}/helper"
|
2
|
-
|
3
|
-
describe 'Indy#last' do
|
4
|
-
|
5
|
-
context "method" do
|
6
|
-
|
7
|
-
before(:each) do
|
8
|
-
log_string = ["2000-09-07 14:07:41 INFO MyApp - Entering APPLICATION.",
|
9
|
-
"2000-09-07 14:09:00 INFO MyApp - Entering APPLICATION.",
|
10
|
-
"2000-09-09 14:10:56 INFO MyOtherApp - Exiting APPLICATION.",
|
11
|
-
"2000-09-10 14:08:00 INFO MyOtherApp - Exiting APPLICATION.",
|
12
|
-
"2000-09-10 14:08:41 INFO MyOtherApp - Exiting APPLICATION.",
|
13
|
-
"2000-09-10 14:09:00 INFO MyOtherApp - Exiting APPLICATION.",
|
14
|
-
"2000-09-10 14:09:30 INFO MyOtherApp - Exiting APPLICATION.",
|
15
|
-
"2000-09-10 14:10:55 INFO MyApp - Exiting APPLICATION."].join("\n")
|
16
|
-
@indy = Indy.search(log_string)
|
17
|
-
end
|
18
|
-
|
19
|
-
it "should return self" do
|
20
|
-
@indy.last(:span => 1).should be_kind_of Indy
|
21
|
-
end
|
22
|
-
|
23
|
-
it "should raise an error if passed an invalid parameter" do
|
24
|
-
lambda{ @indy.last('a') }.should raise_error( ArgumentError )
|
25
|
-
lambda{ @indy.last() }.should raise_error( ArgumentError )
|
26
|
-
lambda{ @indy.last(nil) }.should raise_error( ArgumentError )
|
27
|
-
lambda{ @indy.last({}) }.should raise_error( ArgumentError )
|
28
|
-
end
|
29
|
-
|
30
|
-
it "should return correct number of rows when passed a span of minutes" do
|
31
|
-
@indy.last( :span => 2).for(:all).length.should == 3
|
32
|
-
@indy.last( :span => 3).for(:all).length.should == 5
|
33
|
-
@indy.last( :span => 1_440).for(:all).length.should == 6
|
34
|
-
end
|
35
|
-
|
36
|
-
it "should return correct rows when passed a span of minutes" do
|
37
|
-
@indy.last( :span => 3).for(:all).first.time.should == '2000-09-10 14:08:00'
|
38
|
-
end
|
39
|
-
|
40
|
-
end
|
41
|
-
|
42
|
-
end
|
data/spec/result_set_spec.rb
DELETED
@@ -1,36 +0,0 @@
|
|
1
|
-
require "#{File.dirname(__FILE__)}/helper"
|
2
|
-
|
3
|
-
describe 'ResultSet' do
|
4
|
-
|
5
|
-
it "should be Enumerable" do
|
6
|
-
ResultSet.new.should be_kind_of(Enumerable)
|
7
|
-
end
|
8
|
-
|
9
|
-
context 'search results' do
|
10
|
-
|
11
|
-
before(:all) do
|
12
|
-
logcontent = "2000-09-07 14:07:42 INFO MyApp - Entering APPLICATION.\n2000-09-07 14:07:43 DEBUG MyOtherApp - Entering APPLICATION.\n2000-09-07 14:07:45 WARN MyThirdApp - Entering APPLICATION."
|
13
|
-
@indy = Indy.search(logcontent)
|
14
|
-
end
|
15
|
-
|
16
|
-
context 'per line results' do
|
17
|
-
|
18
|
-
it "should contain an array of Enumerables" do
|
19
|
-
@indy.for(:all).first.should be_kind_of(Enumerable)
|
20
|
-
end
|
21
|
-
|
22
|
-
it "should provide attribute readers for each field" do
|
23
|
-
line1, line2, line3 = @indy.for(:all)
|
24
|
-
line1.time.should == '2000-09-07 14:07:42'
|
25
|
-
line1.severity.should == 'INFO'
|
26
|
-
line1.application.should == 'MyApp'
|
27
|
-
line1.message.should == 'Entering APPLICATION.'
|
28
|
-
line2.application.should == 'MyOtherApp'
|
29
|
-
line3.application.should == 'MyThirdApp'
|
30
|
-
end
|
31
|
-
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
|
36
|
-
end
|