planet 0.2.6 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/planet +6 -5
- data/lib/planet.rb +17 -16
- data/lib/planet/version.rb +2 -2
- metadata +2 -2
data/bin/planet
CHANGED
@@ -75,10 +75,11 @@ command :create_templates do |c|
|
|
75
75
|
|
76
76
|
Dir.mkdir(templates_dir) unless File.exists?(templates_dir)
|
77
77
|
|
78
|
-
author = '
|
79
|
-
|
78
|
+
author = '
|
79
|
+
<div class="author">
|
80
|
+
<img src="{{ image_url }}" style="width: 96px; height: 96;">
|
80
81
|
<span style="position: absolute; padding: 32px 15px;">
|
81
|
-
<i>Original post by <a href="{{
|
82
|
+
<i>Original post by <a href="{{ twitter_url }}">{{ author }}</a> - check out <a href="{{ blog_url }}">{{ blog_name }}</a></i>
|
82
83
|
</span>
|
83
84
|
</div>
|
84
85
|
'
|
@@ -90,9 +91,9 @@ command :create_templates do |c|
|
|
90
91
|
end
|
91
92
|
|
92
93
|
header ='---
|
93
|
-
title: "{{
|
94
|
+
title: "{{ post_title }}"
|
94
95
|
kind: article
|
95
|
-
created_at: {{
|
96
|
+
created_at: {{ post_date }}
|
96
97
|
author: {{ author }}
|
97
98
|
layout: post
|
98
99
|
---
|
data/lib/planet.rb
CHANGED
@@ -91,18 +91,27 @@ class Planet
|
|
91
91
|
self.blog = attributes.fetch(:blog, nil)
|
92
92
|
end
|
93
93
|
|
94
|
+
def to_hash
|
95
|
+
{
|
96
|
+
post_content: self.content,
|
97
|
+
post_title: self.title,
|
98
|
+
post_date: self.date,
|
99
|
+
image_url: self.blog.image,
|
100
|
+
author: self.blog.author,
|
101
|
+
blog_url: self.blog.url,
|
102
|
+
blog_name: self.blog.name,
|
103
|
+
post_url: self.url,
|
104
|
+
twitter: self.blog.twitter,
|
105
|
+
twitter_url: "http://twitter.com/#{ self.blog.twitter }"
|
106
|
+
}
|
107
|
+
end
|
108
|
+
|
94
109
|
def header
|
95
110
|
## TODO: We need categories/tags
|
96
111
|
file = self.blog.planet.config.fetch('templates_directory', '_layouts/') + 'header.md'
|
97
112
|
file_contents = File.open(file, 'r').read
|
98
113
|
|
99
|
-
|
100
|
-
title: self.title,
|
101
|
-
date: self.date,
|
102
|
-
author: self.blog.author
|
103
|
-
}
|
104
|
-
|
105
|
-
Mustache.render(file_contents, data)
|
114
|
+
Mustache.render(file_contents, self.to_hash)
|
106
115
|
end
|
107
116
|
|
108
117
|
def file_name
|
@@ -116,15 +125,7 @@ class Planet
|
|
116
125
|
file = self.blog.planet.config.fetch('templates_directory', '_layouts/') + 'author.html'
|
117
126
|
file_contents = File.open(file, 'r').read
|
118
127
|
|
119
|
-
|
120
|
-
image: self.blog.image,
|
121
|
-
author: self.blog.author,
|
122
|
-
blog_url: self.blog.url,
|
123
|
-
blog_title: self.blog.name,
|
124
|
-
twitter: self.blog.twitter ? "http://twitter.com/#{ self.blog.twitter }" : self.blog.url
|
125
|
-
}
|
126
|
-
|
127
|
-
Mustache.render(file_contents, data)
|
128
|
+
Mustache.render(file_contents, self.to_hash)
|
128
129
|
end
|
129
130
|
|
130
131
|
def to_s
|
data/lib/planet/version.rb
CHANGED
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.
|
4
|
+
version: 0.3.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-04-
|
12
|
+
date: 2012-04-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|