mailcvt 0.0.9 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/lib/grep_mail.rb CHANGED
@@ -4,6 +4,7 @@ require 'log_helper'
4
4
 
5
5
  class GrepMail
6
6
  def initialize(file, lines)
7
+ puts "DEBUG> GrepMail.init> \n\t\tfile = #{file}\n"
7
8
  @pcontent= file.length + 1
8
9
  grouplines(lines)
9
10
  end
@@ -60,6 +61,7 @@ class GrepMail
60
61
  end
61
62
 
62
63
  def tolog
64
+ puts "DEBUG> GrepMail.tolog > @groups = #{@groups}"
63
65
  lh = LogHelper.new(@groups)
64
66
  lh.tolog
65
67
  end
data/lib/log_helper.rb CHANGED
@@ -15,20 +15,21 @@ class LogHelper
15
15
  end
16
16
 
17
17
  def tolog
18
- @cols = Array.new(7)
18
+ cols = Array.new(7)
19
+
19
20
  @groups.each do |g|
20
21
  next if g[:key].nil? or g[:key].length < 2
21
22
  cap = g[:key][0]
22
23
  next unless @@ids.has_key?(cap)
23
24
 
24
25
  if cap == 'C' and g[:key][1] == 'o'
25
- @cols[-1] = concatattach(g)
26
+ cols << concatattach(g)
26
27
  else
27
- @cols[@@ids[cap]] = concatval(g)
28
+ cols[@@ids[cap]] = concatval(g)
28
29
  end
29
30
  end
30
31
 
31
- @cols.join("\a")
32
+ cols.join("\t")
32
33
  end
33
34
 
34
35
  def concatattach(group)
data/lib/mail_parser.rb CHANGED
@@ -31,15 +31,23 @@ class MailParser
31
31
  puts "#{cmd}"
32
32
 
33
33
  lines = []
34
+ curfile = nil
34
35
  File.open(File.join(@output, "test_log.log"), 'w') do |out|
35
36
  o.each do |line|
36
- if line == "--\n" and lines.length > 0
37
- gm = GrepMail.new(getfile(lines[0]), lines)
37
+ puts "DEBUG> MailParser> line = #{line}"
38
+ curfile = getfile(line) unless curfile
39
+ if line != "--\n" and !line.start_with?(curfile)
40
+ gm = GrepMail.new(curfile, lines)
38
41
  out.puts gm.tolog
42
+ curfile = getfile(line)
39
43
  lines = []
40
- else
41
- lines << line
42
44
  end
45
+ lines << line
46
+ end
47
+
48
+ if lines.length > 0
49
+ gm = GrepMail.new(curfile, lines)
50
+ out.puts gm.tolog
43
51
  end
44
52
  end
45
53
 
@@ -47,22 +55,8 @@ class MailParser
47
55
  end
48
56
  end
49
57
 
50
- def filechanged?(line)
51
- changed = false
52
- if @curfile.nil?
53
- @curfile = getfile(line)
54
- else
55
- changed = !line.start_with?(@curfile)
56
- end
57
-
58
- if changed
59
- @prevfile = @curfile
60
- @curfile = getfile(line)
61
- end
62
- changed
63
- end
64
-
65
58
  def getfile(line)
59
+
66
60
  pos = line.index(':')
67
61
  return "" if pos.nil?
68
62
  line[0..(pos-1)]
@@ -1,3 +1,3 @@
1
1
  module Mailcvt
2
- VERSION = '0.0.9'
2
+ VERSION = '0.1.0'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mailcvt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -114,7 +114,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
114
114
  version: '0'
115
115
  segments:
116
116
  - 0
117
- hash: -4410244498873720589
117
+ hash: 474110297974916369
118
118
  required_rubygems_version: !ruby/object:Gem::Requirement
119
119
  none: false
120
120
  requirements:
@@ -123,7 +123,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
123
123
  version: '0'
124
124
  segments:
125
125
  - 0
126
- hash: -4410244498873720589
126
+ hash: 474110297974916369
127
127
  requirements: []
128
128
  rubyforge_project:
129
129
  rubygems_version: 1.8.25