concerto_simple_rss 0.5 → 0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -2
- data/app/models/simple_rss.rb +5 -7
- data/lib/concerto_simple_rss/version.rb +1 -1
- metadata +6 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0dd4732708ed52d5656b207308dffc8595ee1896
|
4
|
+
data.tar.gz: bf0e049cfef54eff5f20e74278fa71c1a7012a26
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7b54a6c1c6fbdacb11e91882bdf0af5ce26a1826fb0943092fdd5fe43376cb758e4f8befc59baa17a1bff84debf573c2a676ef11bbb8c53722d4689e091922f4
|
7
|
+
data.tar.gz: 3c40ac2612657dbd987efe901673b9372b34243d38e9b87ee37ed9e8398a106e950ae6ae8085ad16691bd555f954eaed1738cf481b9436a2db9491f9a7a7695a
|
data/README.md
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
# Concerto 2 Simple RSS Plugin
|
2
2
|
This plugin provides support to pull dynamic content from RSS feeds.
|
3
3
|
|
4
|
-
|
5
|
-
2. ```bundle install```
|
4
|
+
To install this plugin, go to the Plugin management page in concerto, select RubyGems as the source and "concerto_simple_rss" as the gem name.
|
6
5
|
|
7
6
|
Concerto 2 Simple RSS is licensed under the Apache License, Version 2.0.
|
data/app/models/simple_rss.rb
CHANGED
@@ -76,6 +76,8 @@ class SimpleRss < DynamicContent
|
|
76
76
|
end
|
77
77
|
|
78
78
|
data = xslt.serve()
|
79
|
+
# xslt.serve does always return a string with ASCII-8BIT encoding regardless of what the actual encoding is
|
80
|
+
data = data.force_encoding(xslt.xml.encoding) if data
|
79
81
|
|
80
82
|
# try to load the transformed data as an xml document so we can see if there are
|
81
83
|
# mulitple content-items that we need to parse out, if we cant then treat it as one content item
|
@@ -139,7 +141,7 @@ class SimpleRss < DynamicContent
|
|
139
141
|
result = []
|
140
142
|
begin
|
141
143
|
# this will only work with nodesets for now
|
142
|
-
re_pattern = Regexp.new(pattern)
|
144
|
+
re_pattern = Regexp.new(pattern, Regexp::MULTILINE)
|
143
145
|
if nodes.is_a?(Array) && nodes.count > 0 && nodes.first.is_a?(REXML::Element)
|
144
146
|
nodes.each do |node|
|
145
147
|
s = node.to_s
|
@@ -162,7 +164,7 @@ class SimpleRss < DynamicContent
|
|
162
164
|
# fetch the feed, return the type, title, and contents (parsed) and raw feed (unparsed)
|
163
165
|
def fetch_feed(url)
|
164
166
|
require 'rss'
|
165
|
-
require '
|
167
|
+
require 'open-uri'
|
166
168
|
|
167
169
|
type = 'UNKNOWN'
|
168
170
|
title = ''
|
@@ -172,11 +174,7 @@ class SimpleRss < DynamicContent
|
|
172
174
|
begin
|
173
175
|
# cache same url for 1 minute to alleviate redundant calls when previewing
|
174
176
|
feed = Rails.cache.fetch(url, :expires_in => 1.minute) do
|
175
|
-
|
176
|
-
http = Net::HTTP.new(uri.host, uri.port)
|
177
|
-
http.use_ssl = uri.scheme == 'https'
|
178
|
-
request = Net::HTTP::Get.new(uri.request_uri)
|
179
|
-
http.request(request).body
|
177
|
+
open(url).read()
|
180
178
|
end
|
181
179
|
|
182
180
|
rss = RSS::Parser.parse(feed, false, true)
|
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: concerto_simple_rss
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.6'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian Michalski
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-08-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - '>='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: '0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - '>='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: ruby-xslt
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -38,20 +38,6 @@ dependencies:
|
|
38
38
|
- - ~>
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0.9'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: sqlite3
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - '>='
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - '>='
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
55
41
|
description: Simple support to render RSS content in Concerto 2.
|
56
42
|
email:
|
57
43
|
- bmichalski@gmail.com
|