rss_timeline 0.2.2 → 0.3.0

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
2
  SHA256:
3
- metadata.gz: 75d51049a865b301089684387077084461e29500cf515c51596b20efd0095d46
4
- data.tar.gz: 9acc314a0929fbc6f0f28d58161d661bb694a8a13b64d617d76100a0c2958eb3
3
+ metadata.gz: e7d0917dcf6a4513e264221316f73df4adac9a0837f253e5ed74b04bbbfb8069
4
+ data.tar.gz: 05ab3115b5903debd742932fe16fd764194224cd2398992e542c0049a5614aad
5
5
  SHA512:
6
- metadata.gz: 6761af952c7a0ec6b0aedf116ac7d9ec9875b49180d03bafafe65b3f5a3ff08fa9c2163f98b956eab51e32f525ecc79de987c808636a0626cef47a9c85dfd19c
7
- data.tar.gz: ce41ce4e99fe7956af62bed1c3094217fff4f190374316117c4c0a08548afcdd64f327f491a661babfc7d8f17702e767a4fb408b37a1998fed2c41fe941ca75c
6
+ metadata.gz: bcc1eb504d8e6619ab4749230d9094f5e4610ed08e1da76ab2f2db8124c0885e7f36287585a08a6c42123be084cb489db97d82775834ebbd9dae54c3fc452a68
7
+ data.tar.gz: f36f5f339757d11a464b7632f9da9bb31aeb784c456889c96cb90c815792c26159834eca245410daa9d5dc3ab152664e2db3ee1d06315992636e5ac78ddf29d6
checksums.yaml.gz.sig CHANGED
Binary file
data/lib/rss_timeline.rb CHANGED
@@ -4,11 +4,12 @@
4
4
 
5
5
  require 'simple-rss'
6
6
  require 'open-uri'
7
- require 'fileutils'
8
7
  require 'rss_creator'
8
+ require 'rxfreadwrite'
9
9
 
10
10
 
11
11
  class RSStimeline
12
+ include RXFReadWriteModule
12
13
 
13
14
  attr_accessor :rssfile
14
15
 
@@ -24,9 +25,9 @@ class RSStimeline
24
25
  @cache_filepath = File.join(@filepath, 'cache')
25
26
 
26
27
  # create a cache directory if it doesn't already exist
27
- FileUtils.mkdir_p @cache_filepath
28
+ FileX.mkdir_p @cache_filepath
28
29
 
29
- if File.exists? rssfile then
30
+ if FileX.exists? rssfile then
30
31
  @timeline = RSScreator.new rssfile
31
32
  else
32
33
 
@@ -44,7 +45,10 @@ class RSStimeline
44
45
  def update()
45
46
 
46
47
  # fetch the feeds from the web
47
- feeds = @source_feeds.map {|feed| [feed, SimpleRSS.parse(URI.open(feed))] }
48
+ feeds = @source_feeds.map do |feed|
49
+ #force_encoding('UTF-8')
50
+ [feed, SimpleRSS.parse(URI.open(feed).read.force_encoding('UTF-8'))]
51
+ end
48
52
 
49
53
  # check for each feed from the cache.
50
54
  # if the feed is in the cache, compare the 2 to find any new items.
@@ -59,7 +63,7 @@ class RSStimeline
59
63
 
60
64
  if File.exists? rssfile then
61
65
 
62
- rss_cache = SimpleRSS.parse File.read(rssfile)
66
+ rss_cache = SimpleRSS.parse FileX.read(rssfile).force_encoding('UTF-8')
63
67
 
64
68
  fresh, old = [rss.items, rss_cache.items].map do |feed|
65
69
  feed.clone.each {|x| x.delete :guid }
@@ -83,14 +87,14 @@ class RSStimeline
83
87
  if new_rss_items.any? then
84
88
  puts 'new_rss_items: ' + new_rss_items.inspect if @debug
85
89
  updated = true
86
- File.write rssfile, rss.source
90
+ FileX.write rssfile, rss.source
87
91
  end
88
92
 
89
93
  else
90
94
 
91
95
  updated = true
92
96
  add_new rss.items.first
93
- File.write rssfile, rss.source
97
+ FileX.write rssfile, rss.source
94
98
 
95
99
  end
96
100
  end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rss_timeline
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -35,7 +35,7 @@ cert_chain:
35
35
  9TjZeJfzvcT9qoVK2mzNoDK6P7AL4m7kfnLfQUIc2aF5x9/zIcBi5tEMDcnujsKH
36
36
  l5hjs/75OfrhM2lNdizSwpSW
37
37
  -----END CERTIFICATE-----
38
- date: 2021-11-18 00:00:00.000000000 Z
38
+ date: 2022-03-11 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: simple-rss
@@ -103,8 +103,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
103
103
  - !ruby/object:Gem::Version
104
104
  version: '0'
105
105
  requirements: []
106
- rubyforge_project:
107
- rubygems_version: 2.7.10
106
+ rubygems_version: 3.2.22
108
107
  signing_key:
109
108
  specification_version: 4
110
109
  summary: An RSS aggregator which generates an RSS file
metadata.gz.sig CHANGED
Binary file