agiley-feedzirra 0.0.24
Sign up to get free protection for your applications and to get access to all the features.
- data/README.textile +208 -0
- data/Rakefile +56 -0
- data/lib/core_ext/date.rb +21 -0
- data/lib/core_ext/string.rb +9 -0
- data/lib/feedzirra.rb +41 -0
- data/lib/feedzirra/feed.rb +325 -0
- data/lib/feedzirra/feed_entry_utilities.rb +45 -0
- data/lib/feedzirra/feed_utilities.rb +72 -0
- data/lib/feedzirra/parser/atom.rb +35 -0
- data/lib/feedzirra/parser/atom_entry.rb +39 -0
- data/lib/feedzirra/parser/atom_feed_burner.rb +27 -0
- data/lib/feedzirra/parser/atom_feed_burner_entry.rb +35 -0
- data/lib/feedzirra/parser/itunes_rss.rb +50 -0
- data/lib/feedzirra/parser/itunes_rss_item.rb +31 -0
- data/lib/feedzirra/parser/itunes_rss_owner.rb +12 -0
- data/lib/feedzirra/parser/rss.rb +28 -0
- data/lib/feedzirra/parser/rss_entry.rb +42 -0
- data/spec/feedzirra/feed_entry_utilities_spec.rb +52 -0
- data/spec/feedzirra/feed_spec.rb +556 -0
- data/spec/feedzirra/feed_utilities_spec.rb +149 -0
- data/spec/feedzirra/parser/atom_entry_spec.rb +49 -0
- data/spec/feedzirra/parser/atom_feed_burner_entry_spec.rb +42 -0
- data/spec/feedzirra/parser/atom_feed_burner_spec.rb +39 -0
- data/spec/feedzirra/parser/atom_spec.rb +43 -0
- data/spec/feedzirra/parser/itunes_rss_item_spec.rb +48 -0
- data/spec/feedzirra/parser/itunes_rss_owner_spec.rb +18 -0
- data/spec/feedzirra/parser/itunes_rss_spec.rb +50 -0
- data/spec/feedzirra/parser/rss_entry_spec.rb +41 -0
- data/spec/feedzirra/parser/rss_spec.rb +41 -0
- data/spec/spec.opts +2 -0
- data/spec/spec_helper.rb +58 -0
- metadata +220 -0
@@ -0,0 +1,41 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), %w[.. .. spec_helper])
|
2
|
+
|
3
|
+
describe Feedzirra::Parser::RSSEntry do
|
4
|
+
before(:each) do
|
5
|
+
# I don't really like doing it this way because these unit test should only rely on RSSEntry,
|
6
|
+
# but this is actually how it should work. You would never just pass entry xml straight to the AtomEnry
|
7
|
+
@entry = Feedzirra::Parser::RSS.parse(sample_rss_feed).entries.first
|
8
|
+
end
|
9
|
+
|
10
|
+
it "should parse the title" do
|
11
|
+
@entry.title.should == "Nokogiri’s Slop Feature"
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should parse the url" do
|
15
|
+
@entry.url.should == "http://tenderlovemaking.com/2008/12/04/nokogiris-slop-feature/"
|
16
|
+
end
|
17
|
+
|
18
|
+
it "should parse the author" do
|
19
|
+
@entry.author.should == "Aaron Patterson"
|
20
|
+
end
|
21
|
+
|
22
|
+
it "should parse the content" do
|
23
|
+
@entry.content.should == sample_rss_entry_content
|
24
|
+
end
|
25
|
+
|
26
|
+
it "should provide a summary" do
|
27
|
+
@entry.summary.should == "Oops! When I released nokogiri version 1.0.7, I totally forgot to talk about Nokogiri::Slop() feature that was added. Why is it called \"slop\"? It lets you sloppily explore documents. Basically, it decorates your document with method_missing() that allows you to search your document via method calls.\nGiven this document:\n\ndoc = Nokogiri::Slop(<<-eohtml)\n<html>\n  <body>\n  [...]"
|
28
|
+
end
|
29
|
+
|
30
|
+
it "should parse the published date" do
|
31
|
+
@entry.published.to_s.should == "Thu Dec 04 17:17:49 UTC 2008"
|
32
|
+
end
|
33
|
+
|
34
|
+
it "should parse the categories" do
|
35
|
+
@entry.categories.should == ['computadora', 'nokogiri', 'rails']
|
36
|
+
end
|
37
|
+
|
38
|
+
it "should parse the guid as id" do
|
39
|
+
@entry.id.should == "http://tenderlovemaking.com/?p=198"
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), %w[.. .. spec_helper])
|
2
|
+
|
3
|
+
describe Feedzirra::Parser::RSS do
|
4
|
+
describe "#will_parse?" do
|
5
|
+
it "should return true for an RSS feed" do
|
6
|
+
Feedzirra::Parser::RSS.should be_able_to_parse(sample_rss_feed)
|
7
|
+
end
|
8
|
+
|
9
|
+
# this is no longer true. combined rdf and rss into one
|
10
|
+
# it "should return false for an rdf feed" do
|
11
|
+
# Feedzirra::RSS.should_not be_able_to_parse(sample_rdf_feed)
|
12
|
+
# end
|
13
|
+
|
14
|
+
it "should return fase for an atom feed" do
|
15
|
+
Feedzirra::Parser::RSS.should_not be_able_to_parse(sample_atom_feed)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
describe "parsing" do
|
20
|
+
before(:each) do
|
21
|
+
@feed = Feedzirra::Parser::RSS.parse(sample_rss_feed)
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should parse the title" do
|
25
|
+
@feed.title.should == "Tender Lovemaking"
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should parse the url" do
|
29
|
+
@feed.url.should == "http://tenderlovemaking.com"
|
30
|
+
end
|
31
|
+
|
32
|
+
it "should provide an accessor for the feed_url" do
|
33
|
+
@feed.respond_to?(:feed_url).should == true
|
34
|
+
@feed.respond_to?(:feed_url=).should == true
|
35
|
+
end
|
36
|
+
|
37
|
+
it "should parse entries" do
|
38
|
+
@feed.entries.size.should == 10
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
data/spec/spec.opts
ADDED
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
require "rubygems"
|
2
|
+
require "spec"
|
3
|
+
|
4
|
+
# gem install redgreen for colored test output
|
5
|
+
begin require "redgreen" unless ENV['TM_CURRENT_LINE']; rescue LoadError; end
|
6
|
+
|
7
|
+
path = File.expand_path(File.dirname(__FILE__) + "/../lib/")
|
8
|
+
$LOAD_PATH.unshift(path) unless $LOAD_PATH.include?(path)
|
9
|
+
|
10
|
+
require "lib/feedzirra"
|
11
|
+
|
12
|
+
def load_sample(filename)
|
13
|
+
File.read("#{File.dirname(__FILE__)}/sample_feeds/#{filename}")
|
14
|
+
end
|
15
|
+
|
16
|
+
def sample_atom_feed
|
17
|
+
load_sample("AmazonWebServicesBlog.xml")
|
18
|
+
end
|
19
|
+
|
20
|
+
def sample_atom_entry_content
|
21
|
+
load_sample("AmazonWebServicesBlogFirstEntryContent.xml")
|
22
|
+
end
|
23
|
+
|
24
|
+
def sample_itunes_feed
|
25
|
+
load_sample("itunes.xml")
|
26
|
+
end
|
27
|
+
|
28
|
+
def sample_rdf_feed
|
29
|
+
load_sample("HREFConsideredHarmful.xml")
|
30
|
+
end
|
31
|
+
|
32
|
+
def sample_rdf_entry_content
|
33
|
+
load_sample("HREFConsideredHarmfulFirstEntry.xml")
|
34
|
+
end
|
35
|
+
|
36
|
+
def sample_rss_feed_burner_feed
|
37
|
+
load_sample("SamHarrisAuthorPhilosopherEssayistAtheist.xml")
|
38
|
+
end
|
39
|
+
|
40
|
+
def sample_rss_feed
|
41
|
+
load_sample("TenderLovemaking.xml")
|
42
|
+
end
|
43
|
+
|
44
|
+
def sample_rss_entry_content
|
45
|
+
load_sample("TenderLovemakingFirstEntry.xml")
|
46
|
+
end
|
47
|
+
|
48
|
+
def sample_feedburner_atom_feed
|
49
|
+
load_sample("PaulDixExplainsNothing.xml")
|
50
|
+
end
|
51
|
+
|
52
|
+
def sample_feedburner_atom_entry_content
|
53
|
+
load_sample("PaulDixExplainsNothingFirstEntryContent.xml")
|
54
|
+
end
|
55
|
+
|
56
|
+
def sample_wfw_feed
|
57
|
+
load_sample("PaulDixExplainsNothingWFW.xml")
|
58
|
+
end
|
metadata
ADDED
@@ -0,0 +1,220 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: agiley-feedzirra
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 47
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 24
|
10
|
+
version: 0.0.24
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Paul Dix
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2010-08-30 00:00:00 +02:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
name: nokogiri
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ">"
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 31
|
30
|
+
segments:
|
31
|
+
- 0
|
32
|
+
- 0
|
33
|
+
- 0
|
34
|
+
version: 0.0.0
|
35
|
+
type: :runtime
|
36
|
+
version_requirements: *id001
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: sax-machine
|
39
|
+
prerelease: false
|
40
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ">="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
hash: 7
|
46
|
+
segments:
|
47
|
+
- 0
|
48
|
+
- 0
|
49
|
+
- 12
|
50
|
+
version: 0.0.12
|
51
|
+
type: :runtime
|
52
|
+
version_requirements: *id002
|
53
|
+
- !ruby/object:Gem::Dependency
|
54
|
+
name: curb
|
55
|
+
prerelease: false
|
56
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
hash: 17
|
62
|
+
segments:
|
63
|
+
- 0
|
64
|
+
- 2
|
65
|
+
- 3
|
66
|
+
version: 0.2.3
|
67
|
+
type: :runtime
|
68
|
+
version_requirements: *id003
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: builder
|
71
|
+
prerelease: false
|
72
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ">="
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
hash: 15
|
78
|
+
segments:
|
79
|
+
- 2
|
80
|
+
- 1
|
81
|
+
- 2
|
82
|
+
version: 2.1.2
|
83
|
+
type: :runtime
|
84
|
+
version_requirements: *id004
|
85
|
+
- !ruby/object:Gem::Dependency
|
86
|
+
name: activesupport
|
87
|
+
prerelease: false
|
88
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ">="
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
hash: 9
|
94
|
+
segments:
|
95
|
+
- 2
|
96
|
+
- 3
|
97
|
+
- 5
|
98
|
+
version: 2.3.5
|
99
|
+
type: :runtime
|
100
|
+
version_requirements: *id005
|
101
|
+
- !ruby/object:Gem::Dependency
|
102
|
+
name: loofah
|
103
|
+
prerelease: false
|
104
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ">="
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
hash: 17
|
110
|
+
segments:
|
111
|
+
- 0
|
112
|
+
- 3
|
113
|
+
- 1
|
114
|
+
version: 0.3.1
|
115
|
+
type: :runtime
|
116
|
+
version_requirements: *id006
|
117
|
+
- !ruby/object:Gem::Dependency
|
118
|
+
name: rspec
|
119
|
+
prerelease: false
|
120
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
122
|
+
requirements:
|
123
|
+
- - ">="
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
hash: 3
|
126
|
+
segments:
|
127
|
+
- 0
|
128
|
+
version: "0"
|
129
|
+
type: :development
|
130
|
+
version_requirements: *id007
|
131
|
+
- !ruby/object:Gem::Dependency
|
132
|
+
name: diff-lcs
|
133
|
+
prerelease: false
|
134
|
+
requirement: &id008 !ruby/object:Gem::Requirement
|
135
|
+
none: false
|
136
|
+
requirements:
|
137
|
+
- - ">="
|
138
|
+
- !ruby/object:Gem::Version
|
139
|
+
hash: 3
|
140
|
+
segments:
|
141
|
+
- 0
|
142
|
+
version: "0"
|
143
|
+
type: :development
|
144
|
+
version_requirements: *id008
|
145
|
+
description:
|
146
|
+
email: paul@pauldix.net
|
147
|
+
executables: []
|
148
|
+
|
149
|
+
extensions: []
|
150
|
+
|
151
|
+
extra_rdoc_files: []
|
152
|
+
|
153
|
+
files:
|
154
|
+
- lib/core_ext/date.rb
|
155
|
+
- lib/core_ext/string.rb
|
156
|
+
- lib/feedzirra.rb
|
157
|
+
- lib/feedzirra/feed.rb
|
158
|
+
- lib/feedzirra/parser/atom.rb
|
159
|
+
- lib/feedzirra/parser/atom_entry.rb
|
160
|
+
- lib/feedzirra/parser/atom_feed_burner.rb
|
161
|
+
- lib/feedzirra/parser/atom_feed_burner_entry.rb
|
162
|
+
- lib/feedzirra/parser/itunes_rss.rb
|
163
|
+
- lib/feedzirra/parser/itunes_rss_item.rb
|
164
|
+
- lib/feedzirra/parser/itunes_rss_owner.rb
|
165
|
+
- lib/feedzirra/parser/rss.rb
|
166
|
+
- lib/feedzirra/parser/rss_entry.rb
|
167
|
+
- lib/feedzirra/feed_utilities.rb
|
168
|
+
- lib/feedzirra/feed_entry_utilities.rb
|
169
|
+
- README.textile
|
170
|
+
- Rakefile
|
171
|
+
- spec/spec.opts
|
172
|
+
- spec/spec_helper.rb
|
173
|
+
- spec/feedzirra/feed_spec.rb
|
174
|
+
- spec/feedzirra/parser/atom_spec.rb
|
175
|
+
- spec/feedzirra/parser/atom_entry_spec.rb
|
176
|
+
- spec/feedzirra/parser/atom_feed_burner_spec.rb
|
177
|
+
- spec/feedzirra/parser/atom_feed_burner_entry_spec.rb
|
178
|
+
- spec/feedzirra/parser/itunes_rss_spec.rb
|
179
|
+
- spec/feedzirra/parser/itunes_rss_item_spec.rb
|
180
|
+
- spec/feedzirra/parser/itunes_rss_owner_spec.rb
|
181
|
+
- spec/feedzirra/parser/rss_spec.rb
|
182
|
+
- spec/feedzirra/parser/rss_entry_spec.rb
|
183
|
+
- spec/feedzirra/feed_utilities_spec.rb
|
184
|
+
- spec/feedzirra/feed_entry_utilities_spec.rb
|
185
|
+
has_rdoc: true
|
186
|
+
homepage: http://github.com/pauldix/feedzirra
|
187
|
+
licenses: []
|
188
|
+
|
189
|
+
post_install_message:
|
190
|
+
rdoc_options: []
|
191
|
+
|
192
|
+
require_paths:
|
193
|
+
- lib
|
194
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
195
|
+
none: false
|
196
|
+
requirements:
|
197
|
+
- - ">="
|
198
|
+
- !ruby/object:Gem::Version
|
199
|
+
hash: 3
|
200
|
+
segments:
|
201
|
+
- 0
|
202
|
+
version: "0"
|
203
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
204
|
+
none: false
|
205
|
+
requirements:
|
206
|
+
- - ">="
|
207
|
+
- !ruby/object:Gem::Version
|
208
|
+
hash: 3
|
209
|
+
segments:
|
210
|
+
- 0
|
211
|
+
version: "0"
|
212
|
+
requirements: []
|
213
|
+
|
214
|
+
rubyforge_project:
|
215
|
+
rubygems_version: 1.3.7
|
216
|
+
signing_key:
|
217
|
+
specification_version: 2
|
218
|
+
summary: "A feed fetching and parsing library that treats the internet like Godzilla treats Japan: it dominates and eats all. Forked from http://github.com/tommeier/feedzirra for Proxy support and upped to RubyGems for easy gem install."
|
219
|
+
test_files: []
|
220
|
+
|