planet 0.2.4 → 0.2.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/bin/planet +4 -5
  2. data/lib/planet.rb +7 -12
  3. data/lib/planet/version.rb +1 -1
  4. metadata +1 -1
data/bin/planet CHANGED
@@ -60,7 +60,6 @@ blogs:
60
60
  url: "http://blog.poteland.com" # => only required for people that don\'t have a \'url\' field on their RSS/Atom field'
61
61
 
62
62
 
63
-
64
63
  File.open('planet.yml', 'w') { |f| f.write(default) }
65
64
 
66
65
  puts '=> Created default planet.yml'
@@ -77,10 +76,10 @@ command :create_templates do |c|
77
76
  Dir.mkdir(templates_dir) unless File.exists?(templates_dir)
78
77
 
79
78
  author = '<div class="author">
80
- <a href="{{ twitter }}"><img src="{{ image }}" style="width: 48px; height: 48px;"></a>
81
- <span style="position: absolute; padding: 12px;">
82
- <i>Original post by {{ author }} - <a href="{{ blog }}">check out the original blog</a></i>
83
- </span>
79
+ <img src="{{ image }}" style="width: 96px; height: 96;">
80
+ <span style="position: absolute; padding: 32px 15px;">
81
+ <i>Original post by <a href="{{ twitter}}">{{ author }}</a> - check out <a href="{{ blog_url }}">{{ blog_title }}</a></i>
82
+ </span>
84
83
  </div>
85
84
  '
86
85
  if !File.exists?(templates_dir + 'author.html')
@@ -49,8 +49,11 @@ class Planet
49
49
  @@_blogs.each do |blog|
50
50
  puts "=> Parsing #{ blog.feed }"
51
51
  feed = Feedzirra::Feed.fetch_and_parse(blog.feed)
52
+
53
+ blog.name ||= feed.title || 'the source'
52
54
  blog.url ||= feed.url
53
55
  raise "#{ blog.author }'s blog does not have a url field on it's feed, you will need to specify it on planet.yml" if blog.url.nil?
56
+
54
57
  feed.entries.each do |entry|
55
58
  @@_posts << @post = Post.new(
56
59
  title: entry.title,
@@ -88,16 +91,6 @@ class Planet
88
91
  self.blog = attributes.fetch(:blog, nil)
89
92
  end
90
93
 
91
- def to_hash
92
- {
93
- title: title,
94
- date: date.strftime('%Y-%m-%d %H:%M'),
95
- url: url,
96
- content: content,
97
- author: blog.author
98
- }
99
- end
100
-
101
94
  def header
102
95
  ## TODO: We need categories/tags
103
96
  file = self.blog.planet.config.fetch('templates_directory', '_layouts/') + 'header.md'
@@ -126,7 +119,8 @@ class Planet
126
119
  data = {
127
120
  image: self.blog.image,
128
121
  author: self.blog.author,
129
- blog: self.blog.url,
122
+ blog_url: self.blog.url,
123
+ blog_title: self.blog.name,
130
124
  twitter: self.blog.twitter ? "http://twitter.com/#{ self.blog.twitter }" : self.blog.url
131
125
  }
132
126
 
@@ -138,11 +132,12 @@ class Planet
138
132
  end
139
133
  end
140
134
 
141
- class Blog < Struct.new(:url, :feed, :author, :image, :twitter, :posts, :planet)
135
+ class Blog < Struct.new(:url, :feed, :name, :author, :image, :twitter, :posts, :planet)
142
136
 
143
137
  def initialize(attributes = {})
144
138
  self.url = attributes[:url]
145
139
  self.feed = attributes[:feed]
140
+ self.name = attributes[:name]
146
141
  self.author = attributes[:author]
147
142
  self.image = attributes[:image]
148
143
  self.twitter = attributes[:twitter]
@@ -2,7 +2,7 @@ module Planet
2
2
  module Version
3
3
  MAJOR = 0
4
4
  MINOR = 2
5
- PATCH = 4
5
+ PATCH = 5
6
6
 
7
7
  def self.to_s
8
8
  [MAJOR, MINOR, PATCH].join('.')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: planet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: