markdown_gmail_sender 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/markdown_gmail_sender.rb +23 -6
- data.tar.gz.sig +0 -0
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6c6634629622b785adfb7629f8664b7aaa6f629b
|
4
|
+
data.tar.gz: 7aeec7461c016d95c7391d92002243780e3f7bee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e180dd4c66981c5bd9645dde2ff2e6744a10633706a95861f8eb3972b8bebfc0c6c9f8e00a356c69d6bb9ef3617aa6736358217ad051da6f64db101d1a3616d1
|
7
|
+
data.tar.gz: f084bbeb2cf4c836f403b6ac7b7255d2b6192d21abc444cc1906f119c0d273a0960d27bfb22341d2ec60c077190686da4140418121734106d47dc918cf16af53
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
@@ -20,16 +20,29 @@ class MarkdownGmailSender
|
|
20
20
|
|
21
21
|
# scan the compose directory for email files to deliver
|
22
22
|
|
23
|
-
@messages = Dir.glob(File.join(compose_dirpath, '*.md')).map do |
|
23
|
+
@messages = Dir.glob(File.join(compose_dirpath, '*.md')).map do |mdfile|
|
24
24
|
|
25
|
-
s = File.read
|
25
|
+
s = File.read mdfile
|
26
|
+
|
27
|
+
regex = %r{
|
28
|
+
|
29
|
+
(?<email>(?:.*<)?\w+(?:\.\w+)?@\S+>?){0}
|
30
|
+
(?<filepath>\s*[\w\/\.]+\s+){0}
|
26
31
|
|
27
|
-
|
28
|
-
|
32
|
+
from:\s(?<from>\g<email>)\s+
|
33
|
+
to:\s(?<to>\g<email>)\s+
|
34
|
+
(?:attachments?:\s+(?<attachments>\g<filepath>*))?
|
35
|
+
subject:\s+(?<subject> [^\n]+)\n
|
36
|
+
(?<body> .*)
|
37
|
+
|
38
|
+
}xm =~ s
|
39
|
+
|
40
|
+
files = attachments.nil? ? [] : attachments.split.map(&:strip)
|
29
41
|
|
30
42
|
{
|
31
|
-
filepath:
|
32
|
-
|
43
|
+
filepath: mdfile, from: from, to: to, attachments: files,
|
44
|
+
subject: subject, body_txt: body,
|
45
|
+
body_html: RDiscount.new(body).to_html
|
33
46
|
}
|
34
47
|
|
35
48
|
end
|
@@ -56,6 +69,10 @@ class MarkdownGmailSender
|
|
56
69
|
content_type 'text/html; charset=UTF-8'
|
57
70
|
body x[:body_html]
|
58
71
|
end
|
72
|
+
|
73
|
+
x[:attachments].each do |attachment|
|
74
|
+
add_file attachment.strip
|
75
|
+
end
|
59
76
|
|
60
77
|
end
|
61
78
|
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: markdown_gmail_sender
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -31,7 +31,7 @@ cert_chain:
|
|
31
31
|
OLGmpGkaE9Sobz20K+IVp5+s3z06CrVYK7TN2gXYiGZRGAxmnd3sd0F8Aewu4uWI
|
32
32
|
HiWyElQDGz9Bjw==
|
33
33
|
-----END CERTIFICATE-----
|
34
|
-
date: 2016-
|
34
|
+
date: 2016-06-28 00:00:00.000000000 Z
|
35
35
|
dependencies:
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: gmail
|
metadata.gz.sig
CHANGED
Binary file
|