daily_notices 0.6.3 → 0.7.1

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
- SHA1:
3
- metadata.gz: 74cbff972f98cacf123eb9544164e3f07f1ca9f9
4
- data.tar.gz: 0710c12fbc0e7c45c46c2eda5735a59ef769fb6c
2
+ SHA256:
3
+ metadata.gz: 9d29cfb2e116756c7657e573834d48753642668d988d8f1445f2d557e05225e6
4
+ data.tar.gz: 105253e156c300d52f96f7f4a37714927e32b3c38ae19872102c738fab069f42
5
5
  SHA512:
6
- metadata.gz: 9f6da00f0f2682b1d4ce96d0e506ef3638bd3311080895b0f4e40b88d2c669eb95cc2eade4d331fdae5721ddf7e2ad4a0c9ec6621832fad1ffb2802b37c9bdde
7
- data.tar.gz: 1c21377e8adb07dd27a8e0e3b562b2d0de3bd3b0176f424f38cc55ccae00b9330874ca418a03573495072a786f3c95756b9c9f3ce48126252ad69d6a180dcad0
6
+ metadata.gz: b67265385e875a1e06298a942184287493117e490390e8e562769e7dcc9055b2362bf7a957e80e1763c75aa01aa89c00bdb20816ffd6913d940b6f5f227741de
7
+ data.tar.gz: a97e40f82b5b09ecca4d821e40f1d2e422007087548f4ea96c7a9874204aed7ff8488f75294cdd8fde477db67ea765f789354e7f959ba8611ece4818a0bf4a12
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
data/lib/daily_notices.rb CHANGED
@@ -9,21 +9,24 @@ require 'fileutils'
9
9
  require 'rss_creator'
10
10
 
11
11
 
12
-
13
12
  class DailyNotices
14
13
 
15
14
  attr_accessor :title, :description, :link, :dx_xslt, :rss_xslt
16
15
 
17
16
  def initialize(filepath='', url_base: 'http:/127.0.0.1/', identifier: '',
18
17
  dx_xslt: '', rss_xslt: '', target_page: :recordset,
19
- target_xslt: '', title: 'daily notices')
18
+ target_xslt: '', title: 'daily notices', log: nil,
19
+ debug: false)
20
20
 
21
21
  @filepath, @url_base, @dx_xslt, @rss_xslt, @target_page, @target_xslt, \
22
- @identifier = filepath, url_base, dx_xslt, rss_xslt, target_page, \
23
- target_xslt, identifier
22
+ @identifier, @log, @debug = filepath, url_base, dx_xslt, rss_xslt, \
23
+ target_page, target_xslt, identifier, log, debug
24
24
 
25
25
 
26
- @schema ||= 'items[title, identifier]/item(title, description, time, link)'
26
+ # note: card is intended for storing meta data in JSON format
27
+
28
+ @schema ||= 'items[title, identifier, image]/item(title, description, ' +
29
+ 'card, time, link)'
27
30
  @default_key ||= 'uid'
28
31
 
29
32
  if dx_xslt.nil? then
@@ -78,8 +81,9 @@ class DailyNotices
78
81
  end
79
82
 
80
83
  def create(id: Time.now.to_i.to_s,
81
- item: {time: Time.now.strftime('%H:%M %p - %d %b %Y'), title: nil})
84
+ item: {time: Time.now.strftime('%H:%M %p - %d %b %Y'), title: nil})
82
85
 
86
+ @log.info 'daily_notices/create: item: ' + item.inspect if @log
83
87
  h = item
84
88
 
85
89
  new_day() if @day != Time.now.day
@@ -94,13 +98,15 @@ class DailyNotices
94
98
  h[:link] ||= create_link(id)
95
99
  h[:title] ||= h[:description]
96
100
  .split(/\n/,2).first.gsub(/\<\/?\w+[^>]*>/,'')[0..140]
97
- h[:time] ||= Time.now.strftime('%H:%M %p - %d %b %Y')
101
+ h[:time] ||= Time.now.strftime('%H:%M %p · %b %d %Y')
98
102
 
99
103
  #@dx.create({description: description, time: time}, id: id)
104
+ puts 'before @dx.create' if @debug
100
105
  @dx.create(h, id: id)
106
+ puts 'after @dx.create' if @debug
101
107
  @dx.save @indexpath
102
108
 
103
- render_files(id)
109
+ render_html_files(id)
104
110
 
105
111
  # Add it to the RSS document
106
112
 
@@ -125,7 +131,6 @@ class DailyNotices
125
131
  indexpath = File.join(@filepath, archive_path, id.to_s)
126
132
 
127
133
  FileUtils.rm_rf indexpath
128
- render_html_files(id.to_s)
129
134
 
130
135
  id.to_s + ' deleted'
131
136
 
@@ -137,6 +142,12 @@ class DailyNotices
137
142
 
138
143
  def description=(val)
139
144
  @rss.description = val
145
+ end
146
+
147
+ def image=(val)
148
+ image_url, target_url = val.split
149
+ @rss.image_url = image_url
150
+ @rss.image_target_url = target_url
140
151
  end
141
152
 
142
153
  def title()
@@ -183,6 +194,8 @@ class DailyNotices
183
194
  #
184
195
  def new_day()
185
196
 
197
+ puts 'inside new_day' if @debug
198
+
186
199
  @archive_path = Time.now.strftime("%Y/%b/%-d").downcase
187
200
 
188
201
  @indexpath = File.join(@filepath, @archive_path, 'index.xml')
@@ -192,7 +205,9 @@ class DailyNotices
192
205
  if File.exists? @indexpath then
193
206
  @dx = Dynarex.new @indexpath
194
207
  else
195
- @dx = Dynarex.new @schema
208
+
209
+ puts 'creating a new dx file' if @debug
210
+ @dx = Dynarex.new @schema, debug: @debug
196
211
  @dx.order = 'descending'
197
212
  @dx.default_key = @default_key
198
213
  @dx.xslt = @dx_xslt
@@ -200,10 +215,12 @@ class DailyNotices
200
215
  @dx.identifier = @identifier
201
216
  end
202
217
 
203
- end
218
+ end
204
219
 
205
220
  def render_html_files(id)
206
221
 
222
+ puts 'inside render_html_files' if @debug
223
+
207
224
  if @target_page == :recordset then
208
225
  File.write File.join(@filepath, @archive_path, 'index.html'), \
209
226
  @dx.to_html(domain: @url_base)
@@ -214,10 +231,16 @@ class DailyNotices
214
231
 
215
232
  rx = @dx.find(id)
216
233
 
234
+ puts 'rx: ' + rx.inspect if @debug
217
235
  kvx = rx.to_kvx
236
+
218
237
  yield kvx if block_given?
219
-
238
+ puts 'before kvx.to_xml' if @debug
239
+ puts 'kvx.to_xml : ' + kvx.to_xml.inspect
240
+ puts 'before 2 kvx.to_xml' if @debug
220
241
  rxdoc = Rexle.new(kvx.to_xml)
242
+ puts 'after kvx.to_xml' if @debug
243
+
221
244
  rxdoc.instructions << ['xml-styelsheet',\
222
245
  "title='XSL_formatting' type='text/xsl' href='#{@target_xslt}'"]
223
246
  File.write target_path.sub(/\.html$/,'.xml', ), rxdoc.xml(pretty: true)
@@ -234,4 +257,4 @@ class DailyNotices
234
257
 
235
258
  end
236
259
 
237
- end
260
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: daily_notices
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.3
4
+ version: 0.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -10,28 +10,32 @@ bindir: bin
10
10
  cert_chain:
11
11
  - |
12
12
  -----BEGIN CERTIFICATE-----
13
- MIIDljCCAn6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBIMRIwEAYDVQQDDAlnZW1t
14
- YXN0ZXIxHjAcBgoJkiaJk/IsZAEZFg5qYW1lc3JvYmVydHNvbjESMBAGCgmSJomT
15
- 8ixkARkWAmV1MB4XDTE2MTExMjE4MjMwOFoXDTE3MTExMjE4MjMwOFowSDESMBAG
16
- A1UEAwwJZ2VtbWFzdGVyMR4wHAYKCZImiZPyLGQBGRYOamFtZXNyb2JlcnRzb24x
17
- EjAQBgoJkiaJk/IsZAEZFgJldTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
18
- ggEBAN/1BcxutxrU9edYSqrP6O3pPpH/G1u2vibUnPIYfaMj8p2wUlzNp7Z7rH5K
19
- Q1e2ILBaEwx48x+fgd1wXqCv5+dyiEaUC9THNUCGluRDs56rXXWdPd5tW0p53Q1F
20
- i8pFwGMVle+wZ18/XVYhhGoLlpuFkBk1PKBXOxk6MLDJFxb5a451xAtbwpRkF/Ze
21
- jQXl15pHDnCBCsUaMs+kkPE3qjn5GFPScVvOhIPPERpiRIeT3zvQENnrXuEP6eKj
22
- SOB1c3BrZuUD6W84K7q1W7bYw1ian7hrD6G9hDD6mD3OwDK0aAMXA7lsu2uFsgM5
23
- EVbGp+1uN07r/emN3ctFOUh5n4kCAwEAAaOBijCBhzAJBgNVHRMEAjAAMAsGA1Ud
24
- DwQEAwIEsDAdBgNVHQ4EFgQUNgnoUSu+we+fhkcQsAAZZM5fWXcwJgYDVR0RBB8w
25
- HYE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  -----END CERTIFICATE-----
34
- date: 2017-07-04 00:00:00.000000000 Z
38
+ date: 2021-03-19 00:00:00.000000000 Z
35
39
  dependencies:
36
40
  - !ruby/object:Gem::Dependency
37
41
  name: rss_creator
@@ -39,20 +43,20 @@ dependencies:
39
43
  requirements:
40
44
  - - "~>"
41
45
  - !ruby/object:Gem::Version
42
- version: '0.3'
46
+ version: '0.4'
43
47
  - - ">="
44
48
  - !ruby/object:Gem::Version
45
- version: 0.3.9
49
+ version: 0.4.2
46
50
  type: :runtime
47
51
  prerelease: false
48
52
  version_requirements: !ruby/object:Gem::Requirement
49
53
  requirements:
50
54
  - - "~>"
51
55
  - !ruby/object:Gem::Version
52
- version: '0.3'
56
+ version: '0.4'
53
57
  - - ">="
54
58
  - !ruby/object:Gem::Version
55
- version: 0.3.9
59
+ version: 0.4.2
56
60
  - !ruby/object:Gem::Dependency
57
61
  name: dx_sliml
58
62
  requirement: !ruby/object:Gem::Requirement
@@ -62,7 +66,7 @@ dependencies:
62
66
  version: '0.1'
63
67
  - - ">="
64
68
  - !ruby/object:Gem::Version
65
- version: 0.1.7
69
+ version: 0.1.8
66
70
  type: :runtime
67
71
  prerelease: false
68
72
  version_requirements: !ruby/object:Gem::Requirement
@@ -72,49 +76,49 @@ dependencies:
72
76
  version: '0.1'
73
77
  - - ">="
74
78
  - !ruby/object:Gem::Version
75
- version: 0.1.7
79
+ version: 0.1.8
76
80
  - !ruby/object:Gem::Dependency
77
81
  name: rx_sliml
78
82
  requirement: !ruby/object:Gem::Requirement
79
83
  requirements:
80
84
  - - "~>"
81
85
  - !ruby/object:Gem::Version
82
- version: '0.1'
86
+ version: '0.2'
83
87
  - - ">="
84
88
  - !ruby/object:Gem::Version
85
- version: 0.1.2
89
+ version: 0.2.1
86
90
  type: :runtime
87
91
  prerelease: false
88
92
  version_requirements: !ruby/object:Gem::Requirement
89
93
  requirements:
90
94
  - - "~>"
91
95
  - !ruby/object:Gem::Version
92
- version: '0.1'
96
+ version: '0.2'
93
97
  - - ">="
94
98
  - !ruby/object:Gem::Version
95
- version: 0.1.2
99
+ version: 0.2.1
96
100
  - !ruby/object:Gem::Dependency
97
101
  name: rss_sliml
98
102
  requirement: !ruby/object:Gem::Requirement
99
103
  requirements:
100
- - - "~>"
101
- - !ruby/object:Gem::Version
102
- version: '0.1'
103
104
  - - ">="
104
105
  - !ruby/object:Gem::Version
105
- version: 0.1.0
106
+ version: 0.2.0
107
+ - - "~>"
108
+ - !ruby/object:Gem::Version
109
+ version: '0.2'
106
110
  type: :runtime
107
111
  prerelease: false
108
112
  version_requirements: !ruby/object:Gem::Requirement
109
113
  requirements:
110
- - - "~>"
111
- - !ruby/object:Gem::Version
112
- version: '0.1'
113
114
  - - ">="
114
115
  - !ruby/object:Gem::Version
115
- version: 0.1.0
116
+ version: 0.2.0
117
+ - - "~>"
118
+ - !ruby/object:Gem::Version
119
+ version: '0.2'
116
120
  description:
117
- email: james@jamesrobertson.eu
121
+ email: digital.robertson@gmail.com
118
122
  executables: []
119
123
  extensions: []
120
124
  extra_rdoc_files: []
@@ -140,7 +144,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
140
144
  version: '0'
141
145
  requirements: []
142
146
  rubyforge_project:
143
- rubygems_version: 2.6.8
147
+ rubygems_version: 2.7.10
144
148
  signing_key:
145
149
  specification_version: 4
146
150
  summary: A public facing noticeboard which is centered around an RSS feed.
metadata.gz.sig CHANGED
Binary file