omah 0.5.4 → 0.6.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7bf6262e1942d7f91ed6dd8aa3bd4b1b3abcdf7a
4
- data.tar.gz: b00f07cea7899984df15c2727add2013d7efbfa7
3
+ metadata.gz: afdf96b9edfb22cf13f44492cd81a25657710f18
4
+ data.tar.gz: 2488fb391bf83d80757a068df71b8159dd84f19f
5
5
  SHA512:
6
- metadata.gz: 07a25acc7110db1af0cf8001c98813bb68c621cc52f5b1ab8b10fb860c2d0cb9cb472b8ccb6a5350029271266e897d5072d8531c5efeb3fcac0a8d99e8c9550a
7
- data.tar.gz: ceb42cf1b29a8e79030bc297f109c55bcda7a88622a5824e5532e1c34ed3b64d5a99f529e75133a6c49c95578d15c7ffa5ca80ed2ac7dc3567969035341b4a75
6
+ metadata.gz: 9197e8ccb21e69da86e47f0024931e83b30ebcb5b18c7faf0ae4933096ff1cc0de6275b52a97337653cb08535f07969e53b92b837388274af50c98a857ad6d5c
7
+ data.tar.gz: 3a13e4f3740d838f90afab6d8dd3a4e6df8defb5fa6ff10780f6108bdbc28ca981a99aaf812fcc28fecb781ce158327f001bed7d6a3d52ab32b1ee0a15cc6018
checksums.yaml.gz.sig CHANGED
Binary file
data/lib/omah.rb CHANGED
@@ -22,14 +22,14 @@ class Omah
22
22
 
23
23
  include Library
24
24
 
25
- def initialize(options={xslt: 'listing.xsl'})
25
+ def initialize(user: 'user', filepath: '.', options: {xslt: 'listing.xsl'}, plugins: [] )
26
26
 
27
- opt = {user: 'user'}.merge options
28
- @user = opt[:user]
29
- @xslt = opt[:xslt]
27
+ @user = user
28
+ @xslt = options[:xslt]
29
+ @variables ||= {}
30
30
 
31
31
  FileUtils.mkdir_p @user # attempt to mkdir regardless if it already exists
32
- Dir.chdir @user
32
+ Dir.chdir File.join(filepath, @user)
33
33
 
34
34
  dailyfile = 'dynarexdaily.xml'
35
35
 
@@ -40,6 +40,20 @@ class Omah
40
40
  end
41
41
 
42
42
  @dd = DynarexDaily.new x, options: {dir_archive: :yearly}
43
+
44
+
45
+ # intialize plugins
46
+
47
+ @plugins = plugins.inject([]) do |r, plugin|
48
+
49
+ name, settings = plugin
50
+ return r if settings[:active] == false and !settings[:active]
51
+
52
+ klass_name = 'OmahPlugin' + name.to_s.split(/[-_]/).map{|x| x.capitalize}.join
53
+
54
+ r << Kernel.const_get(klass_name).new(settings: settings, variables: @variables)
55
+
56
+ end
43
57
 
44
58
  end
45
59
 
@@ -116,8 +130,7 @@ class Omah
116
130
  @dd.create msg.merge(txt_filepath: txt_filepath, \
117
131
  html_filepath: html_filepath, attachment1: parts_path[0], \
118
132
  attachment2: parts_path[1], attachment3: parts_path[2])
119
-
120
-
133
+
121
134
  end
122
135
 
123
136
  if @xslt then
@@ -141,7 +154,9 @@ class Omah
141
154
 
142
155
  end
143
156
 
144
- File.write 'dynarexdaily.xml', doc.xml(pretty: true)
157
+ @plugins.each{|x| x.on_newmail(messages, doc) }
158
+ File.write 'dynarexdaily.xml', doc.xml(pretty: true)
159
+
145
160
  end
146
161
 
147
162
  private
@@ -176,6 +191,7 @@ class Omah
176
191
  =end
177
192
  s
178
193
  end
194
+
179
195
 
180
196
  def text_sanitiser(s)
181
197
 
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.5.4
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
metadata.gz.sig CHANGED
Binary file