omah 0.1.3 → 0.2.0
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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/omah.rb +36 -16
- metadata +27 -21
- 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: fa779806878b0447f1e3a3c987cd336bf54c09d1
|
4
|
+
data.tar.gz: 8f4258a8f300e86eccca21bb73a517142674b4ce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f97607f0eb40d41f4a6496b53a9c4cd2d51ffb914cfefafc9cbe4cf494ba42e38c6aae830518b22dffd4fab58dd11c304c8e09342481b75f96578f6706737dac
|
7
|
+
data.tar.gz: ebb79bb4ae2766c2f2ae11bd7a9c82f0d54625d5ef217d3eb730a5d42e93f8fa64f1f28d539f150689566b2a4ce137dbeb5a0e71f716adb772c7f907c2d056cc
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/omah.rb
CHANGED
@@ -9,41 +9,61 @@ class Omah
|
|
9
9
|
|
10
10
|
def initialize(options={})
|
11
11
|
|
12
|
-
opt = {user: ''}.merge options
|
12
|
+
opt = {user: 'user'}.merge options
|
13
13
|
@user = opt[:user]
|
14
|
+
FileUtils.mkdir_p @user # attempt to mkdir regardless if it already exists
|
15
|
+
Dir.chdir @user
|
16
|
+
|
17
|
+
dailyfile = 'dynarexdaily.xml'
|
18
|
+
|
19
|
+
x = if File.exists? dailyfile then dailyfile
|
20
|
+
else
|
21
|
+
'messagesp[date]/message(id, tags, from, to, subject, date, txt_filepath, html_filepath)'
|
22
|
+
end
|
23
|
+
|
24
|
+
@dd = DynarexDaily.new x, {dir_archive: :yearly}
|
14
25
|
|
15
|
-
@dd = DynarexDaily.new
|
16
|
-
@dd.schema = 'messages/message(id, from, to, subject, date, body_text, body_html)'
|
17
26
|
end
|
18
27
|
|
19
28
|
def store messages
|
20
29
|
|
21
|
-
dynarex = Dynarex.new 'messages/message(id, title, txt_file, html_file)'
|
22
|
-
|
23
30
|
messages.each do |msg|
|
24
31
|
|
25
|
-
#puts 'msg[:subject] : ' + msg.subject.inspect
|
26
32
|
subject = msg[:subject]
|
27
33
|
title = subject.gsub(/\W+/,'-')[0,30].sub(/-$/,'')
|
28
|
-
a =
|
34
|
+
a = @dd.find_all_by_subject subject
|
35
|
+
|
29
36
|
ordinal = a.any? ? '.' + a.length.to_s : ''
|
30
37
|
txt_file = title + ordinal + '.txt'
|
31
38
|
html_file = title + ordinal + '.html'
|
32
39
|
|
33
40
|
id = msg[:id]
|
34
|
-
next if
|
41
|
+
next if @dd.find_by_id id
|
42
|
+
|
43
|
+
path = archive()
|
44
|
+
txt_filepath = File.join(path, txt_file)
|
45
|
+
html_filepath = File.join(path, html_file)
|
46
|
+
|
47
|
+
@dd.create msg.merge(txt_filepath: txt_filepath, \
|
48
|
+
html_filepath: html_filepath)
|
35
49
|
|
36
|
-
dynarex.create id: id, title: subject, txt_file: txt_file,
|
37
|
-
html_file: html_file
|
38
|
-
@dd.create msg
|
39
|
-
path = File.join @user + '/inbox'
|
40
50
|
FileUtils.mkdir_p path
|
41
|
-
File.write
|
42
|
-
File.write
|
51
|
+
File.write txt_filepath, msg[:body_text]
|
52
|
+
File.write html_filepath, msg[:body_html]
|
53
|
+
|
43
54
|
end
|
44
55
|
|
45
|
-
dynarex.save 'dynarex.xml'
|
46
56
|
@dd.save
|
47
57
|
end
|
58
|
+
|
59
|
+
private
|
60
|
+
|
61
|
+
def archive()
|
62
|
+
|
63
|
+
t = Time.now
|
64
|
+
path = File.join ['archive', t.year.to_s, \
|
65
|
+
Date::MONTHNAMES[t.month].downcase[0..2], t.day.to_s]
|
66
|
+
|
67
|
+
end
|
48
68
|
|
49
|
-
end
|
69
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omah
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -12,41 +12,47 @@ cert_chain:
|
|
12
12
|
-----BEGIN CERTIFICATE-----
|
13
13
|
MIIDljCCAn6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBIMRIwEAYDVQQDDAlnZW1t
|
14
14
|
YXN0ZXIxHjAcBgoJkiaJk/IsZAEZFg5qYW1lc3JvYmVydHNvbjESMBAGCgmSJomT
|
15
|
-
|
15
|
+
8ixkARkWAmV1MB4XDTE1MDMxMDIxMDkwNFoXDTE2MDMwOTIxMDkwNFowSDESMBAG
|
16
16
|
A1UEAwwJZ2VtbWFzdGVyMR4wHAYKCZImiZPyLGQBGRYOamFtZXNyb2JlcnRzb24x
|
17
17
|
EjAQBgoJkiaJk/IsZAEZFgJldTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
18
|
+
ggEBANNijMPouci2T5D0vAhxa0wNFLP09aBg2VNEuOI8QU+8+8tNfqm+0fiB/GS4
|
19
|
+
fMFb3PyskaqCmtUP2g9pW9jcb7R/KuUB6RAVwydyyonzTK2z2sK3XmkPPwGHKyff
|
20
|
+
qI7DLYNfU5a0dYbjbBfhkVkUzmJIHAn5iCVgXyBuQQ0SRdOH85b3C1JKYyqVpgSO
|
21
|
+
60KvusGqVkxLkL/LPchFHveo/HEYJlG8UrowE0YGTPF8ysqpkYtQj+8HVvWtwmuy
|
22
|
+
7F7thuHZjT8K0p0uRWeEmVcddYPq85oL8+GM4sOuz4DOJ+bqTk3LMJkvTdbvPIqA
|
23
|
+
8ikAx1BRLjtnRQquFc+FDEKKXO8CAwEAAaOBijCBhzAJBgNVHRMEAjAAMAsGA1Ud
|
24
|
+
DwQEAwIEsDAdBgNVHQ4EFgQUyYa8AtYl3JQd0YisUSseG2yORrUwJgYDVR0RBB8w
|
25
25
|
HYEbZ2VtbWFzdGVyQGphbWVzcm9iZXJ0c29uLmV1MCYGA1UdEgQfMB2BG2dlbW1h
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
26
|
+
c3RlckBqYW1lc3JvYmVydHNvbi5ldTANBgkqhkiG9w0BAQUFAAOCAQEAD8vVUToU
|
27
|
+
w3+jzDYz1O8svSa5VZs1tcEaD5OVKTpoenuBPKNGuqN0cd72r8e3RcbbLQm6H8uV
|
28
|
+
cjGk+uu1WUM4Oc2E8oUwRtdC5foCLXnBegZtFAR09ubGhrP+t3z2u5sjhZrOmxkv
|
29
|
+
9ndn9kj8qMhhzpHl6XNCc2l+0u8s5qDxMM/rtJ7xfUhEVHAoXTx4hS8W/O3/8ymi
|
30
|
+
0zw1VXC6TREVT7T7nA65ByZmHtHoBS+JQdPf/8tEDNxX/wNFpLTFk7FrwY00ReEH
|
31
|
+
3LosTxP//qasvjSWNDjmKeTI4/c/fvSDtS5mLXCsxnJ/1Jp4zlO0rZWz0/BgcPFj
|
32
|
+
GUN8SqUlRq5unw==
|
33
33
|
-----END CERTIFICATE-----
|
34
|
-
date:
|
34
|
+
date: 2015-03-10 00:00:00.000000000 Z
|
35
35
|
dependencies:
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: dynarex-daily
|
38
38
|
requirement: !ruby/object:Gem::Requirement
|
39
39
|
requirements:
|
40
|
+
- - "~>"
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: '0.1'
|
40
43
|
- - ">="
|
41
44
|
- !ruby/object:Gem::Version
|
42
|
-
version:
|
45
|
+
version: 0.1.12
|
43
46
|
type: :runtime
|
44
47
|
prerelease: false
|
45
48
|
version_requirements: !ruby/object:Gem::Requirement
|
46
49
|
requirements:
|
50
|
+
- - "~>"
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: '0.1'
|
47
53
|
- - ">="
|
48
54
|
- !ruby/object:Gem::Version
|
49
|
-
version:
|
55
|
+
version: 0.1.12
|
50
56
|
description:
|
51
57
|
email: james@r0bertson.co.uk
|
52
58
|
executables: []
|
@@ -66,7 +72,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
66
72
|
requirements:
|
67
73
|
- - ">="
|
68
74
|
- !ruby/object:Gem::Version
|
69
|
-
version:
|
75
|
+
version: 2.1.2
|
70
76
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
71
77
|
requirements:
|
72
78
|
- - ">="
|
@@ -74,7 +80,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
74
80
|
version: '0'
|
75
81
|
requirements: []
|
76
82
|
rubyforge_project:
|
77
|
-
rubygems_version: 2.
|
83
|
+
rubygems_version: 2.2.2
|
78
84
|
signing_key:
|
79
85
|
specification_version: 4
|
80
86
|
summary: 'Offline Mail Helper: Stores email messages in a file directory archive'
|
metadata.gz.sig
CHANGED
Binary file
|