atomlog 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,9 @@
1
+ $:.unshift File.dirname(__FILE__)
2
+ require 'atom_log'
3
+ require 'test/unit'
4
+
5
+ TEST_PARSER = AtomLog::Parser.new('test/fixtures/test.log')
6
+ FAIL_PARSER = AtomLog::Parser.new('this/does/not/exist')
7
+ TEST_LOG_LINE = 'I, [Wed Mar 03 02:34:24 JST 1999 895701 #19074] INFO -- Main: test'
8
+ ANOTHER_LOG_LINE = 'I, [2009-02-23T17:26:09.959833 #627] INFO -- : test'
9
+
@@ -0,0 +1,23 @@
1
+ require 'test/helper'
2
+
3
+ class TestGenerator < Test::Unit::TestCase
4
+
5
+ def test_object_works
6
+ a = AtomLog::Generator.new('test/fixtures/test.log')
7
+ assert a
8
+ end
9
+
10
+ def test_line_to_xml
11
+ a = AtomLog::Generator.new('test/fixtures/test.log')
12
+ line = AtomLog::Parser.parse_log_line(TEST_LOG_LINE)
13
+ xml_line = a.line_to_xml(line)
14
+ assert xml_line
15
+ end
16
+
17
+ def test_to_atom
18
+ a = AtomLog::Generator.new('test/fixtures/test.log')
19
+ assert a.to_atom
20
+ end
21
+
22
+
23
+ end
@@ -0,0 +1,46 @@
1
+ require 'test/helper'
2
+
3
+ class TestParser < Test::Unit::TestCase
4
+
5
+ def test_object_works
6
+ assert TEST_PARSER
7
+ end
8
+
9
+ def test_parse_date
10
+ res = AtomLog::Parser.parse_log_line(TEST_LOG_LINE)
11
+ res2 = AtomLog::Parser.parse_log_line(ANOTHER_LOG_LINE)
12
+ assert_equal "Wed Mar 03 02:34:24 JST 1999 895701", res[:date]
13
+ assert_equal "2009-02-23T17:26:09.959833", res2[:date]
14
+ end
15
+
16
+ def test_parse_severity_id
17
+ res = AtomLog::Parser.parse_log_line(TEST_LOG_LINE)
18
+ assert_equal "I", res[:severity_id]
19
+ end
20
+
21
+ def test_parse_pid
22
+ res = AtomLog::Parser.parse_log_line(TEST_LOG_LINE)
23
+ assert_equal "19074", res[:pid]
24
+ end
25
+
26
+ def test_parse_severity
27
+ res = AtomLog::Parser.parse_log_line(TEST_LOG_LINE)
28
+ res2 = AtomLog::Parser.parse_log_line(ANOTHER_LOG_LINE)
29
+ assert_equal "INFO", res2[:severity]
30
+ assert_equal "INFO", res[:severity]
31
+ end
32
+
33
+ def atest_parse_msg
34
+ res = AtomLog::Parser.parse_log_line(TEST_LOG_LINE)
35
+ res2 = AtomLog::Parser.parse_log_line(ANOTHER_LOG_LINE)
36
+ assert_equal "test", res[:msg]
37
+ assert_equal "test.", res[:msg]
38
+
39
+ end
40
+
41
+ def test_parse_arr_not_empty
42
+ res = TEST_PARSER.parse
43
+ assert res
44
+ end
45
+
46
+ end
metadata ADDED
@@ -0,0 +1,94 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: atomlog
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.1.1
5
+ platform: ruby
6
+ authors:
7
+ - jcapote
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-02-27 00:00:00 -05:00
13
+ default_executable: log2atom
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: uuid
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: "0"
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: builder
27
+ type: :runtime
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: "0"
34
+ version:
35
+ - !ruby/object:Gem::Dependency
36
+ name: file-tail
37
+ type: :runtime
38
+ version_requirement:
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: "0"
44
+ version:
45
+ description: A library for parsing ruby's Logger format into an Atom feed
46
+ email: jcapote@gmail.com
47
+ executables:
48
+ - log2atom
49
+ extensions: []
50
+
51
+ extra_rdoc_files: []
52
+
53
+ files:
54
+ - README.markdown
55
+ - VERSION.yml
56
+ - bin/log2atom
57
+ - lib/atom_log.rb
58
+ - lib/generator.rb
59
+ - lib/parser.rb
60
+ - test/fixtures/test.log
61
+ - test/helper.rb
62
+ - test/test_generator.rb
63
+ - test/test_parser.rb
64
+ has_rdoc: true
65
+ homepage: http://github.com/jcapote/atomlog
66
+ licenses: []
67
+
68
+ post_install_message:
69
+ rdoc_options:
70
+ - --inline-source
71
+ - --charset=UTF-8
72
+ require_paths:
73
+ - lib
74
+ required_ruby_version: !ruby/object:Gem::Requirement
75
+ requirements:
76
+ - - ">="
77
+ - !ruby/object:Gem::Version
78
+ version: "0"
79
+ version:
80
+ required_rubygems_version: !ruby/object:Gem::Requirement
81
+ requirements:
82
+ - - ">="
83
+ - !ruby/object:Gem::Version
84
+ version: "0"
85
+ version:
86
+ requirements: []
87
+
88
+ rubyforge_project:
89
+ rubygems_version: 1.3.4
90
+ signing_key:
91
+ specification_version: 2
92
+ summary: A library for parsing ruby's Logger format into an Atom feed
93
+ test_files: []
94
+