postmarkdown 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/Appraisals +5 -0
- data/app/controllers/posts_controller.rb +11 -1
- data/app/models/post.rb +1 -0
- data/app/views/posts/_post.html.haml +2 -1
- data/app/views/posts/index.html.haml +1 -0
- data/gemfiles/rails3_2.gemfile +9 -0
- data/lib/postmarkdown/config.rb +2 -0
- data/lib/postmarkdown/engine.rb +1 -0
- data/lib/postmarkdown/version.rb +1 -1
- data/postmarkdown.gemspec +1 -0
- data/readme.md +10 -0
- data/spec/{acceptance → integrations}/posts_spec.rb +60 -33
- data/spec/spec_helper.rb +2 -0
- data/vendor/assets/stylesheets/postmarkdown/postmarkdown.css +2 -0
- metadata +94 -28
- data/todo.txt +0 -25
data/Appraisals
CHANGED
@@ -21,7 +21,17 @@ class PostsController < ApplicationController
|
|
21
21
|
helper_method :resource
|
22
22
|
|
23
23
|
def collection
|
24
|
-
@collection ||=
|
24
|
+
@collection ||= begin
|
25
|
+
posts = Post.where(params.slice(:year, :month, :day))
|
26
|
+
posts = Kaminari.paginate_array(posts).page(params[:page]).per(posts_per_page)
|
27
|
+
posts
|
28
|
+
end
|
25
29
|
end
|
26
30
|
helper_method :collection
|
31
|
+
|
32
|
+
private
|
33
|
+
|
34
|
+
def posts_per_page
|
35
|
+
params[:count] || Postmarkdown::Config.options[:posts_per_page]
|
36
|
+
end
|
27
37
|
end
|
data/app/models/post.rb
CHANGED
@@ -3,8 +3,9 @@
|
|
3
3
|
%h1= link_to post.title, post
|
4
4
|
= image_tag post.gravatar_url(:size => 32, :default => 'identicon'), :height => 32, :width => 32
|
5
5
|
.meta
|
6
|
+
Posted on
|
6
7
|
%time{:pubdate => 'true', :datetime => post.timestamp.iso8601}
|
7
|
-
|
8
|
+
= post.date.strftime '%e %B %Y'
|
8
9
|
%span
|
9
10
|
by
|
10
11
|
= post.author
|
data/lib/postmarkdown/config.rb
CHANGED
@@ -11,6 +11,8 @@ Postmarkdown::Config.options[:feed_title] = nil
|
|
11
11
|
|
12
12
|
Postmarkdown::Config.options[:permalink_format] = :day
|
13
13
|
|
14
|
+
Postmarkdown::Config.options[:posts_per_page] = 5
|
15
|
+
|
14
16
|
Postmarkdown::Config.options[:use_theme] = false
|
15
17
|
|
16
18
|
Postmarkdown::Config.options[:permalink_regex] = {}
|
data/lib/postmarkdown/engine.rb
CHANGED
data/lib/postmarkdown/version.rb
CHANGED
data/postmarkdown.gemspec
CHANGED
data/readme.md
CHANGED
@@ -137,6 +137,16 @@ What about mapping Postmarkdown to root? We got you covered:
|
|
137
137
|
* Syntax highlighting for code blocks
|
138
138
|
* Generated routes should show example usage
|
139
139
|
* Support more file formats, eg. textile
|
140
|
+
* Built-in theme should have a link to the RSS Feed
|
141
|
+
* Generator tests
|
142
|
+
|
143
|
+
## Development
|
144
|
+
|
145
|
+
```
|
146
|
+
bundle
|
147
|
+
rake appraisal:install
|
148
|
+
rake # run the tests
|
149
|
+
```
|
140
150
|
|
141
151
|
## License
|
142
152
|
|
@@ -9,39 +9,66 @@ describe 'Post views', :type => :request do
|
|
9
9
|
after { back_to_the_present }
|
10
10
|
|
11
11
|
context 'Posts#index' do
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
12
|
+
context 'default index' do
|
13
|
+
before { visit posts_path }
|
14
|
+
|
15
|
+
it 'should show published posts' do
|
16
|
+
# 2011-05-01-full-metadata (published today)
|
17
|
+
page.should have_content('Post with full metadata') # title
|
18
|
+
page.should have_content('Posted on 1 May 2011') # publish date
|
19
|
+
page.should have_content('by John Smith') # author
|
20
|
+
page.should have_content('This is another custom & test summary.') # summary
|
21
|
+
|
22
|
+
# 2011-04-28-summary
|
23
|
+
page.should have_content('A Test Post') # title
|
24
|
+
page.should have_content('Posted on 28 April 2011') # publish date
|
25
|
+
page.should have_content('This is a custom & test summary.') # summary
|
26
|
+
|
27
|
+
# 2011-04-28-image
|
28
|
+
page.should have_content('Image') # title
|
29
|
+
page.should have_content('Posted on 28 April 2011') # publish date
|
30
|
+
page.should have_content('Image description.') # summary
|
31
|
+
|
32
|
+
# 2011-04-01-first-post
|
33
|
+
page.should have_content('First Post') # title
|
34
|
+
page.should have_content('Posted on 1 April 2011') # publish date
|
35
|
+
page.should have_content('Lorem ipsum dolor sit amet') # part of summary
|
36
|
+
end
|
37
|
+
|
38
|
+
it 'should not show unpublished posts' do
|
39
|
+
# 2015-02-13-custom-title (not published yet)
|
40
|
+
page.should_not have_content('This is a custom title') # title
|
41
|
+
page.should_not have_content('Content goes here.') # summary
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'should have the correct number of posts' do
|
45
|
+
all('section#posts article.post').size.should == 4
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
describe 'pagination' do
|
50
|
+
def article_titles
|
51
|
+
all('article header h1').map(&:text)
|
52
|
+
end
|
53
|
+
|
54
|
+
before do
|
55
|
+
visit posts_path(:count => 2)
|
56
|
+
end
|
57
|
+
|
58
|
+
it 'returns the latest posts on the first page' do
|
59
|
+
article_titles.should eq [
|
60
|
+
'Post with full metadata',
|
61
|
+
'A Test Post',
|
62
|
+
]
|
63
|
+
end
|
64
|
+
|
65
|
+
it 'returns earlier posts on the second page' do
|
66
|
+
click_link 'Next'
|
67
|
+
article_titles.should eq [
|
68
|
+
'Image',
|
69
|
+
'First Post',
|
70
|
+
]
|
71
|
+
end
|
45
72
|
end
|
46
73
|
end
|
47
74
|
|
data/spec/spec_helper.rb
CHANGED
@@ -63,5 +63,7 @@ section#content article header h1{}
|
|
63
63
|
section#content article header img{display:none;}
|
64
64
|
section#content article header .meta{color:#999;font-size:12px;}
|
65
65
|
|
66
|
+
nav.pagination{margin-bottom:20px;}
|
67
|
+
|
66
68
|
/* -- Footer ---------------------------------------------------------------- */
|
67
69
|
footer{margin-bottom:20px;}
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: postmarkdown
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -12,11 +12,11 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2012-
|
15
|
+
date: 2012-08-24 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: rails
|
19
|
-
requirement:
|
19
|
+
requirement: !ruby/object:Gem::Requirement
|
20
20
|
none: false
|
21
21
|
requirements:
|
22
22
|
- - ~>
|
@@ -24,10 +24,15 @@ dependencies:
|
|
24
24
|
version: '3.0'
|
25
25
|
type: :runtime
|
26
26
|
prerelease: false
|
27
|
-
version_requirements:
|
27
|
+
version_requirements: !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ~>
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '3.0'
|
28
33
|
- !ruby/object:Gem::Dependency
|
29
34
|
name: haml
|
30
|
-
requirement:
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
31
36
|
none: false
|
32
37
|
requirements:
|
33
38
|
- - ~>
|
@@ -35,10 +40,15 @@ dependencies:
|
|
35
40
|
version: '3.1'
|
36
41
|
type: :runtime
|
37
42
|
prerelease: false
|
38
|
-
version_requirements:
|
43
|
+
version_requirements: !ruby/object:Gem::Requirement
|
44
|
+
none: false
|
45
|
+
requirements:
|
46
|
+
- - ~>
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '3.1'
|
39
49
|
- !ruby/object:Gem::Dependency
|
40
50
|
name: gravtastic
|
41
|
-
requirement:
|
51
|
+
requirement: !ruby/object:Gem::Requirement
|
42
52
|
none: false
|
43
53
|
requirements:
|
44
54
|
- - ! '>='
|
@@ -46,10 +56,15 @@ dependencies:
|
|
46
56
|
version: '0'
|
47
57
|
type: :runtime
|
48
58
|
prerelease: false
|
49
|
-
version_requirements:
|
59
|
+
version_requirements: !ruby/object:Gem::Requirement
|
60
|
+
none: false
|
61
|
+
requirements:
|
62
|
+
- - ! '>='
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: '0'
|
50
65
|
- !ruby/object:Gem::Dependency
|
51
66
|
name: nokogiri
|
52
|
-
requirement:
|
67
|
+
requirement: !ruby/object:Gem::Requirement
|
53
68
|
none: false
|
54
69
|
requirements:
|
55
70
|
- - ! '>='
|
@@ -57,10 +72,15 @@ dependencies:
|
|
57
72
|
version: '0'
|
58
73
|
type: :runtime
|
59
74
|
prerelease: false
|
60
|
-
version_requirements:
|
75
|
+
version_requirements: !ruby/object:Gem::Requirement
|
76
|
+
none: false
|
77
|
+
requirements:
|
78
|
+
- - ! '>='
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: '0'
|
61
81
|
- !ruby/object:Gem::Dependency
|
62
82
|
name: rdiscount
|
63
|
-
requirement:
|
83
|
+
requirement: !ruby/object:Gem::Requirement
|
64
84
|
none: false
|
65
85
|
requirements:
|
66
86
|
- - ! '>='
|
@@ -68,10 +88,31 @@ dependencies:
|
|
68
88
|
version: '0'
|
69
89
|
type: :runtime
|
70
90
|
prerelease: false
|
71
|
-
version_requirements:
|
91
|
+
version_requirements: !ruby/object:Gem::Requirement
|
92
|
+
none: false
|
93
|
+
requirements:
|
94
|
+
- - ! '>='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: kaminari
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
none: false
|
101
|
+
requirements:
|
102
|
+
- - ! '>='
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '0'
|
105
|
+
type: :runtime
|
106
|
+
prerelease: false
|
107
|
+
version_requirements: !ruby/object:Gem::Requirement
|
108
|
+
none: false
|
109
|
+
requirements:
|
110
|
+
- - ! '>='
|
111
|
+
- !ruby/object:Gem::Version
|
112
|
+
version: '0'
|
72
113
|
- !ruby/object:Gem::Dependency
|
73
114
|
name: appraisal
|
74
|
-
requirement:
|
115
|
+
requirement: !ruby/object:Gem::Requirement
|
75
116
|
none: false
|
76
117
|
requirements:
|
77
118
|
- - ! '>='
|
@@ -79,10 +120,15 @@ dependencies:
|
|
79
120
|
version: '0'
|
80
121
|
type: :development
|
81
122
|
prerelease: false
|
82
|
-
version_requirements:
|
123
|
+
version_requirements: !ruby/object:Gem::Requirement
|
124
|
+
none: false
|
125
|
+
requirements:
|
126
|
+
- - ! '>='
|
127
|
+
- !ruby/object:Gem::Version
|
128
|
+
version: '0'
|
83
129
|
- !ruby/object:Gem::Dependency
|
84
130
|
name: rspec-rails
|
85
|
-
requirement:
|
131
|
+
requirement: !ruby/object:Gem::Requirement
|
86
132
|
none: false
|
87
133
|
requirements:
|
88
134
|
- - ~>
|
@@ -90,10 +136,15 @@ dependencies:
|
|
90
136
|
version: '2.5'
|
91
137
|
type: :development
|
92
138
|
prerelease: false
|
93
|
-
version_requirements:
|
139
|
+
version_requirements: !ruby/object:Gem::Requirement
|
140
|
+
none: false
|
141
|
+
requirements:
|
142
|
+
- - ~>
|
143
|
+
- !ruby/object:Gem::Version
|
144
|
+
version: '2.5'
|
94
145
|
- !ruby/object:Gem::Dependency
|
95
146
|
name: capybara
|
96
|
-
requirement:
|
147
|
+
requirement: !ruby/object:Gem::Requirement
|
97
148
|
none: false
|
98
149
|
requirements:
|
99
150
|
- - ~>
|
@@ -101,10 +152,15 @@ dependencies:
|
|
101
152
|
version: 1.0.0.beta
|
102
153
|
type: :development
|
103
154
|
prerelease: false
|
104
|
-
version_requirements:
|
155
|
+
version_requirements: !ruby/object:Gem::Requirement
|
156
|
+
none: false
|
157
|
+
requirements:
|
158
|
+
- - ~>
|
159
|
+
- !ruby/object:Gem::Version
|
160
|
+
version: 1.0.0.beta
|
105
161
|
- !ruby/object:Gem::Dependency
|
106
162
|
name: sqlite3
|
107
|
-
requirement:
|
163
|
+
requirement: !ruby/object:Gem::Requirement
|
108
164
|
none: false
|
109
165
|
requirements:
|
110
166
|
- - ! '>='
|
@@ -112,10 +168,15 @@ dependencies:
|
|
112
168
|
version: '0'
|
113
169
|
type: :development
|
114
170
|
prerelease: false
|
115
|
-
version_requirements:
|
171
|
+
version_requirements: !ruby/object:Gem::Requirement
|
172
|
+
none: false
|
173
|
+
requirements:
|
174
|
+
- - ! '>='
|
175
|
+
- !ruby/object:Gem::Version
|
176
|
+
version: '0'
|
116
177
|
- !ruby/object:Gem::Dependency
|
117
178
|
name: delorean
|
118
|
-
requirement:
|
179
|
+
requirement: !ruby/object:Gem::Requirement
|
119
180
|
none: false
|
120
181
|
requirements:
|
121
182
|
- - ! '>='
|
@@ -123,7 +184,12 @@ dependencies:
|
|
123
184
|
version: '0.2'
|
124
185
|
type: :development
|
125
186
|
prerelease: false
|
126
|
-
version_requirements:
|
187
|
+
version_requirements: !ruby/object:Gem::Requirement
|
188
|
+
none: false
|
189
|
+
requirements:
|
190
|
+
- - ! '>='
|
191
|
+
- !ruby/object:Gem::Version
|
192
|
+
version: '0.2'
|
127
193
|
description: A simple Rails blog engine powered by markdown.
|
128
194
|
email:
|
129
195
|
- jason.weathered@ennova.com.au
|
@@ -152,6 +218,7 @@ files:
|
|
152
218
|
- config.ru
|
153
219
|
- gemfiles/rails3_0.gemfile
|
154
220
|
- gemfiles/rails3_1.gemfile
|
221
|
+
- gemfiles/rails3_2.gemfile
|
155
222
|
- lib/generators/postmarkdown/install_generator.rb
|
156
223
|
- lib/generators/postmarkdown/override_generator.rb
|
157
224
|
- lib/generators/postmarkdown/post_generator.rb
|
@@ -168,7 +235,7 @@ files:
|
|
168
235
|
- lib/postmarkdown/version.rb
|
169
236
|
- postmarkdown.gemspec
|
170
237
|
- readme.md
|
171
|
-
- spec/
|
238
|
+
- spec/integrations/posts_spec.rb
|
172
239
|
- spec/internal/.gitignore
|
173
240
|
- spec/internal/app/posts/2011-04-01-first-post.markdown
|
174
241
|
- spec/internal/app/posts/2011-04-28-image.markdown
|
@@ -206,7 +273,6 @@ files:
|
|
206
273
|
- spec/support/rails_app/config/routes.rb
|
207
274
|
- spec/support/rails_app/db/seeds.rb
|
208
275
|
- spec/support/rails_app/doc/README_FOR_APP
|
209
|
-
- todo.txt
|
210
276
|
- vendor/assets/stylesheets/postmarkdown/postmarkdown.css
|
211
277
|
homepage: ''
|
212
278
|
licenses:
|
@@ -224,7 +290,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
224
290
|
version: '0'
|
225
291
|
segments:
|
226
292
|
- 0
|
227
|
-
hash: -
|
293
|
+
hash: -4469381754881994462
|
228
294
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
229
295
|
none: false
|
230
296
|
requirements:
|
@@ -233,15 +299,15 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
233
299
|
version: '0'
|
234
300
|
segments:
|
235
301
|
- 0
|
236
|
-
hash: -
|
302
|
+
hash: -4469381754881994462
|
237
303
|
requirements: []
|
238
304
|
rubyforge_project: postmarkdown
|
239
|
-
rubygems_version: 1.8.
|
305
|
+
rubygems_version: 1.8.23
|
240
306
|
signing_key:
|
241
307
|
specification_version: 3
|
242
308
|
summary: A simple Rails blog engine powered by markdown.
|
243
309
|
test_files:
|
244
|
-
- spec/
|
310
|
+
- spec/integrations/posts_spec.rb
|
245
311
|
- spec/internal/.gitignore
|
246
312
|
- spec/internal/app/posts/2011-04-01-first-post.markdown
|
247
313
|
- spec/internal/app/posts/2011-04-28-image.markdown
|
data/todo.txt
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
TODO
|
2
|
-
----
|
3
|
-
[ ] Pagination
|
4
|
-
[ ] Built-in theme should have a link to the RSS Feed
|
5
|
-
[ ] Generator tests
|
6
|
-
|
7
|
-
DONE
|
8
|
-
----
|
9
|
-
[x] Route: `postmarkdown :permalink_format => :slug`</del>
|
10
|
-
[x] Add info about blog at root to readme</del>
|
11
|
-
[x] RSpec tests for routes</del>
|
12
|
-
[x] Support more markdown file extensions, eg. `*.md, *.mkd, *.mdown`</del>
|
13
|
-
[x] Text for when there's no posts on the index page, eg. 'There are no posts'</del>
|
14
|
-
[x] Fix pre code blocks</del>
|
15
|
-
[x] RSpec model tests for author and email</del>
|
16
|
-
[x] Set default feed title to app name + route path</del>
|
17
|
-
[x] For example, `TestApp::Application` with the route `postmarkdown :as => :awesome_blog` would generate the feed title would be 'Test App Awesome Blog'</del>
|
18
|
-
[x] RSpec acceptance test for pre code blocks (= vs ~)
|
19
|
-
[x] RSpec tests for the xml feed
|
20
|
-
[x] 404 for missing post or invalid slug
|
21
|
-
[x] Add post author to feed
|
22
|
-
[x] Better example post
|
23
|
-
[x] Generator automagically figures out who the author is based on git config
|
24
|
-
[x] Default theme
|
25
|
-
[x] Config option for using built-in theme
|