rss_creator 0.6.0 → 0.6.2
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 +3 -2
- data/lib/rss_creator.rb +60 -48
- data.tar.gz.sig +0 -0
- metadata +30 -29
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d890a1bcc638ec87c774f46359b683f5c7ca08ce0375bae028988116f852c2fb
|
|
4
|
+
data.tar.gz: 2b031457ab6c1df794fad2dcf09043828262fc6d1855a3d1eb7501056ad55e6b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ad334d57682511fe7b6e2fa358dcb5335fbc8c947a0b750838db3be45bd4ede7fb05d733bdc006df341f49752bff67df9aabfdeada8fd312bee816b933bc9ad9
|
|
7
|
+
data.tar.gz: dc9751cd4badb902e31f4c67edfe68a9e85c27ee53b3819dcc3b4d9def54dfecc4264fb9d974a31d160d9f4a044850956220653834339629fea57c58c22834b7
|
checksums.yaml.gz.sig
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
��A:�6T����Lؾ��\ܚn
|
|
2
|
+
Yl2>�o����"�DE�Q����`LbvY��ś�K!��#��^�b� �2��[7���E`��ԩG+��n
|
|
3
|
+
�
|
data/lib/rss_creator.rb
CHANGED
|
@@ -9,51 +9,58 @@ require 'rss_to_dynarex'
|
|
|
9
9
|
class RSScreator
|
|
10
10
|
include RXFReadWriteModule
|
|
11
11
|
|
|
12
|
-
attr_accessor :title, :description, :link, :limit, :xslt, :image_url,
|
|
12
|
+
attr_accessor :title, :description, :link, :limit, :xslt, :image_url,
|
|
13
13
|
:image_target_url
|
|
14
14
|
|
|
15
|
-
def initialize(filepath='rss.xml', dx_xslt: nil, dx_filename:
|
|
16
|
-
custom_fields: [], limit: 10, log: nil,
|
|
15
|
+
def initialize(filepath='rss.xml', dx_xslt: nil, dx_filename: nil,
|
|
16
|
+
custom_fields: [], limit: 10, log: nil, title: 'Untitled',
|
|
17
|
+
description: 'Description goes here', debug: false)
|
|
17
18
|
|
|
18
19
|
|
|
19
20
|
@filepath, @log, @debug = filepath, log, debug
|
|
20
21
|
|
|
21
|
-
|
|
22
|
+
if dx_filename then
|
|
23
|
+
|
|
24
|
+
dxfilepath = File.join(File.dirname(filepath), dx_filename)
|
|
25
|
+
|
|
26
|
+
if filepath and FileX.exists? dxfilepath then
|
|
22
27
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
+
@dx = Dynarex.new dxfilepath, debug: debug
|
|
29
|
+
@title, @description, @link = @dx.title, @dx.description, @dx.link
|
|
30
|
+
@image_url = @dx.image
|
|
31
|
+
|
|
32
|
+
end
|
|
28
33
|
|
|
29
34
|
else
|
|
35
|
+
|
|
30
36
|
if filepath and FileX.exists? filepath
|
|
31
|
-
|
|
37
|
+
|
|
32
38
|
rtd = RSStoDynarex.new filepath
|
|
33
39
|
@dx = rtd.to_dynarex
|
|
34
40
|
|
|
35
41
|
@title, @description, @link = @dx.title, @dx.description, @dx.link
|
|
36
42
|
@image_url = @dx.image if @dx.image and @dx.image.length > 1
|
|
37
43
|
@image_target_url = @link if @link and @link.length > 1
|
|
38
|
-
|
|
44
|
+
|
|
39
45
|
else
|
|
40
46
|
|
|
41
|
-
|
|
47
|
+
|
|
42
48
|
schema = 'channel[title, description, link, image]/' + \
|
|
43
49
|
'item(title, link, description, date'
|
|
44
50
|
schema += ', ' + custom_fields.join(', ') if custom_fields.any?
|
|
45
51
|
schema += ')'
|
|
46
|
-
|
|
52
|
+
@title, @description = title, description
|
|
53
|
+
|
|
47
54
|
@dx = Dynarex.new schema
|
|
48
55
|
end
|
|
49
56
|
|
|
50
|
-
@dx.order = 'descending'
|
|
57
|
+
@dx.order = 'descending'
|
|
51
58
|
@dx.default_key = 'uid'
|
|
52
|
-
@dx.xslt = dx_xslt if dx_xslt
|
|
53
|
-
|
|
59
|
+
@dx.xslt = dx_xslt if dx_xslt
|
|
54
60
|
|
|
61
|
+
|
|
55
62
|
end
|
|
56
|
-
|
|
63
|
+
|
|
57
64
|
@dx.xslt_schema = 'channel[title:title,description:description,' + \
|
|
58
65
|
'link:link]/item(title:title,description:description,' + \
|
|
59
66
|
'link:link,pubDate:date)'
|
|
@@ -71,28 +78,35 @@ class RSScreator
|
|
|
71
78
|
@log.debug 'RssCreator#add item: ' + item.inspect if @log
|
|
72
79
|
|
|
73
80
|
unless item[:title] and item[:link] then
|
|
74
|
-
raise 'RSScreator: title or link can\'t be blank'
|
|
81
|
+
raise 'RSScreator: title or link can\'t be blank'
|
|
75
82
|
end
|
|
76
|
-
|
|
83
|
+
|
|
77
84
|
record = {date: Time.now.strftime("%a, %d %b %Y %H:%M:%S %z")}.merge(item)
|
|
78
85
|
@dx.create(record, id: id)
|
|
79
|
-
|
|
86
|
+
@log&.debug 'RssCreator#add item; after @dx.create'
|
|
87
|
+
|
|
80
88
|
@dirty = true
|
|
81
|
-
|
|
89
|
+
|
|
82
90
|
end
|
|
83
91
|
|
|
84
92
|
def save(new_filepath=nil)
|
|
85
93
|
|
|
86
94
|
filepath = new_filepath ? new_filepath : @filepath
|
|
95
|
+
puts 'save() before FileX.write' if @debug
|
|
96
|
+
puts 'filepath: ' + filepath.inspect if @debug
|
|
97
|
+
puts 'print_rss: ' + print_rss.inspect if @debug
|
|
87
98
|
FileX.write filepath, print_rss
|
|
99
|
+
|
|
100
|
+
puts 'save() after FileX.write' if @debug
|
|
101
|
+
|
|
88
102
|
@dx.save File.join(File.dirname(filepath), @dxfilename) if @dxfilename
|
|
89
103
|
end
|
|
90
|
-
|
|
104
|
+
|
|
91
105
|
def description=(val)
|
|
92
106
|
@description = val
|
|
93
107
|
@dirty = true
|
|
94
108
|
end
|
|
95
|
-
|
|
109
|
+
|
|
96
110
|
def delete(id)
|
|
97
111
|
@dx.delete id.to_s
|
|
98
112
|
end
|
|
@@ -103,24 +117,24 @@ class RSScreator
|
|
|
103
117
|
def dynarex()
|
|
104
118
|
@dx
|
|
105
119
|
end
|
|
106
|
-
|
|
120
|
+
|
|
107
121
|
def image_url=(val)
|
|
108
122
|
@image_url = val
|
|
109
123
|
@dirty = true
|
|
110
124
|
end
|
|
111
|
-
|
|
125
|
+
|
|
112
126
|
alias image= image_url=
|
|
113
|
-
|
|
127
|
+
|
|
114
128
|
def image_target_url=(val)
|
|
115
129
|
@image_target_url = val
|
|
116
130
|
@dirty = true
|
|
117
|
-
end
|
|
131
|
+
end
|
|
118
132
|
|
|
119
133
|
def link=(val)
|
|
120
134
|
@link = val
|
|
121
135
|
@dirty = true
|
|
122
|
-
end
|
|
123
|
-
|
|
136
|
+
end
|
|
137
|
+
|
|
124
138
|
def title=(val)
|
|
125
139
|
@title = val
|
|
126
140
|
@dirty = true
|
|
@@ -133,43 +147,41 @@ class RSScreator
|
|
|
133
147
|
private
|
|
134
148
|
|
|
135
149
|
def print_rss()
|
|
136
|
-
|
|
150
|
+
|
|
137
151
|
return @rss unless @dirty
|
|
138
152
|
|
|
139
|
-
if @title.nil? or @description.nil? then
|
|
140
|
-
raise 'RSScreator: title or description can\'t be blank'
|
|
141
|
-
end
|
|
142
|
-
|
|
143
153
|
@dx.title, @dx.description, @dx.link = @title, @description, @link || ''
|
|
144
154
|
@dx.image = @image_url if @dx.respond_to? :image
|
|
145
|
-
|
|
155
|
+
|
|
146
156
|
@rss = if @xslt then
|
|
147
|
-
|
|
157
|
+
|
|
148
158
|
@dx.to_rss({limit: @limit}) do |doc|
|
|
149
|
-
|
|
159
|
+
|
|
150
160
|
doc.instructions << ['xml-stylesheet',\
|
|
151
161
|
"title='XSL_formatting' type='text/xsl' href='#{@xslt}'"]
|
|
152
|
-
|
|
153
|
-
end
|
|
154
|
-
|
|
162
|
+
|
|
163
|
+
end
|
|
164
|
+
|
|
155
165
|
else
|
|
156
166
|
|
|
157
|
-
@dx.to_rss
|
|
167
|
+
puts 'before @dx.to_rss' if @debug
|
|
158
168
|
|
|
169
|
+
@dx.to_rss({limit: @limit}) do |doc|
|
|
170
|
+
|
|
159
171
|
if @image_url then
|
|
160
|
-
|
|
172
|
+
|
|
161
173
|
img = Rexle::Element.new('image')
|
|
162
174
|
img.add Rexle::Element.new('url').add_text @image_url
|
|
163
175
|
img.add Rexle::Element.new('link').add_text @image_target_url
|
|
164
|
-
|
|
176
|
+
|
|
165
177
|
doc.root.element('channel/item').insert_before img
|
|
166
|
-
|
|
167
|
-
end
|
|
168
|
-
|
|
178
|
+
|
|
179
|
+
end
|
|
180
|
+
|
|
169
181
|
end
|
|
170
|
-
|
|
182
|
+
|
|
171
183
|
end
|
|
172
|
-
|
|
184
|
+
|
|
173
185
|
@dirty = false
|
|
174
186
|
@rss
|
|
175
187
|
|
data.tar.gz.sig
CHANGED
|
Binary file
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rss_creator
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.6.
|
|
4
|
+
version: 0.6.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- James Robertson
|
|
@@ -10,32 +10,33 @@ bindir: bin
|
|
|
10
10
|
cert_chain:
|
|
11
11
|
- |
|
|
12
12
|
-----BEGIN CERTIFICATE-----
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
+
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
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QCMAAwCwYDVR0PBAQDAgSwMB0GA1UdDgQW
|
|
27
|
+
BBQLyuatj8mf62DXpY5PkwlgvBRXsTAmBgNVHREEHzAdgRtnZW1tYXN0ZXJAamFt
|
|
28
|
+
ZXNyb2JlcnRzb24uZXUwJgYDVR0SBB8wHYEbZ2VtbWFzdGVyQGphbWVzcm9iZXJ0
|
|
29
|
+
c29uLmV1MA0GCSqGSIb3DQEBCwUAA4IBgQCUdxLq/mWu5T9k6vko7AqfClaINL6h
|
|
30
|
+
JTQ9tr9Yz7qjlyCDwr98JzlGowpSJ+nBHq0YJc4vrFVPfHCeSPVscmehnO9OUdqT
|
|
31
|
+
m2po4qj37bBvJUGOYrmQuIWfFRGZeNletKYaKIglVFKg6U3w+JRpvQyorklS49Rf
|
|
32
|
+
cTXM6eEwAb9ohZ1Mg+Z6gM+ZvgB7GKYUhGITcec7JBpgabPMa92oCk7AbYaco+Gm
|
|
33
|
+
W0MzPUrw76BsCiyrwNMWwvCyuzruC8wQB5jfUp1rlVInizESnvWHjsJcdJw0XqgK
|
|
34
|
+
C4c3H208VnkvfxsMIf5a7y9rj1SO3KZSExoW+sPefm1hFioN3Sa6MLyCFrxXO8Rt
|
|
35
|
+
UjpVoogNCe056wHoaox6Qx2MQg8TDqFqWIiJXLAGtNGP+3vV4VHPY4efYvnfLmN0
|
|
36
|
+
cvt0iXma+gx/Ov53QNTxxB3QbNEEFdeEjg0+lO4JPFlhgtITILe804ZJCWi+hgxp
|
|
37
|
+
gIx/INLAIB0o7xvs4rvitJ+wC8T5u20Ubss=
|
|
37
38
|
-----END CERTIFICATE-----
|
|
38
|
-
date:
|
|
39
|
+
date: 2023-03-03 00:00:00.000000000 Z
|
|
39
40
|
dependencies:
|
|
40
41
|
- !ruby/object:Gem::Dependency
|
|
41
42
|
name: rss_to_dynarex
|
|
@@ -46,7 +47,7 @@ dependencies:
|
|
|
46
47
|
version: '0.2'
|
|
47
48
|
- - ">="
|
|
48
49
|
- !ruby/object:Gem::Version
|
|
49
|
-
version: 0.2.
|
|
50
|
+
version: 0.2.1
|
|
50
51
|
type: :runtime
|
|
51
52
|
prerelease: false
|
|
52
53
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -56,7 +57,7 @@ dependencies:
|
|
|
56
57
|
version: '0.2'
|
|
57
58
|
- - ">="
|
|
58
59
|
- !ruby/object:Gem::Version
|
|
59
|
-
version: 0.2.
|
|
60
|
+
version: 0.2.1
|
|
60
61
|
- !ruby/object:Gem::Dependency
|
|
61
62
|
name: rss_sliml
|
|
62
63
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -103,7 +104,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
103
104
|
- !ruby/object:Gem::Version
|
|
104
105
|
version: '0'
|
|
105
106
|
requirements: []
|
|
106
|
-
rubygems_version: 3.
|
|
107
|
+
rubygems_version: 3.4.4
|
|
107
108
|
signing_key:
|
|
108
109
|
specification_version: 4
|
|
109
110
|
summary: A gem for creating RSS feeds
|
metadata.gz.sig
CHANGED
|
Binary file
|