feed_parser 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +3 -0
- data/Gemfile +5 -0
- data/README.md +7 -1
- data/Rakefile +27 -0
- data/lib/feed_parser.rb +1 -1
- data/lib/feed_parser/feed_item.rb +9 -4
- data/spec/feed_parser_spec.rb +16 -0
- data/spec/fixtures/facebook.atom.xml +2 -2
- metadata +9 -7
data/.travis.yml
ADDED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -2,6 +2,12 @@
|
|
2
2
|
|
3
3
|
Rss and Atom feed parser built on top of Nokogiri. Supports custom sanitizers.
|
4
4
|
|
5
|
+
## Build Status
|
6
|
+
|
7
|
+
[![Build Status](https://secure.travis-ci.org/arttu/feed_parser.png)](http://travis-ci.org/arttu/feed_parser)
|
8
|
+
|
9
|
+
FeedParser gem is tested on Ruby 1.8.7 and 1.9.3.
|
10
|
+
|
5
11
|
## Install
|
6
12
|
|
7
13
|
Add to Gemfile
|
@@ -40,7 +46,7 @@ Install dependencies by running `bundle install`.
|
|
40
46
|
|
41
47
|
Run rspec tests:
|
42
48
|
|
43
|
-
$ bundle exec
|
49
|
+
$ bundle exec rake spec
|
44
50
|
|
45
51
|
## Contributing
|
46
52
|
|
data/Rakefile
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
require 'bundler'
|
4
|
+
|
5
|
+
begin
|
6
|
+
require 'rspec'
|
7
|
+
rescue Bundler::BundlerError => e
|
8
|
+
$stderr.puts "Run `bundle install` to install rspec gem"
|
9
|
+
exit e.status_code
|
10
|
+
end
|
11
|
+
|
12
|
+
require 'rspec/core/rake_task'
|
13
|
+
|
14
|
+
desc "Run spec tests"
|
15
|
+
RSpec::Core::RakeTask.new('spec') do |t|
|
16
|
+
t.pattern = 'spec/**/*_spec.rb'
|
17
|
+
end
|
18
|
+
|
19
|
+
desc "Default: Run specs"
|
20
|
+
task :default => :spec
|
21
|
+
|
22
|
+
namespace :rubies do
|
23
|
+
desc "Run tests with three major Ruby versions"
|
24
|
+
task :specs do
|
25
|
+
run("rvm 1.8.7-p302@feed_parser,1.9.2-p0@feed_parser,1.9.3-p125@feed_parser do bundle exec rake spec")
|
26
|
+
end
|
27
|
+
end
|
data/lib/feed_parser.rb
CHANGED
@@ -40,10 +40,15 @@ class FeedParser
|
|
40
40
|
private
|
41
41
|
def possible_html_content(element)
|
42
42
|
return '' if element.empty?
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
43
|
+
return element.text unless element.attribute("type")
|
44
|
+
|
45
|
+
case element.attribute("type").value
|
46
|
+
when 'html', 'text/html'
|
47
|
+
CGI.unescapeHTML(element.inner_html)
|
48
|
+
when 'xhtml'
|
49
|
+
element.xpath('*').to_xhtml
|
50
|
+
else
|
51
|
+
element.text
|
47
52
|
end
|
48
53
|
end
|
49
54
|
end
|
data/spec/feed_parser_spec.rb
CHANGED
@@ -196,6 +196,22 @@ describe FeedParser do
|
|
196
196
|
:title => "Smashing Magazine",
|
197
197
|
:url => "http://www.smashingmagazine.com/feed/atom/",
|
198
198
|
# items: [] # <- fill in if you want to
|
199
|
+
},
|
200
|
+
'facebook.atom.xml' => {
|
201
|
+
:items => [
|
202
|
+
{
|
203
|
+
:guid => "urn:uuid:132266233552163",
|
204
|
+
:link => "http://developers.facebook.com/blog/post/614/",
|
205
|
+
:title => "Breaking Change: JavaScript SDK to oauth:true on December 13th",
|
206
|
+
:categories=>[],
|
207
|
+
:author => "",
|
208
|
+
:description => "",
|
209
|
+
:content => '<div><p>As part of our continued efforts to migrate all apps to OAuth 2.0, we are opting in all apps using the new JavaScript SDK to OAuth 2.0 tomorrow at 11am Pacific Time. The deadline to support OAuth 2.0 was <a href="https://developers.facebook.com/docs/oauth2-https-migration/">October 1st, 2011</a>.</p>
|
210
|
+
|
211
|
+
<p>The new JS SDK with OAuth 2.0 was introduced in July. Tomorrow, on <b>December 13th at 11am</b>, we will automatically default the <code>oauth</code> param to true in <code>FB.init</code>. With this change, please ensure that you are using <code>FB.getAuthResponse</code> to obtain the access token. Read more about the specific changes that you need to make <a href="https://developers.facebook.com/blog/post/525/">here</a>.</p>
|
212
|
+
</div>'
|
213
|
+
}
|
214
|
+
]
|
199
215
|
}
|
200
216
|
}.each do |atom_fixture, test_cases|
|
201
217
|
it "should parse #{atom_fixture}" do
|
@@ -628,10 +628,10 @@ Please refer to the <a href="https://developers.facebook.com/roadmap">Platform R
|
|
628
628
|
<updated>2011-12-12T17:00:00Z</updated>
|
629
629
|
<id>urn:uuid:132266233552163</id>
|
630
630
|
<link href="http://developers.facebook.com/blog/post/614/" rel="alternate" type="text/html"/>
|
631
|
-
<content type="
|
631
|
+
<content type="xhtml"><div xmlns="http://www.w3.org/1999/xhtml"><p>As part of our continued efforts to migrate all apps to OAuth 2.0, we are opting in all apps using the new JavaScript SDK to OAuth 2.0 tomorrow at 11am Pacific Time. The deadline to support OAuth 2.0 was <a href="https://developers.facebook.com/docs/oauth2-https-migration/">October 1st, 2011</a>.</p>
|
632
632
|
|
633
633
|
<p>The new JS SDK with OAuth 2.0 was introduced in July. Tomorrow, on <b>December 13th at 11am</b>, we will automatically default the <code>oauth</code> param to true in <code>FB.init</code>. With this change, please ensure that you are using <code>FB.getAuthResponse</code> to obtain the access token. Read more about the specific changes that you need to make <a href="https://developers.facebook.com/blog/post/525/">here</a>.</p>
|
634
|
-
</div
|
634
|
+
</div></content>
|
635
635
|
</entry>
|
636
636
|
<entry>
|
637
637
|
<title type="text">Facebook Social Games Hack Recap</title>
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: feed_parser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-03-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: nokogiri
|
16
|
-
requirement: &
|
16
|
+
requirement: &2152816100 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *2152816100
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rspec-rails
|
27
|
-
requirement: &
|
27
|
+
requirement: &2152815240 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
version: '2.6'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *2152815240
|
36
36
|
description: Rss and Atom feed parser with sanitizer support built on top of Nokogiri.
|
37
37
|
email:
|
38
38
|
- arttu.tervo@gmail.com
|
@@ -42,9 +42,11 @@ extra_rdoc_files:
|
|
42
42
|
- README.md
|
43
43
|
files:
|
44
44
|
- .gitignore
|
45
|
+
- .travis.yml
|
45
46
|
- Gemfile
|
46
47
|
- LICENSE
|
47
48
|
- README.md
|
49
|
+
- Rakefile
|
48
50
|
- feed_parser.gemspec
|
49
51
|
- lib/feed_parser.rb
|
50
52
|
- lib/feed_parser/dsl.rb
|
@@ -79,7 +81,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
79
81
|
version: '0'
|
80
82
|
requirements: []
|
81
83
|
rubyforge_project:
|
82
|
-
rubygems_version: 1.8.
|
84
|
+
rubygems_version: 1.8.10
|
83
85
|
signing_key:
|
84
86
|
specification_version: 3
|
85
87
|
summary: Rss and Atom feed parser
|