daily_notices 0.5.5 → 0.5.6
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/daily_notices.rb +17 -12
- metadata +4 -4
- 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: 216b2dc12eb8293d9abde4777d3422cb1d474fbd
|
|
4
|
+
data.tar.gz: b7bc30867f6006a69101c16d93487c62c9de1734
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: df849ffe4a3ae1ae8e414ea2d1269b1305307f21b9930fe55fa8b2b48f12734e9d3dbcc4a347ebe7b7d79caab96dca597d2b6fd1c8d30e9e83ad2eb4c1b7a50b
|
|
7
|
+
data.tar.gz: daaa65dac2e1fc0db9c5496b63cd043d6eff613485f382660ea4a5fd4009bad4e23c469924f8efaf977d0004fe825b2a8dd402409d099cdfd5deeea20ff71fb5
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
data.tar.gz.sig
CHANGED
|
Binary file
|
data/lib/daily_notices.rb
CHANGED
|
@@ -14,8 +14,9 @@ class DailyNotices
|
|
|
14
14
|
|
|
15
15
|
attr_accessor :title, :description, :link, :dx_xslt, :rss_xslt
|
|
16
16
|
|
|
17
|
-
def initialize(filepath='', url_base: 'http:/127.0.0.1/', identifier: '',
|
|
18
|
-
|
|
17
|
+
def initialize(filepath='', url_base: 'http:/127.0.0.1/', identifier: '',
|
|
18
|
+
dx_xslt: '', rss_xslt: '', target_page: :recordset,
|
|
19
|
+
target_xslt: '', title: 'daily notices')
|
|
19
20
|
|
|
20
21
|
@filepath, @url_base, @dx_xslt, @rss_xslt, @target_page, @target_xslt, \
|
|
21
22
|
@identifier = filepath, url_base, dx_xslt, rss_xslt, target_page, \
|
|
@@ -44,7 +45,7 @@ class DailyNotices
|
|
|
44
45
|
dir = url_base[/http:\/\/[^\/]+\/(.*)/,1]
|
|
45
46
|
|
|
46
47
|
rssxsltfilename = "rssx#{Time.now.to_i.to_s}.xsl"
|
|
47
|
-
rssxsltfilepath = '/' + [dir, subdir, rssxsltfilename].join('/')
|
|
48
|
+
rssxsltfilepath = '/' + [dir, subdir, rssxsltfilename].join('/')
|
|
48
49
|
File.write File.join(filepath, rssxsltfilename), \
|
|
49
50
|
RssSliml.new().to_xslt
|
|
50
51
|
|
|
@@ -52,7 +53,7 @@ class DailyNotices
|
|
|
52
53
|
end
|
|
53
54
|
|
|
54
55
|
@day = Time.now.day
|
|
55
|
-
@title =
|
|
56
|
+
@title = title
|
|
56
57
|
new_day()
|
|
57
58
|
|
|
58
59
|
# open the Dynarex file or create a new Dynarex file
|
|
@@ -60,10 +61,12 @@ class DailyNotices
|
|
|
60
61
|
@rssfile = File.join(@filepath, 'rss.xml')
|
|
61
62
|
|
|
62
63
|
if File.exists? @rssfile then
|
|
63
|
-
@rss = RSScreator.new @rssfile, dx_xslt: @rss_xslt
|
|
64
|
+
@rss = RSScreator.new @rssfile, dx_xslt: @rss_xslt,
|
|
65
|
+
custom_fields: ['topic']
|
|
64
66
|
else
|
|
65
67
|
|
|
66
|
-
@rss = RSScreator.new @rssfile, dx_xslt: @rss_xslt
|
|
68
|
+
@rss = RSScreator.new @rssfile, dx_xslt: @rss_xslt,
|
|
69
|
+
custom_fields: ['topic']
|
|
67
70
|
@rss.xslt = @rss_xslt
|
|
68
71
|
@rss.title = @title || identifier.capitalize + ' daily notices'
|
|
69
72
|
@rss.description = 'Generated using the daily_notices gem'
|
|
@@ -74,18 +77,20 @@ class DailyNotices
|
|
|
74
77
|
@target_page = target_page
|
|
75
78
|
end
|
|
76
79
|
|
|
77
|
-
def create(
|
|
78
|
-
title: nil, id: Time.now.to_i.to_s)
|
|
80
|
+
def create(h={time: Time.now.strftime('%H:%M %p - %d %b %Y'), title: nil}, id: Time.now.to_i.to_s)
|
|
79
81
|
|
|
82
|
+
|
|
80
83
|
new_day() if @day != Time.now.day
|
|
81
84
|
|
|
82
|
-
if @dx.all.any? and
|
|
85
|
+
if @dx.all.any? and
|
|
86
|
+
@dx.all.first.description == CGI.unescape(h[:description]) then
|
|
83
87
|
|
|
84
88
|
return :duplicate
|
|
85
89
|
|
|
86
90
|
end
|
|
87
91
|
|
|
88
|
-
|
|
92
|
+
#@dx.create({description: description, time: time}, id: id)
|
|
93
|
+
@dx.create(h, id: id)
|
|
89
94
|
@dx.save @indexpath
|
|
90
95
|
|
|
91
96
|
if @target_page == :recordset then
|
|
@@ -116,10 +121,10 @@ class DailyNotices
|
|
|
116
121
|
end
|
|
117
122
|
|
|
118
123
|
# Add it to the RSS document
|
|
119
|
-
title ||= description.split(/\n/,2).first[0..140]
|
|
124
|
+
title ||= h[:description].split(/\n/,2).first[0..140]
|
|
120
125
|
link = create_link(id)
|
|
121
126
|
|
|
122
|
-
@rss.add( {title: title, link: link
|
|
127
|
+
@rss.add( {title: title, link: link}.merge(h), id: id)
|
|
123
128
|
@rss.save @rssfile
|
|
124
129
|
|
|
125
130
|
on_add(@indexpath, id)
|
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.5.
|
|
4
|
+
version: 0.5.6
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- James Robertson
|
|
@@ -31,7 +31,7 @@ cert_chain:
|
|
|
31
31
|
8he6uWzjGUd5dEdL/ASnQ9lBbvl0TStzNEnsGNBV94H/6fnjx7MHQ/CWQE/M877s
|
|
32
32
|
zcuMgGZau1C2mg==
|
|
33
33
|
-----END CERTIFICATE-----
|
|
34
|
-
date:
|
|
34
|
+
date: 2017-03-10 00:00:00.000000000 Z
|
|
35
35
|
dependencies:
|
|
36
36
|
- !ruby/object:Gem::Dependency
|
|
37
37
|
name: rss_creator
|
|
@@ -114,7 +114,7 @@ dependencies:
|
|
|
114
114
|
- !ruby/object:Gem::Version
|
|
115
115
|
version: 0.1.0
|
|
116
116
|
description:
|
|
117
|
-
email: james@
|
|
117
|
+
email: james@jamesrobertson.eu
|
|
118
118
|
executables: []
|
|
119
119
|
extensions: []
|
|
120
120
|
extra_rdoc_files: []
|
|
@@ -140,7 +140,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
140
140
|
version: '0'
|
|
141
141
|
requirements: []
|
|
142
142
|
rubyforge_project:
|
|
143
|
-
rubygems_version: 2.
|
|
143
|
+
rubygems_version: 2.6.8
|
|
144
144
|
signing_key:
|
|
145
145
|
specification_version: 4
|
|
146
146
|
summary: A public facing noticeboard which is centered around an RSS feed.
|
metadata.gz.sig
CHANGED
|
Binary file
|