mojombo-jekyll 0.5.1 → 0.5.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +6 -0
- data/History.txt +17 -1
- data/README.textile +2 -1
- data/Rakefile +2 -2
- data/VERSION.yml +1 -1
- data/bin/jekyll +10 -0
- data/features/create_sites.feature +46 -0
- data/features/embed_filters.feature +60 -0
- data/features/pagination.feature +40 -0
- data/features/permalinks.feature +63 -0
- data/features/post_data.feature +153 -0
- data/features/site_configuration.feature +63 -0
- data/features/site_data.feature +82 -0
- data/features/step_definitions/jekyll_steps.rb +136 -0
- data/features/support/env.rb +16 -0
- data/jekyll.gemspec +134 -0
- data/lib/jekyll.rb +6 -4
- data/lib/jekyll/convertible.rb +6 -4
- data/lib/jekyll/core_ext.rb +9 -1
- data/lib/jekyll/page.rb +58 -13
- data/lib/jekyll/pager.rb +45 -0
- data/lib/jekyll/post.rb +24 -16
- data/lib/jekyll/site.rb +41 -12
- data/test/helper.rb +1 -1
- data/test/source/_posts/2009-05-18-tag.textile +6 -0
- data/test/source/_posts/2009-05-18-tags.textile +9 -0
- data/test/source/_posts/2009-06-22-empty-yaml.textile +3 -0
- data/test/source/_posts/2009-06-22-no-yaml.textile +1 -0
- data/test/source/about.html +6 -0
- data/test/source/contacts.html +5 -0
- data/test/source/win/_posts/2009-05-24-yaml-linebreak.markdown +7 -0
- data/test/test_configuration.rb +29 -0
- data/test/test_generated_site.rb +7 -5
- data/test/test_page.rb +87 -0
- data/test/test_pager.rb +47 -0
- data/test/test_post.rb +37 -4
- data/test/test_site.rb +21 -1
- metadata +31 -6
data/test/test_generated_site.rb
CHANGED
@@ -17,11 +17,8 @@ class TestGeneratedSite < Test::Unit::TestCase
|
|
17
17
|
assert @index.include?("#{@site.posts.size} Posts")
|
18
18
|
end
|
19
19
|
|
20
|
-
should "render post
|
21
|
-
|
22
|
-
post = Post.new(@site, source_dir, '', File.basename(latest_post))
|
23
|
-
post.transform
|
24
|
-
assert @index.include?(post.content)
|
20
|
+
should "render latest post's content" do
|
21
|
+
assert @index.include?(@site.posts.last.content)
|
25
22
|
end
|
26
23
|
|
27
24
|
should "hide unpublished posts" do
|
@@ -34,5 +31,10 @@ class TestGeneratedSite < Test::Unit::TestCase
|
|
34
31
|
should "not copy _posts directory" do
|
35
32
|
assert !File.exist?(dest_dir('_posts'))
|
36
33
|
end
|
34
|
+
|
35
|
+
should "process other static files and generate correct permalinks" do
|
36
|
+
assert File.exists?(dest_dir('/about/index.html'))
|
37
|
+
assert File.exists?(dest_dir('/contacts.html'))
|
38
|
+
end
|
37
39
|
end
|
38
40
|
end
|
data/test/test_page.rb
ADDED
@@ -0,0 +1,87 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/helper'
|
2
|
+
|
3
|
+
class TestPage < Test::Unit::TestCase
|
4
|
+
def setup_page(file)
|
5
|
+
@page = Page.new(@site, source_dir, '', file)
|
6
|
+
end
|
7
|
+
|
8
|
+
def do_render(page)
|
9
|
+
layouts = { "default" => Layout.new(@site, source_dir('_layouts'), "simple.html")}
|
10
|
+
page.render(layouts, {"site" => {"posts" => []}})
|
11
|
+
end
|
12
|
+
|
13
|
+
context "A Page" do
|
14
|
+
setup do
|
15
|
+
clear_dest
|
16
|
+
stub(Jekyll).configuration { Jekyll::DEFAULTS }
|
17
|
+
@site = Site.new(Jekyll.configuration)
|
18
|
+
end
|
19
|
+
|
20
|
+
context "processing pages" do
|
21
|
+
should "create url based on filename" do
|
22
|
+
@page = setup_page('contacts.html')
|
23
|
+
assert_equal "/contacts.html", @page.url
|
24
|
+
end
|
25
|
+
|
26
|
+
context "with pretty url style" do
|
27
|
+
setup do
|
28
|
+
@site.permalink_style = :pretty
|
29
|
+
end
|
30
|
+
|
31
|
+
should "return dir correctly" do
|
32
|
+
@page = setup_page('contacts.html')
|
33
|
+
assert_equal '/contacts/', @page.dir
|
34
|
+
end
|
35
|
+
|
36
|
+
should "return dir correctly for index page" do
|
37
|
+
@page = setup_page('index.html')
|
38
|
+
assert_equal '/', @page.dir
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
context "with any other url style" do
|
43
|
+
should "return dir correctly" do
|
44
|
+
@site.permalink_style = nil
|
45
|
+
@page = setup_page('contacts.html')
|
46
|
+
assert_equal '/', @page.dir
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
should "respect permalink in yaml front matter" do
|
51
|
+
file = "about.html"
|
52
|
+
@page = setup_page(file)
|
53
|
+
|
54
|
+
assert_equal "/about/", @page.permalink
|
55
|
+
assert_equal @page.permalink, @page.url
|
56
|
+
assert_equal "/about/", @page.dir
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
context "rendering" do
|
61
|
+
setup do
|
62
|
+
clear_dest
|
63
|
+
end
|
64
|
+
|
65
|
+
should "write properly" do
|
66
|
+
page = setup_page('contacts.html')
|
67
|
+
do_render(page)
|
68
|
+
page.write(dest_dir)
|
69
|
+
|
70
|
+
assert File.directory?(dest_dir)
|
71
|
+
assert File.exists?(File.join(dest_dir, 'contacts.html'))
|
72
|
+
end
|
73
|
+
|
74
|
+
should "write properly without html extension" do
|
75
|
+
page = setup_page('contacts.html')
|
76
|
+
page.site.permalink_style = :pretty
|
77
|
+
do_render(page)
|
78
|
+
page.write(dest_dir)
|
79
|
+
|
80
|
+
assert File.directory?(dest_dir)
|
81
|
+
assert File.exists?(File.join(dest_dir, 'contacts', 'index.html'))
|
82
|
+
end
|
83
|
+
|
84
|
+
end
|
85
|
+
|
86
|
+
end
|
87
|
+
end
|
data/test/test_pager.rb
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/helper'
|
2
|
+
|
3
|
+
class TestPager < Test::Unit::TestCase
|
4
|
+
context "pagination enabled" do
|
5
|
+
setup do
|
6
|
+
stub(Jekyll).configuration do
|
7
|
+
Jekyll::DEFAULTS.merge({
|
8
|
+
'source' => source_dir,
|
9
|
+
'destination' => dest_dir,
|
10
|
+
'paginate' => 2
|
11
|
+
})
|
12
|
+
end
|
13
|
+
|
14
|
+
@config = Jekyll.configuration
|
15
|
+
@site = Site.new(@config)
|
16
|
+
@posts = @site.read_posts('')
|
17
|
+
end
|
18
|
+
|
19
|
+
should "calculate number of pages" do
|
20
|
+
assert_equal(2, Pager.calculate_pages(@posts, @config['paginate']))
|
21
|
+
end
|
22
|
+
|
23
|
+
should "create first pager" do
|
24
|
+
pager = Pager.new(@config, 1, @posts)
|
25
|
+
assert_equal(@config['paginate'].to_i, pager.posts.size)
|
26
|
+
assert_equal(2, pager.total_pages)
|
27
|
+
assert_nil(pager.previous_page)
|
28
|
+
assert_equal(2, pager.next_page)
|
29
|
+
end
|
30
|
+
|
31
|
+
should "create second pager" do
|
32
|
+
pager = Pager.new(@config, 2, @posts)
|
33
|
+
assert_equal(@posts.size - @config['paginate'].to_i, pager.posts.size)
|
34
|
+
assert_equal(2, pager.total_pages)
|
35
|
+
assert_equal(1, pager.previous_page)
|
36
|
+
assert_nil(pager.next_page)
|
37
|
+
end
|
38
|
+
|
39
|
+
should "not create third pager" do
|
40
|
+
assert_raise(RuntimeError) { Pager.new(@config, 3, @posts) }
|
41
|
+
end
|
42
|
+
|
43
|
+
should "report that pagination is enabled" do
|
44
|
+
assert Pager.pagination_enabled?(@config, 'index.html')
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
data/test/test_post.rb
CHANGED
@@ -25,7 +25,6 @@ class TestPost < Test::Unit::TestCase
|
|
25
25
|
assert !Post.valid?("blah")
|
26
26
|
end
|
27
27
|
|
28
|
-
|
29
28
|
context "processing posts" do
|
30
29
|
setup do
|
31
30
|
@post = Post.allocate
|
@@ -69,6 +68,19 @@ class TestPost < Test::Unit::TestCase
|
|
69
68
|
assert_equal "my_category/permalinked-post", @post.url
|
70
69
|
end
|
71
70
|
|
71
|
+
context "with CRLF linebreaks" do
|
72
|
+
setup do
|
73
|
+
@real_file = "2009-05-24-yaml-linebreak.markdown"
|
74
|
+
@source = source_dir('win/_posts')
|
75
|
+
end
|
76
|
+
should "read yaml front-matter" do
|
77
|
+
@post.read_yaml(@source, @real_file)
|
78
|
+
|
79
|
+
assert_equal({"title" => "Test title", "layout" => "post", "tag" => "Ruby"}, @post.data)
|
80
|
+
assert_equal "\r\nThis is the content", @post.content
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
72
84
|
context "with site wide permalink" do
|
73
85
|
setup do
|
74
86
|
@post.categories = []
|
@@ -129,8 +141,8 @@ class TestPost < Test::Unit::TestCase
|
|
129
141
|
end
|
130
142
|
|
131
143
|
should "process the url correctly" do
|
132
|
-
assert_equal "/:categories/:year/:month/:day/:title", @post.template
|
133
|
-
assert_equal "/2008/10/19/foo-bar", @post.url
|
144
|
+
assert_equal "/:categories/:year/:month/:day/:title/", @post.template
|
145
|
+
assert_equal "/2008/10/19/foo-bar/", @post.url
|
134
146
|
end
|
135
147
|
end
|
136
148
|
|
@@ -212,6 +224,28 @@ class TestPost < Test::Unit::TestCase
|
|
212
224
|
assert post.categories.include?('baz')
|
213
225
|
end
|
214
226
|
|
227
|
+
should "recognize tag in yaml" do
|
228
|
+
post = setup_post("2009-05-18-tag.textile")
|
229
|
+
assert post.tags.include?('code')
|
230
|
+
end
|
231
|
+
|
232
|
+
should "recognize tags in yaml" do
|
233
|
+
post = setup_post("2009-05-18-tags.textile")
|
234
|
+
assert post.tags.include?('food')
|
235
|
+
assert post.tags.include?('cooking')
|
236
|
+
assert post.tags.include?('pizza')
|
237
|
+
end
|
238
|
+
|
239
|
+
should "allow no yaml" do
|
240
|
+
post = setup_post("2009-06-22-no-yaml.textile")
|
241
|
+
assert_equal "No YAML.", post.content
|
242
|
+
end
|
243
|
+
|
244
|
+
should "allow empty yaml" do
|
245
|
+
post = setup_post("2009-06-22-empty-yaml.textile")
|
246
|
+
assert_equal "Empty YAML.", post.content
|
247
|
+
end
|
248
|
+
|
215
249
|
context "rendering" do
|
216
250
|
setup do
|
217
251
|
clear_dest
|
@@ -262,7 +296,6 @@ class TestPost < Test::Unit::TestCase
|
|
262
296
|
should "generate categories and topics" do
|
263
297
|
post = Post.new(@site, File.join(File.dirname(__FILE__), *%w[source]), 'foo', 'bar/2008-12-12-topical-post.textile')
|
264
298
|
assert_equal ['foo'], post.categories
|
265
|
-
assert_equal ['bar'], post.topics
|
266
299
|
end
|
267
300
|
|
268
301
|
end
|
data/test/test_site.rb
CHANGED
@@ -9,6 +9,10 @@ class TestSite < Test::Unit::TestCase
|
|
9
9
|
@site = Site.new(Jekyll.configuration)
|
10
10
|
end
|
11
11
|
|
12
|
+
should "have an empty tag hash by default" do
|
13
|
+
assert_equal Hash.new, @site.tags
|
14
|
+
end
|
15
|
+
|
12
16
|
should "reset data before processing" do
|
13
17
|
clear_dest
|
14
18
|
@site.process
|
@@ -38,7 +42,7 @@ class TestSite < Test::Unit::TestCase
|
|
38
42
|
@site.process
|
39
43
|
|
40
44
|
posts = Dir[source_dir("**", "_posts", "*")]
|
41
|
-
categories = %w(bar baz category foo z_category publish_test).sort
|
45
|
+
categories = %w(bar baz category foo z_category publish_test win).sort
|
42
46
|
|
43
47
|
assert_equal posts.size - 1, @site.posts.size
|
44
48
|
assert_equal categories, @site.categories.keys.sort
|
@@ -61,5 +65,21 @@ class TestSite < Test::Unit::TestCase
|
|
61
65
|
@site.exclude = excludes
|
62
66
|
assert_equal includes, @site.filter_entries(excludes + includes)
|
63
67
|
end
|
68
|
+
|
69
|
+
context 'with an invalid markdown processor in the configuration' do
|
70
|
+
|
71
|
+
should 'give a meaningful error message' do
|
72
|
+
bad_processor = 'not a processor name'
|
73
|
+
begin
|
74
|
+
Site.new(Jekyll.configuration.merge({ 'markdown' => bad_processor }))
|
75
|
+
flunk 'Invalid markdown processors should cause a failure on site creation'
|
76
|
+
rescue RuntimeError => e
|
77
|
+
assert e.to_s =~ /invalid|bad/i
|
78
|
+
assert e.to_s =~ %r{#{bad_processor}}
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
end
|
83
|
+
|
64
84
|
end
|
65
85
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mojombo-jekyll
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tom Preston-Werner
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-06-24 00:00:00 -07:00
|
13
13
|
default_executable: jekyll
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -18,9 +18,9 @@ dependencies:
|
|
18
18
|
version_requirement:
|
19
19
|
version_requirements: !ruby/object:Gem::Requirement
|
20
20
|
requirements:
|
21
|
-
- - "
|
21
|
+
- - ">="
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version: 4.1
|
23
|
+
version: 4.2.1
|
24
24
|
version:
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: liquid
|
@@ -81,11 +81,22 @@ extensions: []
|
|
81
81
|
extra_rdoc_files:
|
82
82
|
- README.textile
|
83
83
|
files:
|
84
|
+
- .gitignore
|
84
85
|
- History.txt
|
85
86
|
- README.textile
|
86
87
|
- Rakefile
|
87
88
|
- VERSION.yml
|
88
89
|
- bin/jekyll
|
90
|
+
- features/create_sites.feature
|
91
|
+
- features/embed_filters.feature
|
92
|
+
- features/pagination.feature
|
93
|
+
- features/permalinks.feature
|
94
|
+
- features/post_data.feature
|
95
|
+
- features/site_configuration.feature
|
96
|
+
- features/site_data.feature
|
97
|
+
- features/step_definitions/jekyll_steps.rb
|
98
|
+
- features/support/env.rb
|
99
|
+
- jekyll.gemspec
|
89
100
|
- lib/jekyll.rb
|
90
101
|
- lib/jekyll/albino.rb
|
91
102
|
- lib/jekyll/converters/csv.rb
|
@@ -99,6 +110,7 @@ files:
|
|
99
110
|
- lib/jekyll/filters.rb
|
100
111
|
- lib/jekyll/layout.rb
|
101
112
|
- lib/jekyll/page.rb
|
113
|
+
- lib/jekyll/pager.rb
|
102
114
|
- lib/jekyll/post.rb
|
103
115
|
- lib/jekyll/site.rb
|
104
116
|
- lib/jekyll/tags/highlight.rb
|
@@ -117,18 +129,28 @@ files:
|
|
117
129
|
- test/source/_posts/2009-01-27-categories.textile
|
118
130
|
- test/source/_posts/2009-01-27-category.textile
|
119
131
|
- test/source/_posts/2009-03-12-hash-#1.markdown
|
132
|
+
- test/source/_posts/2009-05-18-tag.textile
|
133
|
+
- test/source/_posts/2009-05-18-tags.textile
|
134
|
+
- test/source/_posts/2009-06-22-empty-yaml.textile
|
135
|
+
- test/source/_posts/2009-06-22-no-yaml.textile
|
136
|
+
- test/source/about.html
|
120
137
|
- test/source/category/_posts/2008-9-23-categories.textile
|
138
|
+
- test/source/contacts.html
|
121
139
|
- test/source/css/screen.css
|
122
140
|
- test/source/foo/_posts/bar/2008-12-12-topical-post.textile
|
123
141
|
- test/source/index.html
|
142
|
+
- test/source/win/_posts/2009-05-24-yaml-linebreak.markdown
|
124
143
|
- test/source/z_category/_posts/2008-9-23-categories.textile
|
125
144
|
- test/suite.rb
|
145
|
+
- test/test_configuration.rb
|
126
146
|
- test/test_filters.rb
|
127
147
|
- test/test_generated_site.rb
|
148
|
+
- test/test_page.rb
|
149
|
+
- test/test_pager.rb
|
128
150
|
- test/test_post.rb
|
129
151
|
- test/test_site.rb
|
130
152
|
- test/test_tags.rb
|
131
|
-
has_rdoc:
|
153
|
+
has_rdoc: false
|
132
154
|
homepage: http://github.com/mojombo/jekyll
|
133
155
|
post_install_message:
|
134
156
|
rdoc_options:
|
@@ -152,13 +174,16 @@ requirements: []
|
|
152
174
|
rubyforge_project: jekyll
|
153
175
|
rubygems_version: 1.2.0
|
154
176
|
signing_key:
|
155
|
-
specification_version:
|
177
|
+
specification_version: 3
|
156
178
|
summary: Jekyll is a simple, blog aware, static site generator.
|
157
179
|
test_files:
|
158
180
|
- test/helper.rb
|
159
181
|
- test/suite.rb
|
182
|
+
- test/test_configuration.rb
|
160
183
|
- test/test_filters.rb
|
161
184
|
- test/test_generated_site.rb
|
185
|
+
- test/test_page.rb
|
186
|
+
- test/test_pager.rb
|
162
187
|
- test/test_post.rb
|
163
188
|
- test/test_site.rb
|
164
189
|
- test/test_tags.rb
|