planet 0.4.1 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/bin/planet +1 -0
- data/lib/planet.rb +2 -1
- data/lib/planet/blog.rb +13 -1
- data/lib/planet/version.rb +2 -2
- metadata +15 -25
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 3b41f2c2e719bea8b0245cd84911d31287a40df4
|
4
|
+
data.tar.gz: af039754a9c06fcbbfabf412253ac85351c2239d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 47e0a708f32784cf166372fbd7e73558bdb0b3f29de3c5740700afdddf387491d19d411ac1e1c02bd78300cf603160b3bee2ec4ff8e13c905c76104efc304c09
|
7
|
+
data.tar.gz: 3f52250663f7a55612edf7d7c77c9b9b0573a8168bad9a2f8d1f274f3a00ca03eaf718d44e2d10f79895ec98ba49bc07c679d76b696514cfb8763a46ccc43c02
|
data/bin/planet
CHANGED
data/lib/planet.rb
CHANGED
@@ -5,12 +5,13 @@ require 'planet/importer'
|
|
5
5
|
|
6
6
|
class Planet
|
7
7
|
|
8
|
-
attr_accessor :config, :blogs
|
8
|
+
attr_accessor :config, :blogs, :whitelisted_tags
|
9
9
|
|
10
10
|
def initialize(config_file_path)
|
11
11
|
config_file = read_config_file(config_file_path)
|
12
12
|
self.config = config_file[:planet]
|
13
13
|
self.blogs = config_file[:blogs]
|
14
|
+
self.whitelisted_tags = self.config['whitelisted_tags']
|
14
15
|
end
|
15
16
|
|
16
17
|
def posts
|
data/lib/planet/blog.rb
CHANGED
@@ -26,8 +26,12 @@ class Planet
|
|
26
26
|
parser = self.type ? @parsers.get_parser(self.type) : @parsers.get_parser_for(self.feed)
|
27
27
|
|
28
28
|
# parser instances should mimick Feedzirra interface
|
29
|
-
|
29
|
+
parser.fetch_and_parse(self.feed,
|
30
|
+
:on_success => lambda { |url, feed| on_fetch_success(feed) },
|
31
|
+
:on_failure => lambda { |url, response_code, response_header, response_body| puts "\t=> Failed to fetch #{url} with response_code: #{response_code}" })
|
32
|
+
end
|
30
33
|
|
34
|
+
def on_fetch_success(feed)
|
31
35
|
self.name ||= feed.title || 'the source'
|
32
36
|
self.url ||= feed.url
|
33
37
|
|
@@ -36,6 +40,7 @@ class Planet
|
|
36
40
|
end
|
37
41
|
|
38
42
|
feed.entries.each do |entry|
|
43
|
+
next unless whitelisted?(entry)
|
39
44
|
content = if entry.content
|
40
45
|
self.sanitize_images(entry.content.strip)
|
41
46
|
elsif entry.summary
|
@@ -69,5 +74,12 @@ class Planet
|
|
69
74
|
|
70
75
|
html
|
71
76
|
end
|
77
|
+
|
78
|
+
def whitelisted?(entry)
|
79
|
+
return true if self.planet.whitelisted_tags.empty?
|
80
|
+
result = !(entry.categories & self.planet.whitelisted_tags).empty?
|
81
|
+
puts "\t=> Ignored post titled: #{entry.title} with categories: [#{entry.categories.join(', ')}]" unless result
|
82
|
+
result
|
83
|
+
end
|
72
84
|
end
|
73
85
|
end
|
data/lib/planet/version.rb
CHANGED
metadata
CHANGED
@@ -1,78 +1,69 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: planet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.5.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Pablo Astigarraga
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2013-
|
11
|
+
date: 2013-09-16 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: gli
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - '>='
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '0'
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - '>='
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: '0'
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: feedzirra
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- -
|
31
|
+
- - '>='
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: '0'
|
38
34
|
type: :runtime
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- -
|
38
|
+
- - '>='
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: '0'
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: mustache
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
|
-
- -
|
45
|
+
- - '>='
|
52
46
|
- !ruby/object:Gem::Version
|
53
47
|
version: '0'
|
54
48
|
type: :runtime
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
|
-
- -
|
52
|
+
- - '>='
|
60
53
|
- !ruby/object:Gem::Version
|
61
54
|
version: '0'
|
62
55
|
- !ruby/object:Gem::Dependency
|
63
56
|
name: box
|
64
57
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
58
|
requirements:
|
67
|
-
- -
|
59
|
+
- - '>='
|
68
60
|
- !ruby/object:Gem::Version
|
69
61
|
version: '0'
|
70
62
|
type: :runtime
|
71
63
|
prerelease: false
|
72
64
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
65
|
requirements:
|
75
|
-
- -
|
66
|
+
- - '>='
|
76
67
|
- !ruby/object:Gem::Version
|
77
68
|
version: '0'
|
78
69
|
description:
|
@@ -92,27 +83,26 @@ files:
|
|
92
83
|
- lib/planet.rb
|
93
84
|
homepage: http://github.com/pote/planet.rb
|
94
85
|
licenses: []
|
86
|
+
metadata: {}
|
95
87
|
post_install_message:
|
96
88
|
rdoc_options: []
|
97
89
|
require_paths:
|
98
90
|
- lib
|
99
91
|
- lib
|
100
92
|
required_ruby_version: !ruby/object:Gem::Requirement
|
101
|
-
none: false
|
102
93
|
requirements:
|
103
|
-
- -
|
94
|
+
- - '>='
|
104
95
|
- !ruby/object:Gem::Version
|
105
96
|
version: '0'
|
106
97
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
107
|
-
none: false
|
108
98
|
requirements:
|
109
|
-
- -
|
99
|
+
- - '>='
|
110
100
|
- !ruby/object:Gem::Version
|
111
101
|
version: '0'
|
112
102
|
requirements: []
|
113
103
|
rubyforge_project:
|
114
|
-
rubygems_version:
|
104
|
+
rubygems_version: 2.0.0
|
115
105
|
signing_key:
|
116
|
-
specification_version:
|
106
|
+
specification_version: 4
|
117
107
|
summary: An rss/atom feed aggregator designed to work with Octopress/Jekyll
|
118
108
|
test_files: []
|