feedjira 3.1.2 → 3.2.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: 0146f6f9717aa2550c7c3ee8ad10bdc2d1670b5a877979ec3b4b92acc8556a01
4
- data.tar.gz: 336327b583cbda573b23b35c6c7e43633fb832ff8054be34126340ad8c8bff3a
3
+ metadata.gz: db9d2eb01b3bf275ae7d0599df9bef74ea336ddfb9afdcc31998c4f79890cf51
4
+ data.tar.gz: 30de1f11b4054c3860ca79a27f8fb54b2244e8140bd26340d3f64f84c2d29884
5
5
  SHA512:
6
- metadata.gz: db78dc79cc38419c6f81a0336f4794d8f744b2cab24786c3c9ac9b92f2b72f2c5db190a982fcfb16de6ccec1b358309c76e3c165ec16141b8816736774339662
7
- data.tar.gz: b9a4466a3371c7d1fb837cdc8ffcced9af1a830810b47113cd2a790c8c1145c0aae1a9faad91b642bec50a12469917ead27a48fc798e257e2017d736ef0e5101
6
+ metadata.gz: a83a5507737ed80d62515733dad8005f0f3d0bce59558d6b6f252a94084d459b664b7a56c5355d853cb706b62c1a7c804e5bd68df74f4cb9091bc12ce475d075
7
+ data.tar.gz: 8af825f5c5cde56ba80d69cbd7d55b1e36e4cb2c6c401f7092a9a8654757fcc133666dbd7ad38527b45f790523aa5449c29dd6886f43112dac49c328ccce816d
@@ -0,0 +1,39 @@
1
+ name: Ruby
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - master
7
+ pull_request:
8
+
9
+ jobs:
10
+ test:
11
+ strategy:
12
+ fail-fast: false
13
+ matrix:
14
+ os: [ubuntu]
15
+ ruby: [2.5, 2.6, 2.7, 3.0]
16
+ handler: [nokogiri, ox, oga]
17
+ exclude:
18
+ - { ruby: jruby, handler: ox }
19
+
20
+ name: >-
21
+ ${{matrix.os}}-ruby-${{matrix.ruby}}-${{matrix.handler}}
22
+ runs-on: ${{matrix.os}}-latest
23
+ continue-on-error: ${{matrix.ruby == 'head' || matrix.ruby == 'jruby'}}
24
+ env:
25
+ HANDLER: ${{matrix.handler}}
26
+
27
+ steps:
28
+ - name: Check out
29
+ uses: actions/checkout@v2
30
+
31
+ - name: Set up ruby and bundle
32
+ uses: ruby/setup-ruby@v1
33
+ with:
34
+ ruby-version: ${{matrix.ruby}}
35
+ bundler-cache: true
36
+
37
+ - name: Run rake
38
+ run: |
39
+ bundle exec rake
data/.rubocop.yml CHANGED
@@ -4,11 +4,6 @@ AllCops:
4
4
  TargetRubyVersion: 2.5
5
5
  NewCops: enable
6
6
 
7
-
8
- Gemspec/RequiredRubyVersion:
9
- Exclude:
10
- - 'feedjira.gemspec'
11
-
12
7
  # Offense count: 3
13
8
  # Configuration parameters: IgnoredMethods.
14
9
  Metrics/AbcSize:
data/CHANGELOG.md CHANGED
@@ -1,18 +1,42 @@
1
1
  # Feedjira Changelog
2
2
 
3
- ## Unreleased
3
+ ## 3.2.0
4
+
5
+ * Atom `feed_url` no longer falls back to `url` via https://github.com/feedjira/feedjira/pull/451 (@frederfred)
6
+
7
+ * Atom feeds now have an icon field via https://github.com/feedjira/feedjira/pull/452 (@jswanner)
8
+
9
+ ## 3.1.2
10
+
11
+ * Enhancements
12
+ * Alias `managingEditor` as `managing_editor` [#443][] ([@DominikAlberski][])
13
+ * Add support for the `a10` namespace used in RSS 2.0 feeds generated by .NET applications. Currently `a10:link`, `a10:updated`, `a10:content` and `a10:name` are supported. [#440][] ([@knu][])
14
+
15
+ [#440]: https://github.com/feedjira/feedjira/pull/440
16
+ [#443]: https://github.com/feedjira/feedjira/pull/443
17
+
18
+ ## 3.1.1
4
19
 
5
20
  * Enhancements
6
- * Add support for the `a10` namespace used in RSS 2.0 feeds generated by .NET applications. Currently `a10:link`, `a10:updated`, `a10:content` and `a10:name` are supported. [#440][] (@knu)
21
+ * Fix warnings in Ruby 2.7 [#434][] ([@sferik][])
22
+
23
+ * General
24
+ * Test on Ruby 2.5, 2.6 and 2.7 [#435][] ([@HParker][])
25
+
26
+ [#434]: https://github.com/feedjira/feedjira/pull/434
27
+ [#435]: https://github.com/feedjira/feedjira/pull/435
7
28
 
8
29
  ## 3.1.0
9
30
 
10
31
  * Breaking Changes
11
- * `title` of Atom entry classes always return a plain text even in case the entry has a title of the HTML or XML type. [#423][] (@knu)
32
+ * `title` of Atom entry classes always return a plain text even in case the entry has a title of the HTML or XML type. [#423][] ([@knu][])
12
33
 
13
34
  * Enhancements
14
- * `raw_title` and `title_type` are added to Atom entry classes. [#423][] (@knu)
15
- * AtomGoogleAlerts is now a supported parser [#424][] (@knu)
35
+ * `raw_title` and `title_type` are added to Atom entry classes. [#423][] ([@knu][])
36
+ * AtomGoogleAlerts is now a supported parser [#424][] ([@knu][])
37
+
38
+ [#423]: https://github.com/feedjira/feedjira/pull/423
39
+ [#424]: https://github.com/feedjira/feedjira/pull/424
16
40
 
17
41
  ## 3.0.0
18
42
 
@@ -31,16 +55,26 @@ configurable logging and parsing
31
55
  ## 2.1.0
32
56
 
33
57
  * Enhancements
34
- * AtomYoutube is now a supported parser [#337][] (@jfiorato)
35
- * Oga parsing is now supported [#331][] (@krasnoukhov)
36
- * DateTime Handler now supports localized dates [#313][] (@PascalTurbo)
37
- * RSS now supports language attribute [#344][] (@PascalTurbo)
58
+ * AtomYoutube is now a supported parser [#337][] ([@jfiorato][])
59
+ * Oga parsing is now supported [#331][] ([@krasnoukhov][])
60
+ * DateTime Handler now supports localized dates [#313][] ([@PascalTurbo][])
61
+ * RSS now supports language attribute [#344][] ([@PascalTurbo][])
38
62
  * ITunesRSS added support for:
39
- * `ttl` and `last_built` [#343][] (@sferik)
40
- * `itunes_category` and `itunes_category_paths` [#329][] (@knu)
41
- * `itunes_complete` [#328][] (@knu)
42
- * single quoted attributes [#326][] (@sferik)
43
- * Add image attribute [#349][] (@sferik)
63
+ * `ttl` and `last_built` [#343][] ([@sferik][])
64
+ * `itunes_category` and `itunes_category_paths` [#329][] ([@knu][])
65
+ * `itunes_complete` [#328][] ([@knu][])
66
+ * single quoted attributes [#326][] ([@sferik][])
67
+ * Add image attribute [#349][] ([@sferik][])
68
+
69
+ [#313]: https://github.com/feedjira/feedjira/pull/313
70
+ [#326]: https://github.com/feedjira/feedjira/pull/326
71
+ [#328]: https://github.com/feedjira/feedjira/pull/328
72
+ [#329]: https://github.com/feedjira/feedjira/pull/329
73
+ [#331]: https://github.com/feedjira/feedjira/pull/331
74
+ [#337]: https://github.com/feedjira/feedjira/pull/337
75
+ [#343]: https://github.com/feedjira/feedjira/pull/343
76
+ [#344]: https://github.com/feedjira/feedjira/pull/344
77
+ [#349]: https://github.com/feedjira/feedjira/pull/349
44
78
 
45
79
  ## 2.0.0
46
80
 
@@ -298,3 +332,11 @@ configurable logging and parsing
298
332
  ## 0.1.0
299
333
 
300
334
  * lower builder requirement to make it rails-3 friendly
335
+
336
+ [@DominikAlberski]: https://github.com/DominikAlberski
337
+ [@HParker]: https://github.com/HParker
338
+ [@PascalTurbo]: https://github.com/PascalTurbo
339
+ [@jfiorato]: https://github.com/jfiorato
340
+ [@knu]: https://github.com/knu
341
+ [@krasnoukhov]: https://github.com/krasnoukhov
342
+ [@sferik]: https://github.com/sferik
data/feedjira.gemspec CHANGED
@@ -20,7 +20,7 @@ Gem::Specification.new do |s|
20
20
  s.version = Feedjira::VERSION
21
21
 
22
22
  s.metadata = {
23
- "homepage_uri" => "http://feedjira.com",
23
+ "homepage_uri" => "https://github.com/feedjira/feedjira",
24
24
  "source_code_uri" => "https://github.com/feedjira/feedjira",
25
25
  "changelog_uri" => "https://github.com/feedjira/feedjira/blob/master/CHANGELOG.md"
26
26
  }
@@ -29,7 +29,7 @@ Gem::Specification.new do |s|
29
29
  s.require_paths = ["lib"]
30
30
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
31
31
 
32
- s.required_ruby_version = ">=2.2"
32
+ s.required_ruby_version = ">=2.5"
33
33
 
34
34
  s.add_dependency "loofah", ">= 2.3.1"
35
35
  s.add_dependency "sax-machine", ">= 1.0"
@@ -37,6 +37,5 @@ Gem::Specification.new do |s|
37
37
  s.add_development_dependency "faraday"
38
38
  s.add_development_dependency "rspec"
39
39
  s.add_development_dependency "rubocop"
40
- s.add_development_dependency "vcr"
41
40
  s.add_development_dependency "yard"
42
41
  end
data/lib/feedjira/feed.rb CHANGED
@@ -29,7 +29,7 @@ module Feedjira
29
29
  Feedjira.parsers.each do |klass|
30
30
  klass.sax_config.collection_elements.each_value do |value|
31
31
  collection_configs = value.select do |v|
32
- v.accessor == "entries" && v.data_class.class == Class
32
+ v.accessor == "entries" && v.data_class.is_a?(Class)
33
33
  end
34
34
 
35
35
  collection_configs.each do |config|
@@ -14,17 +14,14 @@ module Feedjira
14
14
  elements :link, as: :links, value: :href
15
15
  elements :link, as: :hubs, value: :href, with: { rel: "hub" }
16
16
  elements :entry, as: :entries, class: AtomEntry
17
+ element :icon
17
18
 
18
19
  def self.able_to_parse?(xml)
19
20
  %r{<feed[^>]+xmlns\s?=\s?["'](http://www\.w3\.org/2005/Atom|http://purl\.org/atom/ns\#)["'][^>]*>} =~ xml
20
21
  end
21
22
 
22
23
  def url
23
- @url || (links - [feed_url]).last || links.last
24
- end
25
-
26
- def feed_url
27
- @feed_url ||= links.first
24
+ @url || (links - [feed_url]).last
28
25
  end
29
26
 
30
27
  def self.preprocess(xml)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Feedjira
4
- VERSION = "3.1.2"
4
+ VERSION = "3.2.0"
5
5
  end
@@ -10,10 +10,10 @@ describe Feedjira::Configuration do
10
10
  end
11
11
 
12
12
  it "allows parsers to be modified" do
13
- CustomParser = Class.new
13
+ custom_parser = Class.new
14
14
 
15
- Feedjira.configure { |config| config.parsers.unshift(CustomParser) }
16
- expect(Feedjira.parsers.first).to eq(CustomParser)
15
+ Feedjira.configure { |config| config.parsers.unshift(custom_parser) }
16
+ expect(Feedjira.parsers.first).to eq(custom_parser)
17
17
  Feedjira.reset_configuration!
18
18
  end
19
19
  end
@@ -36,6 +36,11 @@ module Feedjira
36
36
  expect(@feed.description).to eq description
37
37
  end
38
38
 
39
+ it "should parse the icon url" do
40
+ feed_with_icon = Atom.parse(load_sample("SamRuby.xml"))
41
+ expect(feed_with_icon.icon).to eq "../favicon.ico"
42
+ end
43
+
39
44
  it "should parse the url" do
40
45
  expect(@feed.url).to eq "http://aws.typepad.com/aws/"
41
46
  end
@@ -93,7 +98,7 @@ module Feedjira
93
98
  end
94
99
  end
95
100
 
96
- describe "parsing url and feed url based on rel attribute" do
101
+ describe "parsing url and feed_url" do
97
102
  before :each do
98
103
  @feed = Atom.parse(sample_atom_middleman_feed)
99
104
  end
@@ -102,9 +107,21 @@ module Feedjira
102
107
  expect(@feed.url).to eq "http://feedjira.com/blog"
103
108
  end
104
109
 
105
- it "should parse feed url" do
110
+ it "should parse feed_url" do
106
111
  expect(@feed.feed_url).to eq "http://feedjira.com/blog/feed.xml"
107
112
  end
113
+
114
+ it "should not parse links without the rel='self' attribute as feed_url" do
115
+ xml = load_sample "atom_simple_single_entry.xml"
116
+ feed = Atom.parse xml
117
+ expect(feed.feed_url).to be_nil
118
+ end
119
+
120
+ it "should not parse links with the rel='self' attribute as url" do
121
+ xml = load_sample "atom_simple_single_entry_link_self.xml"
122
+ feed = Atom.parse xml
123
+ expect(feed.url).to be_nil
124
+ end
108
125
  end
109
126
  end
110
127
  end
data/spec/sample_feeds.rb CHANGED
@@ -3,6 +3,8 @@
3
3
  module SampleFeeds
4
4
  FEEDS = {
5
5
  sample_atom_feed: "AmazonWebServicesBlog.xml",
6
+ sample_atom_simple: "atom_simple_single_entry.xml",
7
+ sample_atom_simple_link_self: "atom_simple_single_entry_link_self.xml",
6
8
  sample_atom_middleman_feed: "FeedjiraBlog.xml",
7
9
  sample_atom_xhtml_feed: "pet_atom.xml",
8
10
  sample_atom_feed_line_breaks: "AtomFeedWithSpacesAroundEquals.xml",
@@ -0,0 +1,17 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <feed xmlns="http://www.w3.org/2005/Atom">
3
+ <title>Example Feed</title>
4
+ <link href="http://example.org/"/>
5
+ <updated>2003-12-13T18:30:02Z</updated>
6
+ <author>
7
+ <name>John Doe</name>
8
+ </author>
9
+ <id>urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6</id>
10
+ <entry>
11
+ <title>Atom-Powered Robots Run Amok</title>
12
+ <link href="http://example.org/2003/12/13/atom03"/>
13
+ <id>urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a</id>
14
+ <updated>2003-12-13T18:30:02Z</updated>
15
+ <summary>Some text.</summary>
16
+ </entry>
17
+ </feed>
@@ -0,0 +1,17 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <feed xmlns="http://www.w3.org/2005/Atom">
3
+ <title>Example Feed</title>
4
+ <link href="http://example.org/atom.xml" rel="self"/>
5
+ <updated>2003-12-13T18:30:02Z</updated>
6
+ <author>
7
+ <name>John Doe</name>
8
+ </author>
9
+ <id>urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6</id>
10
+ <entry>
11
+ <title>Atom-Powered Robots Run Amok</title>
12
+ <link href="http://example.org/2003/12/13/atom03"/>
13
+ <id>urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a</id>
14
+ <updated>2003-12-13T18:30:02Z</updated>
15
+ <summary>Some text.</summary>
16
+ </entry>
17
+ </feed>
data/spec/spec_helper.rb CHANGED
@@ -2,15 +2,9 @@
2
2
 
3
3
  require File.expand_path("#{File.dirname(__FILE__)}/../lib/feedjira")
4
4
  require "sample_feeds"
5
- require "vcr"
6
5
 
7
6
  SAXMachine.handler = ENV["HANDLER"].to_sym if ENV["HANDLER"]
8
7
 
9
- VCR.configure do |config|
10
- config.cassette_library_dir = "fixtures/vcr_cassettes"
11
- config.hook_into :faraday
12
- end
13
-
14
8
  RSpec.configure do |c|
15
9
  c.include SampleFeeds
16
10
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: feedjira
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.2
4
+ version: 3.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Hess
@@ -14,7 +14,7 @@ authors:
14
14
  autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
- date: 2020-11-22 00:00:00.000000000 Z
17
+ date: 2021-06-24 00:00:00.000000000 Z
18
18
  dependencies:
19
19
  - !ruby/object:Gem::Dependency
20
20
  name: loofah
@@ -86,20 +86,6 @@ dependencies:
86
86
  - - ">="
87
87
  - !ruby/object:Gem::Version
88
88
  version: '0'
89
- - !ruby/object:Gem::Dependency
90
- name: vcr
91
- requirement: !ruby/object:Gem::Requirement
92
- requirements:
93
- - - ">="
94
- - !ruby/object:Gem::Version
95
- version: '0'
96
- type: :development
97
- prerelease: false
98
- version_requirements: !ruby/object:Gem::Requirement
99
- requirements:
100
- - - ">="
101
- - !ruby/object:Gem::Version
102
- version: '0'
103
89
  - !ruby/object:Gem::Dependency
104
90
  name: yard
105
91
  requirement: !ruby/object:Gem::Requirement
@@ -121,11 +107,11 @@ extensions: []
121
107
  extra_rdoc_files: []
122
108
  files:
123
109
  - ".github/ISSUE_TEMPLATE/feed-parsing.md"
110
+ - ".github/workflows/ruby.yml"
124
111
  - ".gitignore"
125
112
  - ".rspec"
126
113
  - ".rubocop.yml"
127
114
  - ".rubocop_todo.yml"
128
- - ".travis.yml"
129
115
  - CHANGELOG.md
130
116
  - CODE_OF_CONDUCT.md
131
117
  - Gemfile
@@ -233,6 +219,8 @@ files:
233
219
  - spec/sample_feeds/TrotterCashionHome.xml
234
220
  - spec/sample_feeds/TypePadNews.xml
235
221
  - spec/sample_feeds/a10.xml
222
+ - spec/sample_feeds/atom_simple_single_entry.xml
223
+ - spec/sample_feeds/atom_simple_single_entry_link_self.xml
236
224
  - spec/sample_feeds/atom_with_link_tag_for_url_unmarked.xml
237
225
  - spec/sample_feeds/google_alerts_atom.xml
238
226
  - spec/sample_feeds/itunes.xml
@@ -244,7 +232,7 @@ homepage: https://github.com/feedjira/feedjira
244
232
  licenses:
245
233
  - MIT
246
234
  metadata:
247
- homepage_uri: http://feedjira.com
235
+ homepage_uri: https://github.com/feedjira/feedjira
248
236
  source_code_uri: https://github.com/feedjira/feedjira
249
237
  changelog_uri: https://github.com/feedjira/feedjira/blob/master/CHANGELOG.md
250
238
  post_install_message:
@@ -255,14 +243,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
255
243
  requirements:
256
244
  - - ">="
257
245
  - !ruby/object:Gem::Version
258
- version: '2.2'
246
+ version: '2.5'
259
247
  required_rubygems_version: !ruby/object:Gem::Requirement
260
248
  requirements:
261
249
  - - ">="
262
250
  - !ruby/object:Gem::Version
263
251
  version: '0'
264
252
  requirements: []
265
- rubygems_version: 3.2.0.rc.1
253
+ rubygems_version: 3.2.3
266
254
  signing_key:
267
255
  specification_version: 4
268
256
  summary: A feed parsing library
@@ -326,6 +314,8 @@ test_files:
326
314
  - spec/sample_feeds/TrotterCashionHome.xml
327
315
  - spec/sample_feeds/TypePadNews.xml
328
316
  - spec/sample_feeds/a10.xml
317
+ - spec/sample_feeds/atom_simple_single_entry.xml
318
+ - spec/sample_feeds/atom_simple_single_entry_link_self.xml
329
319
  - spec/sample_feeds/atom_with_link_tag_for_url_unmarked.xml
330
320
  - spec/sample_feeds/google_alerts_atom.xml
331
321
  - spec/sample_feeds/itunes.xml
data/.travis.yml DELETED
@@ -1,33 +0,0 @@
1
- language: ruby
2
-
3
- cache: bundler
4
-
5
- rvm:
6
- - 2.5
7
- - 2.6
8
- - 2.7
9
- - jruby-9
10
- - ruby-head
11
-
12
- env:
13
- - HANDLER=nokogiri
14
- - HANDLER=ox
15
- - HANDLER=oga
16
-
17
- matrix:
18
- fast_finish: true
19
- allow_failures:
20
- - rvm: jruby-9
21
- - rvm: ruby-head
22
- exclude:
23
- - rvm: jruby-9
24
- env: HANDLER=ox
25
-
26
- before_install:
27
- - gem update bundler
28
-
29
- script:
30
- - bundle exec rake
31
-
32
- notifications:
33
- email: false