omah 0.3.1 → 0.4.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/lib/omah.rb +33 -2
- data/stylesheet/listing.xsl +59 -0
- data.tar.gz.sig +0 -0
- metadata +2 -1
- 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: 73f91d058211f998467cc4314bc43d4bfcfd9a14
|
4
|
+
data.tar.gz: 43b1eb0e69709f89ef2f7ddc2df74a40dda62001
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 56dffcefd515810552cb81d0a3bc9c2ef5af5cdc685fa80c52583644020748593310130d77468bca72aa5c800a2cbbe688c34e32ebdffb9671e6bc657e1c6ac6
|
7
|
+
data.tar.gz: e38d7bda409d6b8bc66499c810b8649f93ab73070d78397f12e4f91e5ce95a16206fe2eb8684f20c720b177eb743f0c768961255f9e076c12ad022fad23d8f54
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/omah.rb
CHANGED
@@ -7,12 +7,26 @@ require 'zip'
|
|
7
7
|
require 'nokorexi'
|
8
8
|
require 'dynarex-daily'
|
9
9
|
|
10
|
+
module Library
|
11
|
+
|
12
|
+
def fetch_file(filename)
|
13
|
+
|
14
|
+
lib = File.dirname(__FILE__)
|
15
|
+
File.read File.join(lib,'..','stylesheet',filename)
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
10
20
|
class Omah
|
11
21
|
|
12
|
-
|
22
|
+
include Library
|
23
|
+
|
24
|
+
def initialize(options={xslt: 'listing.xsl'})
|
13
25
|
|
14
26
|
opt = {user: 'user'}.merge options
|
15
27
|
@user = opt[:user]
|
28
|
+
@xslt = opt[:xslt]
|
29
|
+
|
16
30
|
FileUtils.mkdir_p @user # attempt to mkdir regardless if it already exists
|
17
31
|
Dir.chdir @user
|
18
32
|
|
@@ -51,7 +65,12 @@ class Omah
|
|
51
65
|
|
52
66
|
FileUtils.mkdir_p path
|
53
67
|
|
54
|
-
|
68
|
+
if msg[:body_text].to_s.strip[0] == '<' then
|
69
|
+
txt_filepath = ''
|
70
|
+
else
|
71
|
+
File.write txt_filepath, text_sanitiser(msg[:body_text].to_s)
|
72
|
+
end
|
73
|
+
|
55
74
|
File.write html_filepath, html_sanitiser(msg[:body_html].to_s)
|
56
75
|
|
57
76
|
parts_path = []
|
@@ -96,9 +115,21 @@ class Omah
|
|
96
115
|
@dd.create msg.merge(txt_filepath: txt_filepath, \
|
97
116
|
html_filepath: html_filepath, attachment1: parts_path[0], \
|
98
117
|
attachment2: parts_path[1], attachment3: parts_path[2])
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
end
|
122
|
+
|
123
|
+
if @xslt then
|
99
124
|
|
125
|
+
unless File.exists? @xslt then
|
126
|
+
File.write File.expand_path(@xslt), fetch_file(@xslt)
|
127
|
+
end
|
100
128
|
|
129
|
+
@dd.xslt = @xslt
|
130
|
+
|
101
131
|
end
|
132
|
+
|
102
133
|
|
103
134
|
@dd.save
|
104
135
|
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
<?xml version='1.0' encoding='UTF-8'?>
|
2
|
+
<xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version='1.0'>
|
3
|
+
<xsl:output method='html' indent='yes' omit-xml-declaration='yes'/>
|
4
|
+
<xsl:template match='messages'>
|
5
|
+
<html>
|
6
|
+
<head>
|
7
|
+
<xsl:apply-templates select='summary'/>
|
8
|
+
</head>
|
9
|
+
<body>
|
10
|
+
<table border='1'>
|
11
|
+
<xsl:apply-templates select='records/message'>
|
12
|
+
<xsl:sort order='descending'/>
|
13
|
+
</xsl:apply-templates>
|
14
|
+
</table>
|
15
|
+
</body>
|
16
|
+
</html>
|
17
|
+
</xsl:template>
|
18
|
+
<xsl:template match='messages/summary'>
|
19
|
+
<title>
|
20
|
+
<xsl:value-of select='date'/>
|
21
|
+
</title>
|
22
|
+
</xsl:template>
|
23
|
+
<xsl:template match='records/message'>
|
24
|
+
<tr>
|
25
|
+
<td>
|
26
|
+
<xsl:value-of select='tags'/>
|
27
|
+
</td>
|
28
|
+
<td>
|
29
|
+
<xsl:value-of select='from'/>
|
30
|
+
</td>
|
31
|
+
<td>
|
32
|
+
<xsl:value-of select='to'/>
|
33
|
+
</td>
|
34
|
+
<td>
|
35
|
+
<xsl:value-of select='subject'/>
|
36
|
+
</td>
|
37
|
+
<td>
|
38
|
+
<xsl:value-of select='date'/>
|
39
|
+
</td>
|
40
|
+
<td>
|
41
|
+
<xsl:if test="txt_filepath != ''">
|
42
|
+
<a href="{txt_filepath}">txt</a>
|
43
|
+
</xsl:if>
|
44
|
+
</td>
|
45
|
+
<td>
|
46
|
+
<a href="{html_filepath}">html</a>
|
47
|
+
</td>
|
48
|
+
<td>
|
49
|
+
<a href="{attachment1}"><xsl:value-of select='attachment1'/></a>
|
50
|
+
</td>
|
51
|
+
<td>
|
52
|
+
<xsl:value-of select='attachment2'/>
|
53
|
+
</td>
|
54
|
+
<td>
|
55
|
+
<xsl:value-of select='attachment3'/>
|
56
|
+
</td>
|
57
|
+
</tr>
|
58
|
+
</xsl:template>
|
59
|
+
</xsl:stylesheet>
|
data.tar.gz.sig
CHANGED
Binary file
|
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.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -100,6 +100,7 @@ extensions: []
|
|
100
100
|
extra_rdoc_files: []
|
101
101
|
files:
|
102
102
|
- lib/omah.rb
|
103
|
+
- stylesheet/listing.xsl
|
103
104
|
homepage: https://github.com/jrobertson/omah
|
104
105
|
licenses:
|
105
106
|
- MIT
|
metadata.gz.sig
CHANGED
Binary file
|