planet 0.3.5 → 0.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/bin/planet +1 -1
- data/lib/planet.rb +4 -6
- data/lib/planet/version.rb +1 -1
- metadata +1 -1
data/bin/planet
CHANGED
@@ -49,7 +49,7 @@ end
|
|
49
49
|
desc 'Creates basic templates on the templates_directory specified in planet.yml'
|
50
50
|
command :create_templates do |c|
|
51
51
|
c.action do |global_options,options,args|
|
52
|
-
conf = YAML.
|
52
|
+
conf = YAML.load_file('planet.yml')
|
53
53
|
|
54
54
|
templates_dir = conf.fetch('planet').fetch('templates_directory', 'source/_layouts/')
|
55
55
|
|
data/lib/planet.rb
CHANGED
@@ -35,7 +35,7 @@ class Planet
|
|
35
35
|
|
36
36
|
class Post
|
37
37
|
|
38
|
-
attr_accessor :title, :content, :date, :url, :blog
|
38
|
+
attr_accessor :title, :content, :date, :url, :blog
|
39
39
|
|
40
40
|
def initialize(attributes = {})
|
41
41
|
self.title = attributes[:title]
|
@@ -43,7 +43,6 @@ class Planet
|
|
43
43
|
self.date = attributes[:date]
|
44
44
|
self.url = attributes[:url]
|
45
45
|
self.blog = attributes[:blog]
|
46
|
-
self.author = attributes[:author]
|
47
46
|
end
|
48
47
|
|
49
48
|
def to_s
|
@@ -56,7 +55,7 @@ class Planet
|
|
56
55
|
post_title: self.title,
|
57
56
|
post_date: self.date,
|
58
57
|
image_url: self.blog.image,
|
59
|
-
author: self.author,
|
58
|
+
author: self.blog.author,
|
60
59
|
blog_url: self.blog.url,
|
61
60
|
blog_name: self.blog.name,
|
62
61
|
post_url: self.url,
|
@@ -108,7 +107,7 @@ class Planet
|
|
108
107
|
feed = Feedzirra::Feed.fetch_and_parse(self.feed)
|
109
108
|
|
110
109
|
self.name ||= feed.title || 'the source'
|
111
|
-
self
|
110
|
+
self..url ||= feed.url
|
112
111
|
|
113
112
|
if self.url.nil?
|
114
113
|
abort "#{ self.author }'s blog does not have a url field on it's feed, you will need to specify it on planet.yml"
|
@@ -117,14 +116,13 @@ class Planet
|
|
117
116
|
feed.entries.each do |entry|
|
118
117
|
self.posts << @post = Post.new(
|
119
118
|
title: entry.title.sanitize,
|
120
|
-
author: entry.author ? entry.author : self.author,
|
121
119
|
content: self.sanitize_images(entry.content.strip),
|
122
120
|
date: entry.published,
|
123
121
|
url: self.url + entry.url,
|
124
122
|
blog: self
|
125
123
|
)
|
126
124
|
|
127
|
-
puts "=> Found post titled #{ @post.title } - by #{ @post.author }"
|
125
|
+
puts "=> Found post titled #{ @post.title } - by #{ @post.blog.author }"
|
128
126
|
end
|
129
127
|
end
|
130
128
|
|
data/lib/planet/version.rb
CHANGED