feedcellar 0.7.1 → 0.7.2

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
  SHA1:
3
- metadata.gz: 58a404df36eb150c74d2839d8a8fd71d726a9fe9
4
- data.tar.gz: fd4f0979f0ad248b6959c3bd7e63165f3477eaef
3
+ metadata.gz: 5f55161aaf90f993ee60dc7a2b2a44b18de903a3
4
+ data.tar.gz: 467d81d5bcace2ea719ad534f639cee93b5cf884
5
5
  SHA512:
6
- metadata.gz: 16678eb5c430288bf6475f0d7c9aa420932b4c1a5651fdad40d87785441740bdbfa2a329be8cf78325898c7d16010a1206027b9c1972cbabd7c99f6644a60bc4
7
- data.tar.gz: 9f9505a627c30efe42802a1dc0111fe943d89e82c5931f78636045ba98d0d69bb10b75018e3af9e3964768ea7ed6bdc010d308d0adf5a099a755c923d4ea42dd
6
+ metadata.gz: 621a9cab01fcec48aafb331cf1535e15510c457caee852ebb440a2b6ffd24ff78d54c15f32e44908ee64eaa3d065e4972e5c29b9c48f1f99a214cdc785f93b5e
7
+ data.tar.gz: a0c7bc298bcce0f6a209db8faf4595f4263cf05ed2aa8f139b5c15251c59a9bf1063bad332ea647533e4223bc1d8e87cf62b96c376bedf8324dbdd477b6ae62d
data/NEWS.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # NEWS
2
2
 
3
+ ## 0.7.2: 2016-02-27
4
+
5
+ ### Changes
6
+
7
+ #### Improvements
8
+
9
+ * collect: Fixed parsing complex Atom feeds.
10
+ * collect: Accepted filter pattern.
11
+
3
12
  ## 0.7.1: 2016-02-17
4
13
 
5
14
  ### Changes
@@ -40,6 +40,7 @@ Gem::Specification.new do |spec|
40
40
  spec.add_runtime_dependency("rroonga", ">= 5.0.0")
41
41
  spec.add_runtime_dependency("thor")
42
42
  spec.add_runtime_dependency("parallel")
43
+ spec.add_runtime_dependency("feedjira")
43
44
 
44
45
  spec.add_development_dependency("test-unit")
45
46
  spec.add_development_dependency("test-unit-notify")
@@ -89,14 +89,19 @@ module Feedcellar
89
89
  end
90
90
  end
91
91
 
92
- desc "collect", "Collect feeds from WWW."
92
+ desc "collect [FILTER_PATTERN]", "Collect feeds from WWW."
93
93
  option :parallel, :type => :boolean, :desc => "run on multiple processes"
94
- def collect
94
+ def collect(filter_pattern=nil)
95
95
  GroongaDatabase.new.open(@database_dir) do |database|
96
96
  resources = database.resources
97
97
  collect_proc = lambda do |record|
98
98
  feed_url = record.xmlUrl
99
+
99
100
  next unless feed_url
101
+ if filter_pattern
102
+ regexp = Regexp.new(filter_pattern)
103
+ next unless regexp =~ feed_url
104
+ end
100
105
 
101
106
  items = Feed.parse(feed_url)
102
107
  next unless items
@@ -1,6 +1,6 @@
1
1
  # class Feedcellar::Feed
2
2
  #
3
- # Copyright (C) 2013-2014 Masafumi Yokoyama <myokoym@gmail.com>
3
+ # Copyright (C) 2013-2016 Masafumi Yokoyama <myokoym@gmail.com>
4
4
  #
5
5
  # This library is free software; you can redistribute it and/or
6
6
  # modify it under the terms of the GNU Lesser General Public
@@ -16,7 +16,7 @@
16
16
  # License along with this library; if not, write to the Free Software
17
17
  # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
18
 
19
- require "rss"
19
+ require "feedjira"
20
20
 
21
21
  module Feedcellar
22
22
  class Feed
@@ -32,32 +32,18 @@ module Feedcellar
32
32
  feeds = []
33
33
 
34
34
  begin
35
- rss = RSS::Parser.parse(feed_url)
36
- rescue RSS::InvalidRSSError
37
- begin
38
- rss = RSS::Parser.parse(feed_url, false)
39
- rescue
40
- $stderr.puts "WARNING: #{$!} (#{feed_url})"
41
- return nil
42
- end
35
+ rss = Feedjira::Feed.fetch_and_parse(feed_url)
43
36
  rescue
44
37
  $stderr.puts "WARNING: #{$!} (#{feed_url})"
45
38
  return nil
46
39
  end
47
40
  return nil unless rss
48
41
 
49
- rss.items.each do |item|
50
- if rss.is_a?(RSS::Atom::Feed)
51
- title = item.title.content
52
- link = item.link.href if item.link
53
- description = item.summary.content if item.summary
54
- date = item.updated.content if item.updated
55
- else
56
- title = item.title
57
- link = item.link
58
- description = item.description
59
- date = item.date
60
- end
42
+ rss.entries.each do |entry|
43
+ title = entry.title
44
+ link = entry.url
45
+ description = entry.summary || entry.content
46
+ date = entry.published || entry.updated
61
47
 
62
48
  next unless link
63
49
 
@@ -17,5 +17,5 @@
17
17
  # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
18
 
19
19
  module Feedcellar
20
- VERSION = "0.7.1"
20
+ VERSION = "0.7.2"
21
21
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: feedcellar
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.1
4
+ version: 0.7.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Masafumi Yokoyama
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-17 00:00:00.000000000 Z
11
+ date: 2016-02-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rroonga
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: feedjira
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: test-unit
57
71
  requirement: !ruby/object:Gem::Requirement