postview 0.7.0 → 0.8.0
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/HISTORY +34 -9
- data/README.rdoc +11 -7
- data/Rakefile +4 -0
- data/VERSION +4 -4
- data/lib/postview.rb +6 -1
- data/lib/postview/application.rb +26 -33
- data/lib/postview/cli.rb +2 -0
- data/lib/postview/extensions.rb +8 -0
- data/lib/postview/helpers.rb +67 -9
- data/lib/postview/patches.rb +2 -0
- data/lib/postview/settings.rb +19 -3
- data/lib/postview/site.rb +19 -4
- data/tasks/history.rake +2 -2
- data/test/application_test.rb +12 -12
- data/test/extensions.rb +3 -3
- data/test/fixtures/application/posts/{20090529-postview_blogware.ruby.sinatra.mkd → 20090529-third_article.t1.t2.t3.mkd} +0 -0
- data/test/fixtures/application/posts/{20090602-postview_blogware.ruby.sinatra.mkd → 20090602-fourth_article.t1.t2.t3.t4.mkd} +0 -0
- data/test/fixtures/application/posts/archive/{20080529-postview_blogware.ruby.sinatra.mkd → 20080529-first_article.t1.mkd} +0 -0
- data/test/fixtures/application/posts/archive/{20080602-postview_blogware.ruby.sinatra.mkd → 20080602-second_article.t1.t2.mkd} +0 -0
- data/test/fixtures/application/posts/drafts/{20090730-draft_postview_blogware.ruby.sinatra.mkd → 20090730-fifth_article.t1.t2.t3.t4.t5.mkd} +0 -0
- data/test/fixtures/application/themes/gemstone/about.erb +22 -0
- data/test/fixtures/application/themes/gemstone/archive/index.erb +21 -0
- data/test/fixtures/application/themes/gemstone/archive/show.erb +4 -4
- data/test/fixtures/application/themes/gemstone/error.erb +0 -0
- data/test/fixtures/application/themes/gemstone/images/logo.png +0 -0
- data/test/fixtures/application/themes/gemstone/images/navigation-bar.gif +0 -0
- data/test/fixtures/application/themes/gemstone/images/postview.png +0 -0
- data/test/fixtures/application/themes/gemstone/images/rack.png +0 -0
- data/test/fixtures/application/themes/gemstone/images/ruby.png +0 -0
- data/test/fixtures/application/themes/gemstone/images/sinatra.png +0 -0
- data/test/fixtures/application/themes/gemstone/index.erb +38 -0
- data/test/fixtures/application/themes/gemstone/layout.erb +124 -0
- data/test/fixtures/application/themes/gemstone/posts/index.erb +21 -0
- data/test/fixtures/application/themes/gemstone/posts/show.erb +17 -0
- data/test/fixtures/application/themes/gemstone/search.erb +40 -0
- data/test/fixtures/application/themes/gemstone/stylesheets/postview.css +238 -0
- data/test/fixtures/application/themes/gemstone/tags/index.erb +12 -0
- data/test/fixtures/application/themes/gemstone/tags/show.erb +40 -0
- data/test/helpers_test.rb +70 -0
- data/test/settings_test.rb +2 -2
- data/test/site_test.rb +15 -14
- data/themes/default/about.erb +3 -5
- data/themes/default/archive/index.erb +1 -1
- data/themes/default/archive/show.erb +4 -4
- data/themes/default/index.erb +2 -2
- data/themes/default/layout.erb +20 -7
- data/themes/default/posts/index.erb +1 -1
- data/themes/default/posts/show.erb +4 -4
- data/themes/default/search.erb +5 -5
- data/themes/default/tags/index.erb +1 -1
- data/themes/default/tags/show.erb +6 -6
- metadata +27 -8
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Background header: 1F3366
|
|
3
|
+
* Background over: 445172
|
|
4
|
+
* Background light: 6D7FAC
|
|
5
|
+
* Background text: DADFEC
|
|
6
|
+
* Borders and colors: 5C6E9A
|
|
7
|
+
*
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
* {
|
|
11
|
+
font-size: 13.34px;
|
|
12
|
+
font-family: sans,dejavu sans,helvetica,verdana,arial,sans-serif;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
a {
|
|
16
|
+
color: #777;
|
|
17
|
+
text-decoration: none;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
a:hover {
|
|
21
|
+
color: #000;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
h1, h2, h3, h4, h5, h6 {
|
|
25
|
+
margin: 0px;
|
|
26
|
+
padding: 0px;
|
|
27
|
+
font-weight: normal;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
h1, h1>*, * html h1 * { font-size: 22px; }
|
|
31
|
+
h2, h2>* { font-size: 20px; }
|
|
32
|
+
h3, h3>* { font-size: 18px; }
|
|
33
|
+
h4, h4>* { font-size: 18px; }
|
|
34
|
+
h5, h5>* { font-size: 16px; }
|
|
35
|
+
h6, h6>* { font-size: 16px; }
|
|
36
|
+
small, small>* { font-size: 10px; }
|
|
37
|
+
big, big>* { font-size: 18px; }
|
|
38
|
+
|
|
39
|
+
body {
|
|
40
|
+
margin: 0px;
|
|
41
|
+
padding: 0px;
|
|
42
|
+
background-color: #DADFEC;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
body>br {
|
|
46
|
+
clear: both;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
body>div {
|
|
50
|
+
float: left;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
body>div>address {
|
|
54
|
+
float: left;
|
|
55
|
+
display: block;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
body>div>address>a {
|
|
59
|
+
float: left;
|
|
60
|
+
display: block;
|
|
61
|
+
width: 10em;
|
|
62
|
+
text-align: center;
|
|
63
|
+
font-style: normal;
|
|
64
|
+
background-color: inherit;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
body>div>address>a:hover {
|
|
68
|
+
color: #FFF;
|
|
69
|
+
background-color: #777;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
body>div>div>* {
|
|
73
|
+
width: inherit;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
body>div>div>h1 {
|
|
77
|
+
border-bottom: 1px dotted #555;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
pre {
|
|
81
|
+
padding: 4px;
|
|
82
|
+
font: 13.34px monaco,terminus,courrier,monospace;
|
|
83
|
+
color: #000;
|
|
84
|
+
background-color: #DDD;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
code {
|
|
88
|
+
font: 13.34px monaco,terminus,courrier,monospace;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
div#header,
|
|
92
|
+
div#footer {
|
|
93
|
+
width: 100%;
|
|
94
|
+
padding: 4px 0px 4px 0px;
|
|
95
|
+
background-color: #1F3366
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
img#logo {
|
|
99
|
+
top: 4px;
|
|
100
|
+
right: 2px;
|
|
101
|
+
position: absolute;
|
|
102
|
+
display: block;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
div#header *,
|
|
106
|
+
div#footer * {
|
|
107
|
+
color: #FFF;
|
|
108
|
+
margin: 0px;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
div#header h1, div#header h2, div#header span {
|
|
112
|
+
padding-left: 4px;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
div#header h1>* {
|
|
116
|
+
display: block;
|
|
117
|
+
font-size: 28px;
|
|
118
|
+
font-weight: bold;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
div#footer p {
|
|
122
|
+
text-align: center;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
div#navigation-bar {
|
|
126
|
+
width:100%;
|
|
127
|
+
height: 32px;
|
|
128
|
+
vertical-align: middle;
|
|
129
|
+
background-image: url(../images/navigation-bar.gif);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
div#navigation-bar address,
|
|
133
|
+
div#navigation-bar a {
|
|
134
|
+
height: inherit;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
div#navigation-bar a {
|
|
138
|
+
height: 24px;
|
|
139
|
+
padding-top: 8px;
|
|
140
|
+
font-size: 14px;
|
|
141
|
+
font-weight: bold;
|
|
142
|
+
color: #FFF;
|
|
143
|
+
border-right: 2px groove #5C6E9A;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
div#navigation-bar a:hover {
|
|
147
|
+
background-color: #445172;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
div#navigation-bar form {
|
|
151
|
+
float: right;
|
|
152
|
+
width: auto;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
div#navigation-bar form input[type="text"] {
|
|
156
|
+
width: 12em;
|
|
157
|
+
height: 24px;
|
|
158
|
+
padding-top: 6px;
|
|
159
|
+
font-weight: bold;
|
|
160
|
+
color: #FFF;
|
|
161
|
+
text-align: center;
|
|
162
|
+
border: none;
|
|
163
|
+
border-left: 2px groove #5C6E9A;
|
|
164
|
+
background-image: url(../images/navigation-bar.gif);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
div#navigation-bar form input[type="text"]:focus,
|
|
168
|
+
div#navigation-bar form input[type="text"]:hover {
|
|
169
|
+
background-image: none;
|
|
170
|
+
background-color: #FFF;
|
|
171
|
+
color: #445172;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
div#content {
|
|
175
|
+
width:60%;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
div#options {
|
|
179
|
+
width:40%;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.entry {
|
|
183
|
+
margin: 16px;
|
|
184
|
+
background-color: #FFF;
|
|
185
|
+
-moz-border-radius: 8px;
|
|
186
|
+
-webkit-border-radius: 8px;
|
|
187
|
+
border: 1px solid #5C6E9A;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
div#content .entry {
|
|
191
|
+
margin-right: 8px;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
div#options .entry {
|
|
195
|
+
margin-left: 8px;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
.entry h1 {
|
|
199
|
+
padding: 2px 12px 2px 12px;
|
|
200
|
+
border-bottom: 1px solid #5C6E9A;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
.entry h1 * {
|
|
204
|
+
color: #5C6E9A;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
.entry h1 a {
|
|
208
|
+
display: block;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
.entry-meta,
|
|
212
|
+
.text {
|
|
213
|
+
padding: 2px 12px 2px 12px;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
.entry-meta,
|
|
217
|
+
.entry-meta * {
|
|
218
|
+
font-style: italic;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
.entry ul {
|
|
222
|
+
padding: 2px 12px 2px 12px;
|
|
223
|
+
padding-left: 32px;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
.text {
|
|
227
|
+
margin: 8px auto 8px auto;
|
|
228
|
+
text-align: justify;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
.text h2 {
|
|
232
|
+
border-bottom: 1px dotted #5C6E9A;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
.text p {
|
|
236
|
+
padding: 16px auto 16px auto;
|
|
237
|
+
}
|
|
238
|
+
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
<div class="entry">
|
|
2
|
+
|
|
3
|
+
<h1>Posts tagged with <%= current_tag.capitalize %></h1>
|
|
4
|
+
|
|
5
|
+
<div class="text">
|
|
6
|
+
|
|
7
|
+
<p>
|
|
8
|
+
<%= posts_found.size %> found in posts and <%= archived_posts_found.size %> found in archive.
|
|
9
|
+
</p>
|
|
10
|
+
|
|
11
|
+
<% unless posts_found.empty? %>
|
|
12
|
+
<h2><%= title_path :posts %></h2>
|
|
13
|
+
|
|
14
|
+
<ul>
|
|
15
|
+
<% for post in posts_found %>
|
|
16
|
+
<li>
|
|
17
|
+
<b><%= link_to "#{post.publish_date} - #{post.title}", posts_path, post, :title => post.title %></b>
|
|
18
|
+
<span>(<%= post.tags.map{ |tag| link_to tag.capitalize, tags_path, tag, :title => tag.capitalize }.join(', ') %>)</span>
|
|
19
|
+
</li>
|
|
20
|
+
<% end %>
|
|
21
|
+
</ul>
|
|
22
|
+
<% end %>
|
|
23
|
+
|
|
24
|
+
<% unless archived_posts_found.empty? %>
|
|
25
|
+
<h2><%= title_path :archive %></h2>
|
|
26
|
+
|
|
27
|
+
<ul>
|
|
28
|
+
<% for post in archived_posts_found %>
|
|
29
|
+
<li>
|
|
30
|
+
<b><%= link_to "#{post.publish_date} - #{post.title}", archive_path, post, :title => post.title %></b>
|
|
31
|
+
<span>(<%= post.tags.map{ |tag| link_to tag.capitalize, tags_path, tag, :title => tag.capitalize }.join(', ') %>)</span>
|
|
32
|
+
</li>
|
|
33
|
+
<% end %>
|
|
34
|
+
</ul>
|
|
35
|
+
<% end %>
|
|
36
|
+
|
|
37
|
+
</div><!--text-->
|
|
38
|
+
|
|
39
|
+
</div><!--entry-->
|
|
40
|
+
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
$LOAD_PATH.unshift("#{File.dirname(__FILE__)}/..")
|
|
2
|
+
|
|
3
|
+
require 'lib/postview'
|
|
4
|
+
require 'test/unit'
|
|
5
|
+
require 'rack/test'
|
|
6
|
+
require 'test/helper'
|
|
7
|
+
require 'test/extensions'
|
|
8
|
+
|
|
9
|
+
class HelpersTest < Test::Unit::TestCase
|
|
10
|
+
|
|
11
|
+
include Rack::Test::Methods
|
|
12
|
+
include Postview::Helpers
|
|
13
|
+
|
|
14
|
+
def app
|
|
15
|
+
@app = Postview::Application
|
|
16
|
+
|
|
17
|
+
@app.set :root, "#{File.dirname(__FILE__)}/.."
|
|
18
|
+
@app.set :environment, :test
|
|
19
|
+
|
|
20
|
+
@app
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def setup
|
|
24
|
+
# for helpers
|
|
25
|
+
@settings = app.settings
|
|
26
|
+
@site = app.site
|
|
27
|
+
@page = app.page
|
|
28
|
+
@all_tags = @site.find_all_tags
|
|
29
|
+
@all_posts = @site.find.all_posts
|
|
30
|
+
@all_archived_posts = @site.find_in_archive.all_posts
|
|
31
|
+
@all_drafted_posts = @site.find_in_drafts.all_tags
|
|
32
|
+
@current_post = @all_posts.last
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
should "check latest posts" do
|
|
36
|
+
get app.root_path do |response|
|
|
37
|
+
assert response.ok?
|
|
38
|
+
assert_equal 2, latest_posts.size
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
should "check current post" do
|
|
43
|
+
get app.root_path do |response|
|
|
44
|
+
assert response.ok?
|
|
45
|
+
assert_equal "2009/06/02/fourth_article", current_post.to_s
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
should "check related posts and related tags" do
|
|
50
|
+
get app.posts_path "/2009/05/29/third_article" do |response|
|
|
51
|
+
assert response.ok?
|
|
52
|
+
assert_equal 1, related_posts_in(:posts).size
|
|
53
|
+
assert_equal 4, all_related_tags.size
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
get app.archive_path "/2008/06/02/second_article" do |response|
|
|
57
|
+
assert response.ok?
|
|
58
|
+
assert_equal 1, related_posts_in(:posts).size
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
should "check only four tags" do
|
|
63
|
+
get app.tags_path do |response|
|
|
64
|
+
assert response.ok?
|
|
65
|
+
assert_equal 4, all_tags.size
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
end
|
|
70
|
+
|
data/test/settings_test.rb
CHANGED
|
@@ -46,8 +46,8 @@ class SettingsTest < Test::Unit::TestCase
|
|
|
46
46
|
def test_should_build_site
|
|
47
47
|
assert_not_nil @settings.build_site
|
|
48
48
|
assert_not_nil @settings.build_site.find
|
|
49
|
-
assert_not_nil @settings.build_site.
|
|
50
|
-
assert_not_nil @settings.build_site.
|
|
49
|
+
assert_not_nil @settings.build_site.find_in_archive
|
|
50
|
+
assert_not_nil @settings.build_site.find_in_drafts
|
|
51
51
|
end
|
|
52
52
|
|
|
53
53
|
def test_should_rescue_exception_and_load_defaults
|
data/test/site_test.rb
CHANGED
|
@@ -11,7 +11,7 @@ class TestSite < Test::Unit::TestCase
|
|
|
11
11
|
@site = Postview::Settings.load.build_site
|
|
12
12
|
end
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
should "check all attributes" do
|
|
15
15
|
assert_equal 'Postview', @site.title
|
|
16
16
|
assert_equal 'Post your articles', @site.subtitle
|
|
17
17
|
assert_equal 'Jack Ducklet', @site.author
|
|
@@ -21,7 +21,7 @@ class TestSite < Test::Unit::TestCase
|
|
|
21
21
|
assert_equal 'gemstone', @site.theme
|
|
22
22
|
end
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
should "find all posts" do
|
|
25
25
|
posts = @site.find.all_posts
|
|
26
26
|
assert_not_nil posts
|
|
27
27
|
assert_equal 2, posts.size
|
|
@@ -30,32 +30,33 @@ class TestSite < Test::Unit::TestCase
|
|
|
30
30
|
end
|
|
31
31
|
end
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
should "find all tags" do
|
|
34
34
|
tags = @site.find.all_tags
|
|
35
35
|
assert_not_nil tags
|
|
36
|
-
assert_equal
|
|
36
|
+
assert_equal 4, tags.size
|
|
37
37
|
end
|
|
38
38
|
|
|
39
|
-
|
|
40
|
-
assert 2, @site.
|
|
41
|
-
@site.
|
|
39
|
+
should "find all archived posts" do
|
|
40
|
+
assert 2, @site.find_in_archive.all_posts.size
|
|
41
|
+
@site.find_in_archive.all_posts.collect do |post|
|
|
42
42
|
assert_match %r{\d{4}\d{4}-(\.*)\.*}, post.file.to_s
|
|
43
43
|
end
|
|
44
44
|
end
|
|
45
45
|
|
|
46
|
-
|
|
47
|
-
assert 1, @site.
|
|
48
|
-
@site.
|
|
46
|
+
should "find all drafts" do
|
|
47
|
+
assert 1, @site.find_in_drafts.all_posts.size
|
|
48
|
+
@site.find_in_drafts.all_posts.collect do |draft|
|
|
49
49
|
assert_match %r{\d{4}\d{4}-(\.*)\.*}, draft.file.to_s
|
|
50
50
|
end
|
|
51
51
|
end
|
|
52
52
|
|
|
53
|
-
|
|
54
|
-
assert_not_nil @site.find.post(*%w(2009 06 02
|
|
53
|
+
should "find one post" do
|
|
54
|
+
assert_not_nil @site.find.post(*%w(2009 06 02 fourth))
|
|
55
55
|
end
|
|
56
56
|
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
should "search posts" do
|
|
58
|
+
# TOFIX: The finder will be returns 2 posts.
|
|
59
|
+
assert 4, @site.find.posts('first third').size
|
|
59
60
|
end
|
|
60
61
|
|
|
61
62
|
end
|
data/themes/default/about.erb
CHANGED
|
@@ -11,11 +11,9 @@
|
|
|
11
11
|
</p>
|
|
12
12
|
|
|
13
13
|
<ul>
|
|
14
|
-
<li><%=link_to "#{
|
|
15
|
-
<li><%=link_to "#{Sinatra
|
|
16
|
-
<li><%=link_to "#{
|
|
17
|
-
<li><%=link_to "#{Maruku.name} v#{Maruku::VERSION}", "http://maruku.rubyforge.org/"%></li>
|
|
18
|
-
<li><%=link_to "#{Postage::Version}", "http://postage.rubyforge.org/"%></li>
|
|
14
|
+
<li><%=link_to "#{Sinatra}", "http://www.sinatrarb.com/"%></li>
|
|
15
|
+
<li><%=link_to "#{Sinatra::Mapping}", "http://sinatra-mapping.rubyforge.org/"%></li>
|
|
16
|
+
<li><%=link_to "#{Postage}", "http://postage.rubyforge.org/"%></li>
|
|
19
17
|
</ul>
|
|
20
18
|
|
|
21
19
|
</div><!--text-->
|