email_forward_parser 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 108a3d5da682072760ed99217ad68f469c4a600db7452ec60386a6e1f504c791
4
- data.tar.gz: ab7efb48ceeeef0f8a27377b56b2a86f0008c00c794005db55de03f326ea9b4e
3
+ metadata.gz: d13f8a06613ebc2be2afd53582a92b8bdb2647cfaac6d5e54f8d56e1ffc89991
4
+ data.tar.gz: 8078837a0c88106341f7c12d5e5030e9edffabc30d032c497a8cb7ebf5d72f3a
5
5
  SHA512:
6
- metadata.gz: 32fb415bacbbecc88b045d3b6eb517db25a166670129808186e4ab57b1167ee1b654383ba7c6027426f4b33f5ce8f73bdd101672fd718cbe5f1e20274b3c1ee0
7
- data.tar.gz: 85bff86e606bdede3d3905c121c3ceb1fbe76d9ffd369be4df71a2263149a1c7b7ec5fa5819fe2f305dc7d1cc14159de93b954ee5b2f5d6810d056ab76983a76
6
+ metadata.gz: 85a13cf7d9b1debd7600c7ee2b7329a035249dbbee58f244f762a0cb75a6ac64a446b93e5e1eec9adb9f9de1d21ef718b8bebecb218b5101d8261cf0c51d5a4b
7
+ data.tar.gz: ad4907443a5994d0f66be2bf9836577113cd88f1697181a0872a965be6bdffdf668fe78cfa2ad5f9249ddd4b23cad41f68325e9b9591441b6b1f95dd4d0fce43
data/.rubocop.yml ADDED
@@ -0,0 +1,5 @@
1
+ require:
2
+ - standard
3
+
4
+ inherit_gem:
5
+ standard: config/base.yml
data/Gemfile CHANGED
@@ -9,4 +9,9 @@ gem "rake", "~> 13.0"
9
9
 
10
10
  gem "minitest", "~> 5.0"
11
11
 
12
- gem "standard", "~> 1.3"
12
+ gem "standard"
13
+ gem "rubocop"
14
+
15
+ group :development do
16
+ gem "ruby-lsp", require: false
17
+ end
data/Gemfile.lock CHANGED
@@ -7,56 +7,73 @@ GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
9
  ast (2.4.2)
10
+ base64 (0.1.1)
10
11
  json (2.6.3)
11
12
  language_server-protocol (3.17.0.3)
12
- lint_roller (1.0.0)
13
- minitest (5.18.1)
13
+ lint_roller (1.1.0)
14
+ minitest (5.19.0)
14
15
  parallel (1.23.0)
15
16
  parser (3.2.2.3)
16
17
  ast (~> 2.4.1)
17
18
  racc
19
+ prettier_print (1.2.1)
18
20
  racc (1.7.1)
19
21
  rainbow (3.1.1)
20
22
  rake (13.0.6)
21
23
  regexp_parser (2.8.1)
22
- rexml (3.2.5)
23
- rubocop (1.52.1)
24
+ rexml (3.2.6)
25
+ rubocop (1.56.2)
26
+ base64 (~> 0.1.1)
24
27
  json (~> 2.3)
28
+ language_server-protocol (>= 3.17.0)
25
29
  parallel (~> 1.10)
26
30
  parser (>= 3.2.2.3)
27
31
  rainbow (>= 2.2.2, < 4.0)
28
32
  regexp_parser (>= 1.8, < 3.0)
29
33
  rexml (>= 3.2.5, < 4.0)
30
- rubocop-ast (>= 1.28.0, < 2.0)
34
+ rubocop-ast (>= 1.28.1, < 2.0)
31
35
  ruby-progressbar (~> 1.7)
32
36
  unicode-display_width (>= 2.4.0, < 3.0)
33
37
  rubocop-ast (1.29.0)
34
38
  parser (>= 3.2.1.0)
35
- rubocop-performance (1.18.0)
39
+ rubocop-performance (1.19.0)
36
40
  rubocop (>= 1.7.0, < 2.0)
37
41
  rubocop-ast (>= 0.4.0)
42
+ ruby-lsp (0.9.1)
43
+ language_server-protocol (~> 3.17.0)
44
+ sorbet-runtime
45
+ syntax_tree (>= 6.1.1, < 7)
46
+ yarp (>= 0.9, < 0.10)
38
47
  ruby-progressbar (1.13.0)
39
- standard (1.29.0)
48
+ sorbet-runtime (0.5.10990)
49
+ standard (1.31.0)
40
50
  language_server-protocol (~> 3.17.0.2)
41
51
  lint_roller (~> 1.0)
42
- rubocop (~> 1.52.0)
52
+ rubocop (~> 1.56.0)
43
53
  standard-custom (~> 1.0.0)
44
- standard-performance (~> 1.1.0)
45
- standard-custom (1.0.1)
54
+ standard-performance (~> 1.2)
55
+ standard-custom (1.0.2)
46
56
  lint_roller (~> 1.0)
47
- standard-performance (1.1.0)
48
- lint_roller (~> 1.0)
49
- rubocop-performance (~> 1.18.0)
57
+ rubocop (~> 1.50)
58
+ standard-performance (1.2.0)
59
+ lint_roller (~> 1.1)
60
+ rubocop-performance (~> 1.19.0)
61
+ syntax_tree (6.1.1)
62
+ prettier_print (>= 1.2.0)
50
63
  unicode-display_width (2.4.2)
64
+ yarp (0.9.0)
51
65
 
52
66
  PLATFORMS
53
67
  arm64-darwin-22
68
+ x86_64-linux
54
69
 
55
70
  DEPENDENCIES
56
71
  email_forward_parser!
57
72
  minitest (~> 5.0)
58
73
  rake (~> 13.0)
59
- standard (~> 1.3)
74
+ rubocop
75
+ ruby-lsp
76
+ standard
60
77
 
61
78
  BUNDLED WITH
62
79
  2.4.13
data/Rakefile CHANGED
@@ -9,6 +9,4 @@ Rake::TestTask.new(:test) do |t|
9
9
  t.test_files = FileList["test/**/test_*.rb"]
10
10
  end
11
11
 
12
- require "standard/rake"
13
-
14
- task default: %i[test standard]
12
+ task default: %i[test]
@@ -1,6 +1,6 @@
1
- require_relative "./regexes"
2
- require_relative "./utils"
3
- require_relative "./mailbox_parser"
1
+ require_relative "regexes"
2
+ require_relative "utils"
3
+ require_relative "mailbox_parser"
4
4
 
5
5
  module EmailForwardParser
6
6
  class OriginalEmailParser
@@ -53,7 +53,7 @@ module EmailForwardParser
53
53
 
54
54
  # A new line must be present between the Cc, To, Reply-To or Subject \
55
55
  # part and the actual body
56
- return match[2].strip if match && match.length == 3 && match[2].start_with?("\n\n")
56
+ return match[2..].join("\n").strip if match && match.length >= 3 && match[2].start_with?("\n\n")
57
57
  end
58
58
 
59
59
  # Second method: extract the text after the Subject part \
@@ -64,7 +64,7 @@ module EmailForwardParser
64
64
  )
65
65
 
66
66
  # No new line must be present between the Subject part and the actual body
67
- return match[2].strip if match && match.length == 3
67
+ return match[2..].join("\n").strip if match && match.length >= 3
68
68
 
69
69
  # Third method: return the raw text, as there is no original information \
70
70
  # embedded (no Cc, To, Subject, etc.) (Outlook 2019)
@@ -41,7 +41,7 @@ module EmailForwardParser
41
41
 
42
42
  if match && match.length > 3
43
43
  # The From has been detached by `split`, attach it back
44
- email = match[1] + match[match.length - 1]
44
+ email = match[1] + match[2..].join
45
45
 
46
46
  return {
47
47
  body:,
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EmailForwardParser
4
- VERSION = "0.1.0"
4
+ VERSION = "0.2.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: email_forward_parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sean Collins
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-06-29 00:00:00.000000000 Z
11
+ date: 2023-09-23 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email:
@@ -17,6 +17,7 @@ executables: []
17
17
  extensions: []
18
18
  extra_rdoc_files: []
19
19
  files:
20
+ - ".rubocop.yml"
20
21
  - ".standard.yml"
21
22
  - Gemfile
22
23
  - Gemfile.lock
@@ -49,7 +50,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
49
50
  - !ruby/object:Gem::Version
50
51
  version: '0'
51
52
  requirements: []
52
- rubygems_version: 3.4.12
53
+ rubygems_version: 3.4.10
53
54
  signing_key:
54
55
  specification_version: 4
55
56
  summary: Parse forwarded emails from body and subject