rsscache 0.2.0 → 0.2.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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/rsscache.rb +42 -5
- data.tar.gz.sig +0 -0
- metadata +23 -24
- 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: 93d9d21a9a587043e1db22b3f64164308c755eee
|
4
|
+
data.tar.gz: 5e81b40fe30dc757fd46797d03bf670ba553206d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cfd87ca7214dde36963ee7a2bede8a41e1bf164a67159c688f93a34e83e80138a53f1d3a2eead31e1436bd9f4e12935333960e23a666982d1619743f077c8874
|
7
|
+
data.tar.gz: 7ac379f1d015f2a068616d4a0abd576124937c40cdf4e071bf7439580884ad384bcb428f72743f2e03f3eec6849291720865d439a80bccd90b836fa75e1a9f84
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/rsscache.rb
CHANGED
@@ -13,22 +13,54 @@ class RSScache
|
|
13
13
|
|
14
14
|
attr_reader :err_report
|
15
15
|
|
16
|
-
def initialize(rsslist, feedsfilepath=
|
16
|
+
def initialize(rsslist, feedsfilepath='.', debug: true)
|
17
17
|
|
18
18
|
@dx = open_dynarex(rsslist)
|
19
19
|
@rsslist, @feedsfilepath = rsslist, feedsfilepath
|
20
20
|
FileUtils.mkdir_p feedsfilepath
|
21
21
|
|
22
22
|
@err_report = []
|
23
|
+
@debug = debug
|
23
24
|
|
24
25
|
end
|
26
|
+
|
27
|
+
# Import a list of URLs into the Dynarex document.
|
28
|
+
# URLs which already exist are ignored.
|
29
|
+
#
|
30
|
+
def import(raw_s)
|
31
|
+
|
32
|
+
s, _ = RXFHelper.read(raw_s)
|
33
|
+
|
34
|
+
s.strip.lines.each do |raw_url|
|
35
|
+
|
36
|
+
url = raw_url.chomp
|
37
|
+
puts 'url : ' + url.inspect if @debug
|
38
|
+
r = @dx.find_by_url url.chomp
|
25
39
|
|
40
|
+
if r then
|
41
|
+
puts 'exists' if @debug
|
42
|
+
else
|
43
|
+
puts 'new URL found' if @debug
|
44
|
+
@dx.create url: url
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
48
|
+
|
49
|
+
save_dynarex()
|
50
|
+
end
|
51
|
+
|
52
|
+
# refresh each RSS feed
|
53
|
+
#
|
26
54
|
def refresh
|
27
55
|
|
28
56
|
@err_report = []
|
29
57
|
|
58
|
+
puts '@dx.to_xml' + @dx.to_xml(pretty: true) if @debug
|
59
|
+
|
30
60
|
@dx.all.each do |feed|
|
31
|
-
|
61
|
+
|
62
|
+
puts 'feed:' + feed.inspect if @debug
|
63
|
+
|
32
64
|
if feed.next_refresh.empty? or \
|
33
65
|
Time.now >= Time.parse(feed.next_refresh) then
|
34
66
|
|
@@ -57,7 +89,7 @@ class RSScache
|
|
57
89
|
|
58
90
|
end
|
59
91
|
end
|
60
|
-
|
92
|
+
puts '@dx: ' + @dx.to_xml(pretty: true) if @debug
|
61
93
|
save_dynarex()
|
62
94
|
|
63
95
|
end
|
@@ -67,7 +99,7 @@ class RSScache
|
|
67
99
|
def open_dynarex(x)
|
68
100
|
|
69
101
|
if x.lines.length == 1 and File.exists?(x) and \
|
70
|
-
File.extname(x) == '.txt'then
|
102
|
+
File.extname(x) == '.txt' then
|
71
103
|
Dynarex.new.import x
|
72
104
|
else
|
73
105
|
Dynarex.new x
|
@@ -96,6 +128,11 @@ class RSScache
|
|
96
128
|
#
|
97
129
|
def updates?(feed)
|
98
130
|
|
131
|
+
if @debug then
|
132
|
+
puts 'inside updates?'
|
133
|
+
puts 'feed: ' + feed.inspect
|
134
|
+
end
|
135
|
+
|
99
136
|
# fetch the feeds from the web
|
100
137
|
buffer, code = fetch(feed.url)
|
101
138
|
|
@@ -152,4 +189,4 @@ class RSScache
|
|
152
189
|
|
153
190
|
end
|
154
191
|
|
155
|
-
end
|
192
|
+
end
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rsscache
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -10,28 +10,27 @@ 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
|
-
|
32
|
-
6QO+pqPpZdfWfw==
|
13
|
+
MIIDXjCCAkagAwIBAgIBATANBgkqhkiG9w0BAQUFADAsMSowKAYDVQQDDCFnZW1t
|
14
|
+
YXN0ZXIvREM9amFtZXNyb2JlcnRzb24vREM9ZXUwHhcNMTgwMjA0MTUwMTQ0WhcN
|
15
|
+
MTkwMjA0MTUwMTQ0WjAsMSowKAYDVQQDDCFnZW1tYXN0ZXIvREM9amFtZXNyb2Jl
|
16
|
+
cnRzb24vREM9ZXUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCc92mR
|
17
|
+
T6m1I0JF3lENRDv6liYXqJiStrmml5LWAEzI1kDXEXIeNziO9Jlo74rHwtrZxeJ0
|
18
|
+
vuPBwXwDsoLEz1uz94hq1cfgRXXrj6K9A5YA8fQAvsFyKqxaS3Dtg5heQbgv5DUl
|
19
|
+
p2dzrc057LaES5E5bdBmH2DVHoaHGyya17u4T2sz42gKkv3CURgRopj05JF3a0AZ
|
20
|
+
WFE/N1xbD7ioffsKuPbGds6eL1eYk0qajutC0KIaRUqiTgzaTmntS1mDdz7nJMRM
|
21
|
+
7bVGP3cI1XfAGj/IqqfnapgYsVurPw9pzYGgBgH3XT/lKZW+xWfxpzkZH/ydpaF9
|
22
|
+
XU61J04M6xm9pPMFAgMBAAGjgYowgYcwCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAw
|
23
|
+
HQYDVR0OBBYEFCTDqdNBDLPNgRVZx02eHi9sOV7vMCYGA1UdEQQfMB2BG2dlbW1h
|
24
|
+
c3RlckBqYW1lc3JvYmVydHNvbi5ldTAmBgNVHRIEHzAdgRtnZW1tYXN0ZXJAamFt
|
25
|
+
ZXNyb2JlcnRzb24uZXUwDQYJKoZIhvcNAQEFBQADggEBABRCQKjdYT2lYH/XVGjB
|
26
|
+
XabbdBuro3lsCqzm95wtF2qTyw60gNpXuP+FBbQbnf4YMrYe4N8+lDXdY6xs8KMP
|
27
|
+
F8CoEBQSS0FqX1p4PT+5IDFEq/5Mmu46P9ZTS3bC5jlClr+IyclMdWl8yElWfer8
|
28
|
+
1KXDv1bwr1yjhc0vgAmnnUzk+V9fgDHQf58sTPlDa1k0T396x+BJ3i0xnLTOi2iU
|
29
|
+
0sAYj5+mVEGRx284sLHwgieDyxrLQMdPhDBnx5pPgJaQCw8xMS1S8DSX4gQAj+PK
|
30
|
+
5tiFhikiYyE9RjMYlZVwdfKc9yEGPhxY2J3V8RufP3HE6GHrV2lk5d9yFVcEqq+q
|
31
|
+
T1k=
|
33
32
|
-----END CERTIFICATE-----
|
34
|
-
date:
|
33
|
+
date: 2018-02-04 00:00:00.000000000 Z
|
35
34
|
dependencies:
|
36
35
|
- !ruby/object:Gem::Dependency
|
37
36
|
name: dynarex
|
@@ -74,7 +73,7 @@ dependencies:
|
|
74
73
|
- !ruby/object:Gem::Version
|
75
74
|
version: 1.3.1
|
76
75
|
description:
|
77
|
-
email: james@
|
76
|
+
email: james@jamesrobertson.eu
|
78
77
|
executables: []
|
79
78
|
extensions: []
|
80
79
|
extra_rdoc_files: []
|
@@ -100,7 +99,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
100
99
|
version: '0'
|
101
100
|
requirements: []
|
102
101
|
rubyforge_project:
|
103
|
-
rubygems_version: 2.
|
102
|
+
rubygems_version: 2.6.13
|
104
103
|
signing_key:
|
105
104
|
specification_version: 4
|
106
105
|
summary: This gem helps reduce unnessecary requests to webservers by caching RSS feeds
|
metadata.gz.sig
CHANGED
Binary file
|