pipio 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.
- checksums.yaml +7 -0
- data/.gitignore +27 -0
- data/.rspec +2 -0
- data/.simplecov +5 -0
- data/.travis.yml +12 -0
- data/Gemfile +3 -0
- data/LICENSE +20 -0
- data/NEWS.md +10 -0
- data/README.md +88 -0
- data/Rakefile +13 -0
- data/lib/pipio.rb +34 -0
- data/lib/pipio/alias_registry.rb +26 -0
- data/lib/pipio/chat.rb +39 -0
- data/lib/pipio/cleaners/html_cleaner.rb +95 -0
- data/lib/pipio/cleaners/text_cleaner.rb +15 -0
- data/lib/pipio/file_reader.rb +29 -0
- data/lib/pipio/message_creators/auto_or_xml_message_creator.rb +25 -0
- data/lib/pipio/message_creators/event_message_creator.rb +47 -0
- data/lib/pipio/message_creators/status_message_creator.rb +19 -0
- data/lib/pipio/messages/auto_reply_message.rb +7 -0
- data/lib/pipio/messages/event.rb +67 -0
- data/lib/pipio/messages/message.rb +23 -0
- data/lib/pipio/messages/status_message.rb +26 -0
- data/lib/pipio/messages/xml_message.rb +43 -0
- data/lib/pipio/metadata.rb +34 -0
- data/lib/pipio/metadata_parser.rb +55 -0
- data/lib/pipio/parser_factory.rb +32 -0
- data/lib/pipio/parsers/basic_parser.rb +83 -0
- data/lib/pipio/parsers/html_log_parser.rb +22 -0
- data/lib/pipio/parsers/null_parser.rb +9 -0
- data/lib/pipio/parsers/text_log_parser.rb +21 -0
- data/lib/pipio/tag_balancer.rb +163 -0
- data/lib/pipio/time_parser.rb +36 -0
- data/lib/pipio/version.rb +3 -0
- data/pipio.gemspec +27 -0
- data/spec/pipio/alias_registry_spec.rb +37 -0
- data/spec/pipio/chat_spec.rb +66 -0
- data/spec/pipio/cleaners/html_cleaner_spec.rb +102 -0
- data/spec/pipio/cleaners/text_cleaner_spec.rb +29 -0
- data/spec/pipio/file_reader_spec.rb +130 -0
- data/spec/pipio/messages/auto_reply_message_spec.rb +40 -0
- data/spec/pipio/messages/event_spec.rb +41 -0
- data/spec/pipio/messages/status_message_spec.rb +43 -0
- data/spec/pipio/messages/xml_message_spec.rb +55 -0
- data/spec/pipio/metadata_parser_spec.rb +81 -0
- data/spec/pipio/metadata_spec.rb +72 -0
- data/spec/pipio/parser_factory_spec.rb +31 -0
- data/spec/pipio/parsers/html_log_parser_spec.rb +160 -0
- data/spec/pipio/parsers/null_parser_spec.rb +13 -0
- data/spec/pipio/parsers/text_log_parser_spec.rb +37 -0
- data/spec/pipio/tag_balancer_spec.rb +16 -0
- data/spec/pipio/time_parser_spec.rb +66 -0
- data/spec/pipio_spec.rb +63 -0
- data/spec/spec_helper.rb +18 -0
- data/spec/support/chat_builder.rb +29 -0
- data/spec/support/chat_builder_helpers.rb +41 -0
- data/spec/support/file_builder.rb +22 -0
- data/spec/support/html_chat_builder.rb +67 -0
- data/spec/support/logfiles/2006-12-21.223606.txt +3 -0
- data/spec/support/logfiles/2008-01-15.071445-0500PST.htm +5 -0
- data/spec/support/logfiles/2008-01-15.071445-0500PST.html +5 -0
- data/spec/support/text_chat_builder.rb +21 -0
- data/spec/test-output/README.md +1 -0
- data/spec/test-output/html_log_output.xml +6 -0
- data/spec/test-output/text_log_output.xml +4 -0
- metadata +193 -0
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
|
3
|
+
module FileBuilder
|
4
|
+
SPEC_DIR = File.dirname(File.dirname(__FILE__))
|
5
|
+
OUTPUT_PATH = File.join(SPEC_DIR, 'built-files')
|
6
|
+
|
7
|
+
def self.create_file(path, &block)
|
8
|
+
path_to_created_file = File.join(OUTPUT_PATH, path)
|
9
|
+
FileUtils.mkdir_p(File.dirname(path_to_created_file))
|
10
|
+
open(path_to_created_file, 'w', &block)
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.remove_created_files
|
14
|
+
FileUtils.rm_rf(OUTPUT_PATH)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
RSpec.configure do |config|
|
19
|
+
config.after do
|
20
|
+
FileBuilder.remove_created_files
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
require File.expand_path('./chat_builder', File.dirname(__FILE__))
|
2
|
+
|
3
|
+
class HtmlChatBuilder < ChatBuilder
|
4
|
+
def write
|
5
|
+
super("<br/>")
|
6
|
+
end
|
7
|
+
|
8
|
+
def first_line(options = {})
|
9
|
+
assert_keys(options, [:from, :to, :time, :service])
|
10
|
+
|
11
|
+
@first_line ||= begin
|
12
|
+
to = options[:to] || 'TO_SN'
|
13
|
+
time = options[:time] || Time.now.strftime('%m/%d/%Y %I:%M:%S %p')
|
14
|
+
service = options[:service] || 'aim'
|
15
|
+
# Need to track this so we can set the message font color correctly.
|
16
|
+
@from = options[:from] || DEFAULT_FROM
|
17
|
+
%(<head><meta http-equiv="content-type" content="text/html; charset=UTF-8"><title>Conversation with #{to} at #{time} on #{@from} (#{service})</title></head><h3>Conversation with #{to} at #{time} on #{@from} (#{service})</h3>)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def message(text = 'hello', options = {})
|
22
|
+
assert_keys(options, [:from, :from_alias, :time, :font_color])
|
23
|
+
|
24
|
+
from = options[:from] || DEFAULT_FROM
|
25
|
+
from_alias = options[:from_alias] || 'FROM_ALIAS'
|
26
|
+
time = options[:time] || Time.now.strftime('%Y-%m-%d %H:%M:%S')
|
27
|
+
font_color = '#' + (options[:font_color] || font_color_for(from))
|
28
|
+
message = %{<font color="#{font_color}"><font size="2">(#{time})</font> <b>#{from_alias}</b></font> #{text}}
|
29
|
+
@messages << message
|
30
|
+
end
|
31
|
+
|
32
|
+
def status(text = 'Starting transfer of kitties.jpg from Gabe B-W', options = {})
|
33
|
+
assert_keys(options, [:time])
|
34
|
+
|
35
|
+
time = options[:time] || Time.now.strftime('%Y-%m-%d %H:%M:%S')
|
36
|
+
@messages << %{<font size="2">(#{time})</font><b> #{text}</b>}
|
37
|
+
end
|
38
|
+
|
39
|
+
def auto_reply(text = 'ran out for a bit', options = {})
|
40
|
+
assert_keys(options, [:time])
|
41
|
+
|
42
|
+
from = options[:from] || DEFAULT_FROM
|
43
|
+
from_alias = options[:from_alias] || 'FROM_ALIAS'
|
44
|
+
time = options[:time] || Time.now.strftime('%Y-%m-%d %H:%M:%S')
|
45
|
+
font_color = '#' + (options[:font_color] || font_color_for(from))
|
46
|
+
|
47
|
+
message = %{<font color="#{font_color}"><font size="2">(#{time})</font> <b>#{from} <AUTO-REPLY>:</b></font> #{text}}
|
48
|
+
@messages << message
|
49
|
+
end
|
50
|
+
|
51
|
+
private
|
52
|
+
|
53
|
+
def assert_keys(options, possible_keys)
|
54
|
+
extra_keys = options.keys - possible_keys
|
55
|
+
unless extra_keys.empty?
|
56
|
+
raise ArgumentError, "#{__method__} only takes the #{possible_keys}, got extra: #{extra_keys}"
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
def font_color_for(from)
|
61
|
+
if from == @from
|
62
|
+
'A82F2F'
|
63
|
+
else
|
64
|
+
'16569E'
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
@@ -0,0 +1,5 @@
|
|
1
|
+
<head><meta http-equiv="content-type" content="text/html; charset=UTF-8"><title>Conversation with aolsystemmsg at 1/15/2008 7:14:45 AM on otherSN (aim)</title></head><h3>Conversation with aolsystemmsg at 1/15/2008 7:14:45 AM on otherSN (aim)</h3>
|
2
|
+
<font color="#A82F2F"><font size="2">(2008-01-15 07:14:45)</font> <b>AOL System Msg:</b></font> Your screen name (otherSN) is now signed into AOL(R) Instant Messenger (TM) in 2 locations. To sign off the other location(s), reply to this message with the number 1. Click <a href='http://www.aim.com/password/routing.adp'>here</a> for more information.<br/>
|
3
|
+
<font color="#16569E"><font size="2">(2008-01-15 07:14:48)</font> <b>Gabe B-W:</b></font> <span style='color: #000000;'>1</span><br/>
|
4
|
+
<font color="#A82F2F"><font size="2">(2008-01-15 07:14:48)</font> <b>AOL System Msg:</b></font> Your other AIM sessions have been signed-off. You are now signed-on from 1 location(s).<br/>
|
5
|
+
|
@@ -0,0 +1,5 @@
|
|
1
|
+
<head><meta http-equiv="content-type" content="text/html; charset=UTF-8"><title>Conversation with aolsystemmsg at 1/15/2008 7:14:45 AM on otherSN (aim)</title></head><h3>Conversation with aolsystemmsg at 1/15/2008 7:14:45 AM on otherSN (aim)</h3>
|
2
|
+
<font color="#A82F2F"><font size="2">(2008-01-15 07:14:45)</font> <b>AOL System Msg:</b></font> Your screen name (otherSN) is now signed into AOL(R) Instant Messenger (TM) in 2 locations. To sign off the other location(s), reply to this message with the number 1. Click <a href='http://www.aim.com/password/routing.adp'>here</a> for more information.<br/>
|
3
|
+
<font color="#16569E"><font size="2">(2008-01-15 07:14:48)</font> <b>Gabe B-W:</b></font> <span style='color: #000000;'>1</span><br/>
|
4
|
+
<font color="#A82F2F"><font size="2">(2008-01-15 07:14:48)</font> <b>AOL System Msg:</b></font> Your other AIM sessions have been signed-off. You are now signed-on from 1 location(s).<br/>
|
5
|
+
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require File.expand_path('./chat_builder', File.dirname(__FILE__))
|
2
|
+
|
3
|
+
class TextChatBuilder < ChatBuilder
|
4
|
+
def first_line(options = {})
|
5
|
+
@first_line ||= begin
|
6
|
+
to = options[:to] || 'TO'
|
7
|
+
time = options[:time] || Time.now.strftime('%Y-%m-%d %H:%M:%S')
|
8
|
+
protocol = options[:protocol] || 'aim'
|
9
|
+
from = options[:from] || DEFAULT_FROM
|
10
|
+
"Conversation with #{to} at #{time} on #{from} (#{protocol})"
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def message(options = {})
|
15
|
+
time = options[:time] || Time.now.strftime('%H:%M:%S')
|
16
|
+
from_alias = options[:from_alias] || 'FROM'
|
17
|
+
text = options[:text] || 'Hi there'
|
18
|
+
message = "(#{time}) #{from_alias}: #{text}"
|
19
|
+
@messages << message
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
This folder holds already-parsed logs to allow for testing that Pipio's output is correct.
|
@@ -0,0 +1,6 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" ?>
|
2
|
+
<chat xmlns="http://purl.org/net/ulf/ns/0.4-02" account="jiggerificbug" service="AIM">
|
3
|
+
<message sender="aolsystemmsg" time="2008-01-15T07:14:45-0500" alias="AOL System Msg"><div><span style="font-family: Helvetica; font-size: 12pt;">Your screen name (jiggerificbug) is now signed into AOL(R) Instant Messenger (TM) in 2 locations. To sign off the other location(s), reply to this message with the number 1. Click <a href="http://www.aim.com/password/routing.adp">here</a> for more information.</span></div></message>
|
4
|
+
<message sender="jiggerificbug" time="2008-01-15T07:14:48-0500" alias="Gabe B-W"><div><span style="font-family: Helvetica; font-size: 12pt;">1</span></div></message>
|
5
|
+
<message sender="aolsystemmsg" time="2008-01-15T07:14:48-0500" alias="AOL System Msg"><div><span style="font-family: Helvetica; font-size: 12pt;">Your other AIM sessions have been signed-off. You are now signed-on from 1 location(s).</span></div></message>
|
6
|
+
</chat>
|
@@ -0,0 +1,4 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" ?>
|
2
|
+
<chat xmlns="http://purl.org/net/ulf/ns/0.4-02" account="jiggerificbug" service="AIM">
|
3
|
+
<message sender="jiggerificbug" time="2006-12-21T22:36:11-0700" alias="Gabe B-W"><div><span style="font-family: Helvetica; font-size: 12pt;">what are you doing tomorrow?</span></div></message>
|
4
|
+
</chat>
|
metadata
ADDED
@@ -0,0 +1,193 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: pipio
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Gabe Berke-Williams
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-07-23 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: mocha
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rspec
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '3.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '3.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: simplecov
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
description: A fast, easy way to parse Pidgin (gaim) logs
|
70
|
+
email: gabe@thoughtbot.com
|
71
|
+
executables: []
|
72
|
+
extensions: []
|
73
|
+
extra_rdoc_files: []
|
74
|
+
files:
|
75
|
+
- ".gitignore"
|
76
|
+
- ".rspec"
|
77
|
+
- ".simplecov"
|
78
|
+
- ".travis.yml"
|
79
|
+
- Gemfile
|
80
|
+
- LICENSE
|
81
|
+
- NEWS.md
|
82
|
+
- README.md
|
83
|
+
- Rakefile
|
84
|
+
- lib/pipio.rb
|
85
|
+
- lib/pipio/alias_registry.rb
|
86
|
+
- lib/pipio/chat.rb
|
87
|
+
- lib/pipio/cleaners/html_cleaner.rb
|
88
|
+
- lib/pipio/cleaners/text_cleaner.rb
|
89
|
+
- lib/pipio/file_reader.rb
|
90
|
+
- lib/pipio/message_creators/auto_or_xml_message_creator.rb
|
91
|
+
- lib/pipio/message_creators/event_message_creator.rb
|
92
|
+
- lib/pipio/message_creators/status_message_creator.rb
|
93
|
+
- lib/pipio/messages/auto_reply_message.rb
|
94
|
+
- lib/pipio/messages/event.rb
|
95
|
+
- lib/pipio/messages/message.rb
|
96
|
+
- lib/pipio/messages/status_message.rb
|
97
|
+
- lib/pipio/messages/xml_message.rb
|
98
|
+
- lib/pipio/metadata.rb
|
99
|
+
- lib/pipio/metadata_parser.rb
|
100
|
+
- lib/pipio/parser_factory.rb
|
101
|
+
- lib/pipio/parsers/basic_parser.rb
|
102
|
+
- lib/pipio/parsers/html_log_parser.rb
|
103
|
+
- lib/pipio/parsers/null_parser.rb
|
104
|
+
- lib/pipio/parsers/text_log_parser.rb
|
105
|
+
- lib/pipio/tag_balancer.rb
|
106
|
+
- lib/pipio/time_parser.rb
|
107
|
+
- lib/pipio/version.rb
|
108
|
+
- pipio.gemspec
|
109
|
+
- spec/pipio/alias_registry_spec.rb
|
110
|
+
- spec/pipio/chat_spec.rb
|
111
|
+
- spec/pipio/cleaners/html_cleaner_spec.rb
|
112
|
+
- spec/pipio/cleaners/text_cleaner_spec.rb
|
113
|
+
- spec/pipio/file_reader_spec.rb
|
114
|
+
- spec/pipio/messages/auto_reply_message_spec.rb
|
115
|
+
- spec/pipio/messages/event_spec.rb
|
116
|
+
- spec/pipio/messages/status_message_spec.rb
|
117
|
+
- spec/pipio/messages/xml_message_spec.rb
|
118
|
+
- spec/pipio/metadata_parser_spec.rb
|
119
|
+
- spec/pipio/metadata_spec.rb
|
120
|
+
- spec/pipio/parser_factory_spec.rb
|
121
|
+
- spec/pipio/parsers/html_log_parser_spec.rb
|
122
|
+
- spec/pipio/parsers/null_parser_spec.rb
|
123
|
+
- spec/pipio/parsers/text_log_parser_spec.rb
|
124
|
+
- spec/pipio/tag_balancer_spec.rb
|
125
|
+
- spec/pipio/time_parser_spec.rb
|
126
|
+
- spec/pipio_spec.rb
|
127
|
+
- spec/spec_helper.rb
|
128
|
+
- spec/support/chat_builder.rb
|
129
|
+
- spec/support/chat_builder_helpers.rb
|
130
|
+
- spec/support/file_builder.rb
|
131
|
+
- spec/support/html_chat_builder.rb
|
132
|
+
- spec/support/logfiles/2006-12-21.223606.txt
|
133
|
+
- spec/support/logfiles/2008-01-15.071445-0500PST.htm
|
134
|
+
- spec/support/logfiles/2008-01-15.071445-0500PST.html
|
135
|
+
- spec/support/text_chat_builder.rb
|
136
|
+
- spec/test-output/README.md
|
137
|
+
- spec/test-output/html_log_output.xml
|
138
|
+
- spec/test-output/text_log_output.xml
|
139
|
+
homepage: https://github.com/gabebw/pipio
|
140
|
+
licenses:
|
141
|
+
- MIT
|
142
|
+
metadata: {}
|
143
|
+
post_install_message:
|
144
|
+
rdoc_options: []
|
145
|
+
require_paths:
|
146
|
+
- lib
|
147
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
148
|
+
requirements:
|
149
|
+
- - ">="
|
150
|
+
- !ruby/object:Gem::Version
|
151
|
+
version: 1.9.2
|
152
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
153
|
+
requirements:
|
154
|
+
- - ">="
|
155
|
+
- !ruby/object:Gem::Version
|
156
|
+
version: '0'
|
157
|
+
requirements: []
|
158
|
+
rubyforge_project:
|
159
|
+
rubygems_version: 2.2.2
|
160
|
+
signing_key:
|
161
|
+
specification_version: 4
|
162
|
+
summary: A fast, easy way to parse Pidgin (gaim) logs
|
163
|
+
test_files:
|
164
|
+
- spec/pipio/alias_registry_spec.rb
|
165
|
+
- spec/pipio/chat_spec.rb
|
166
|
+
- spec/pipio/cleaners/html_cleaner_spec.rb
|
167
|
+
- spec/pipio/cleaners/text_cleaner_spec.rb
|
168
|
+
- spec/pipio/file_reader_spec.rb
|
169
|
+
- spec/pipio/messages/auto_reply_message_spec.rb
|
170
|
+
- spec/pipio/messages/event_spec.rb
|
171
|
+
- spec/pipio/messages/status_message_spec.rb
|
172
|
+
- spec/pipio/messages/xml_message_spec.rb
|
173
|
+
- spec/pipio/metadata_parser_spec.rb
|
174
|
+
- spec/pipio/metadata_spec.rb
|
175
|
+
- spec/pipio/parser_factory_spec.rb
|
176
|
+
- spec/pipio/parsers/html_log_parser_spec.rb
|
177
|
+
- spec/pipio/parsers/null_parser_spec.rb
|
178
|
+
- spec/pipio/parsers/text_log_parser_spec.rb
|
179
|
+
- spec/pipio/tag_balancer_spec.rb
|
180
|
+
- spec/pipio/time_parser_spec.rb
|
181
|
+
- spec/pipio_spec.rb
|
182
|
+
- spec/spec_helper.rb
|
183
|
+
- spec/support/chat_builder.rb
|
184
|
+
- spec/support/chat_builder_helpers.rb
|
185
|
+
- spec/support/file_builder.rb
|
186
|
+
- spec/support/html_chat_builder.rb
|
187
|
+
- spec/support/logfiles/2006-12-21.223606.txt
|
188
|
+
- spec/support/logfiles/2008-01-15.071445-0500PST.htm
|
189
|
+
- spec/support/logfiles/2008-01-15.071445-0500PST.html
|
190
|
+
- spec/support/text_chat_builder.rb
|
191
|
+
- spec/test-output/README.md
|
192
|
+
- spec/test-output/html_log_output.xml
|
193
|
+
- spec/test-output/text_log_output.xml
|