monad 0.0.2 → 0.0.3
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.
- checksums.yaml +7 -0
- data/CONTRIBUTING.markdown +91 -0
- data/Gemfile +1 -1
- data/History.markdown +772 -0
- data/{README.md → README.markdown} +5 -2
- data/Rakefile +163 -1
- data/bin/monad +86 -30
- data/features/create_sites.feature +54 -25
- data/features/data.feature +65 -0
- data/features/data_sources.feature +10 -10
- data/features/drafts.feature +5 -5
- data/features/embed_filters.feature +10 -10
- data/features/include_tag.feature +48 -0
- data/features/markdown.feature +5 -5
- data/features/pagination.feature +38 -10
- data/features/permalinks.feature +31 -11
- data/features/post_data.feature +41 -41
- data/features/post_excerpts.feature +50 -0
- data/features/site_configuration.feature +47 -26
- data/features/site_data.feature +30 -24
- data/features/step_definitions/{monad_steps.rb → jekyll_steps.rb} +66 -52
- data/features/support/env.rb +27 -8
- data/lib/jekyll.rb +99 -0
- data/lib/jekyll/cleaner.rb +73 -0
- data/lib/{monad → jekyll}/command.rb +6 -6
- data/lib/{monad → jekyll}/commands/build.rb +9 -9
- data/lib/jekyll/commands/doctor.rb +67 -0
- data/lib/jekyll/commands/new.rb +67 -0
- data/lib/jekyll/commands/serve.rb +65 -0
- data/lib/{monad → jekyll}/configuration.rb +60 -18
- data/lib/{monad → jekyll}/converter.rb +1 -1
- data/lib/{monad → jekyll}/converters/identity.rb +1 -1
- data/lib/{monad → jekyll}/converters/markdown.rb +2 -2
- data/lib/jekyll/converters/markdown/kramdown_parser.rb +29 -0
- data/lib/{monad → jekyll}/converters/markdown/maruku_parser.rb +12 -8
- data/lib/{monad → jekyll}/converters/markdown/rdiscount_parser.rb +4 -2
- data/lib/{monad → jekyll}/converters/markdown/redcarpet_parser.rb +1 -1
- data/lib/{monad → jekyll}/converters/textile.rb +1 -1
- data/lib/{monad → jekyll}/convertible.rb +39 -17
- data/lib/{monad → jekyll}/core_ext.rb +22 -4
- data/lib/jekyll/deprecator.rb +36 -0
- data/lib/{monad → jekyll}/draft.rb +1 -1
- data/lib/{monad → jekyll}/drivers/json_driver.rb +1 -1
- data/lib/{monad → jekyll}/drivers/yaml_driver.rb +1 -1
- data/lib/{monad → jekyll}/errors.rb +1 -1
- data/lib/jekyll/excerpt.rb +113 -0
- data/lib/{monad → jekyll}/filters.rb +16 -6
- data/lib/{monad → jekyll}/generator.rb +1 -1
- data/lib/jekyll/generators/pagination.rb +214 -0
- data/lib/{monad → jekyll}/layout.rb +4 -1
- data/lib/{monad → jekyll}/mime.types +0 -0
- data/lib/{monad → jekyll}/page.rb +36 -39
- data/lib/{monad → jekyll}/plugin.rb +1 -1
- data/lib/{monad → jekyll}/post.rb +58 -123
- data/lib/jekyll/related_posts.rb +59 -0
- data/lib/{monad → jekyll}/site.rb +120 -123
- data/lib/{monad → jekyll}/static_file.rb +1 -1
- data/lib/jekyll/stevenson.rb +89 -0
- data/lib/jekyll/tags/gist.rb +48 -0
- data/lib/{monad → jekyll}/tags/highlight.rb +3 -3
- data/lib/jekyll/tags/include.rb +135 -0
- data/lib/{monad → jekyll}/tags/post_url.rb +8 -6
- data/lib/jekyll/url.rb +67 -0
- data/lib/monad.rb +36 -27
- data/lib/site_template/_config.yml +2 -1
- data/lib/site_template/_layouts/default.html +21 -23
- data/lib/site_template/_layouts/post.html +1 -1
- data/lib/site_template/_posts/{0000-00-00-welcome-to-monad.markdown.erb → 0000-00-00-welcome-to-jekyll.markdown.erb} +6 -6
- data/lib/site_template/css/main.css +22 -27
- data/lib/site_template/index.html +2 -2
- data/monad.gemspec +153 -52
- data/site/.gitignore +4 -0
- data/site/CNAME +1 -0
- data/site/README +1 -0
- data/site/_config.yml +6 -0
- data/site/_includes/analytics.html +32 -0
- data/site/_includes/docs_contents.html +16 -0
- data/site/_includes/docs_contents_mobile.html +23 -0
- data/site/_includes/docs_option.html +11 -0
- data/site/_includes/docs_ul.html +20 -0
- data/site/_includes/footer.html +15 -0
- data/site/_includes/header.html +18 -0
- data/site/_includes/news_contents.html +23 -0
- data/site/_includes/news_contents_mobile.html +11 -0
- data/site/_includes/news_item.html +24 -0
- data/site/_includes/primary-nav-items.html +14 -0
- data/site/_includes/section_nav.html +22 -0
- data/site/_includes/top.html +17 -0
- data/site/_layouts/default.html +12 -0
- data/site/_layouts/docs.html +23 -0
- data/site/_layouts/news.html +19 -0
- data/site/_layouts/news_item.html +27 -0
- data/site/_posts/2013-05-06-jekyll-1-0-0-released.markdown +23 -0
- data/site/_posts/2013-05-08-jekyll-1-0-1-released.markdown +27 -0
- data/site/_posts/2013-05-12-jekyll-1-0-2-released.markdown +28 -0
- data/site/_posts/2013-06-07-jekyll-1-0-3-released.markdown +25 -0
- data/site/_posts/2013-07-14-jekyll-1-1-0-released.markdown +27 -0
- data/site/_posts/2013-07-24-jekyll-1-1-1-released.markdown +31 -0
- data/site/_posts/2013-07-25-jekyll-1-0-4-released.markdown +20 -0
- data/site/_posts/2013-07-25-jekyll-1-1-2-released.markdown +20 -0
- data/site/_posts/2013-09-06-jekyll-1-2-0-released.markdown +23 -0
- data/site/_posts/2013-09-14-jekyll-1-2-1-released.markdown +19 -0
- data/site/css/gridism.css +110 -0
- data/site/css/normalize.css +1 -0
- data/site/css/pygments.css +70 -0
- data/site/css/style.css +946 -0
- data/site/docs/configuration.md +373 -0
- data/site/docs/contributing.md +128 -0
- data/site/docs/datafiles.md +63 -0
- data/site/docs/deployment-methods.md +109 -0
- data/site/docs/drafts.md +20 -0
- data/site/docs/extras.md +56 -0
- data/site/docs/frontmatter.md +180 -0
- data/site/docs/github-pages.md +91 -0
- data/site/docs/heroku.md +9 -0
- data/site/docs/history.md +722 -0
- data/site/docs/index.md +52 -0
- data/site/docs/installation.md +76 -0
- data/site/docs/migrations.md +257 -0
- data/site/docs/pages.md +86 -0
- data/site/docs/pagination.md +211 -0
- data/site/docs/permalinks.md +180 -0
- data/site/docs/plugins.md +508 -0
- data/site/docs/posts.md +181 -0
- data/site/docs/quickstart.md +32 -0
- data/site/docs/resources.md +46 -0
- data/site/docs/sites.md +29 -0
- data/site/docs/structure.md +190 -0
- data/site/docs/templates.md +319 -0
- data/site/docs/troubleshooting.md +150 -0
- data/site/docs/upgrading.md +146 -0
- data/site/docs/usage.md +63 -0
- data/site/docs/variables.md +322 -0
- data/site/favicon.png +0 -0
- data/site/feed.xml +36 -0
- data/site/freenode.txt +1 -0
- data/site/img/article-footer.png +0 -0
- data/site/img/footer-arrow.png +0 -0
- data/site/img/footer-logo.png +0 -0
- data/site/img/logo-2x.png +0 -0
- data/site/img/octojekyll.png +0 -0
- data/site/img/tube.png +0 -0
- data/site/img/tube1x.png +0 -0
- data/site/index.html +90 -0
- data/site/js/modernizr-2.5.3.min.js +4 -0
- data/site/news/index.html +10 -0
- data/site/news/releases/index.html +10 -0
- data/test/helper.rb +6 -3
- data/test/source/+/foo.md +7 -0
- data/test/source/_data/languages.yml +2 -0
- data/test/source/_data/members.yaml +7 -0
- data/test/source/_data/products.yml +4 -0
- data/test/source/_includes/params.html +7 -0
- data/test/source/_layouts/default.html +1 -1
- data/test/source/_layouts/post/simple.html +1 -0
- data/test/source/_plugins/dummy.rb +1 -1
- data/test/source/_posts/2013-01-02-post-excerpt.markdown +1 -1
- data/test/source/_posts/2013-07-22-post-excerpt-with-layout.markdown +23 -0
- data/test/source/_posts/2013-08-01-mkdn-extension.mkdn +0 -0
- data/test/source/deal.with.dots.html +1 -1
- data/test/source/products.yml +4 -0
- data/test/test_configuration.rb +46 -11
- data/test/test_convertible.rb +2 -2
- data/test/test_excerpt.rb +78 -0
- data/test/test_filters.rb +4 -4
- data/test/test_generated_site.rb +13 -13
- data/test/test_json_driver.rb +9 -9
- data/test/test_kramdown.rb +32 -5
- data/test/test_new_command.rb +8 -8
- data/test/test_page.rb +12 -3
- data/test/test_pager.rb +34 -33
- data/test/test_post.rb +34 -26
- data/test/test_redcloth.rb +3 -3
- data/test/test_related_posts.rb +47 -0
- data/test/test_site.rb +102 -44
- data/test/test_tags.rb +168 -23
- data/test/test_url.rb +28 -0
- data/test/test_yaml_driver.rb +6 -6
- metadata +215 -137
- data/lib/monad/commands/doctor.rb +0 -29
- data/lib/monad/commands/new.rb +0 -50
- data/lib/monad/commands/serve.rb +0 -33
- data/lib/monad/converters/markdown/kramdown_parser.rb +0 -44
- data/lib/monad/deprecator.rb +0 -32
- data/lib/monad/generators/pagination.rb +0 -143
- data/lib/monad/logger.rb +0 -54
- data/lib/monad/tags/gist.rb +0 -30
- data/lib/monad/tags/include.rb +0 -37
data/test/test_post.rb
CHANGED
|
@@ -13,8 +13,8 @@ class TestPost < Test::Unit::TestCase
|
|
|
13
13
|
context "A Post" do
|
|
14
14
|
setup do
|
|
15
15
|
clear_dest
|
|
16
|
-
stub(
|
|
17
|
-
@site = Site.new(
|
|
16
|
+
stub(Jekyll).configuration { Jekyll::Configuration::DEFAULTS }
|
|
17
|
+
@site = Site.new(Jekyll.configuration)
|
|
18
18
|
end
|
|
19
19
|
|
|
20
20
|
should "ensure valid posts are valid" do
|
|
@@ -53,7 +53,7 @@ class TestPost < Test::Unit::TestCase
|
|
|
53
53
|
end
|
|
54
54
|
|
|
55
55
|
should "raise a good error on invalid post date" do
|
|
56
|
-
assert_raise
|
|
56
|
+
assert_raise Jekyll::FatalException do
|
|
57
57
|
@post.process("2009-27-03-foo-bar.textile")
|
|
58
58
|
end
|
|
59
59
|
end
|
|
@@ -139,7 +139,7 @@ class TestPost < Test::Unit::TestCase
|
|
|
139
139
|
assert_equal "/2013/2008/09/09/foo-bar.html", @post.url
|
|
140
140
|
end
|
|
141
141
|
end
|
|
142
|
-
|
|
142
|
+
|
|
143
143
|
context "with specified layout of nil" do
|
|
144
144
|
setup do
|
|
145
145
|
file = '2013-01-12-nil-layout.textile'
|
|
@@ -267,9 +267,10 @@ class TestPost < Test::Unit::TestCase
|
|
|
267
267
|
context "#excerpt" do
|
|
268
268
|
setup do
|
|
269
269
|
file = "2013-01-02-post-excerpt.markdown"
|
|
270
|
+
@post = setup_post(file)
|
|
270
271
|
@post.process(file)
|
|
271
272
|
@post.read_yaml(@source, file)
|
|
272
|
-
@post
|
|
273
|
+
do_render(@post)
|
|
273
274
|
end
|
|
274
275
|
|
|
275
276
|
should "return first paragraph by default" do
|
|
@@ -279,11 +280,11 @@ class TestPost < Test::Unit::TestCase
|
|
|
279
280
|
end
|
|
280
281
|
|
|
281
282
|
should "correctly resolve link references" do
|
|
282
|
-
assert @post.excerpt.include?("www.
|
|
283
|
+
assert @post.excerpt.include?("www.jekyllrb.com"), "contains referenced link URL"
|
|
283
284
|
end
|
|
284
285
|
|
|
285
286
|
should "return rendered HTML" do
|
|
286
|
-
assert_equal "<p>First paragraph with <a href='http://www.
|
|
287
|
+
assert_equal "<p>First paragraph with <a href='http://www.jekyllrb.com/'>link ref</a>.</p>",
|
|
287
288
|
@post.excerpt
|
|
288
289
|
end
|
|
289
290
|
|
|
@@ -332,8 +333,8 @@ class TestPost < Test::Unit::TestCase
|
|
|
332
333
|
context "when in a site" do
|
|
333
334
|
setup do
|
|
334
335
|
clear_dest
|
|
335
|
-
stub(
|
|
336
|
-
@site = Site.new(
|
|
336
|
+
stub(Jekyll).configuration { Jekyll::Configuration::DEFAULTS }
|
|
337
|
+
@site = Site.new(Jekyll.configuration)
|
|
337
338
|
@site.posts = [setup_post('2008-02-02-published.textile'),
|
|
338
339
|
setup_post('2009-01-27-categories.textile')]
|
|
339
340
|
end
|
|
@@ -422,7 +423,7 @@ class TestPost < Test::Unit::TestCase
|
|
|
422
423
|
post = setup_post("2009-01-27-empty-categories.textile")
|
|
423
424
|
assert_equal [], post.categories
|
|
424
425
|
end
|
|
425
|
-
|
|
426
|
+
|
|
426
427
|
should "recognize number category in yaml" do
|
|
427
428
|
post = setup_post("2013-05-10-number-category.textile")
|
|
428
429
|
assert post.categories.include?('2013')
|
|
@@ -440,7 +441,7 @@ class TestPost < Test::Unit::TestCase
|
|
|
440
441
|
assert post.tags.include?('cooking')
|
|
441
442
|
assert post.tags.include?('pizza')
|
|
442
443
|
end
|
|
443
|
-
|
|
444
|
+
|
|
444
445
|
should "recognize empty tag in yaml" do
|
|
445
446
|
post = setup_post("2009-05-18-empty-tag.textile")
|
|
446
447
|
assert_equal [], post.tags
|
|
@@ -528,46 +529,53 @@ class TestPost < Test::Unit::TestCase
|
|
|
528
529
|
assert_equal ['foo'], post.categories
|
|
529
530
|
end
|
|
530
531
|
end
|
|
531
|
-
|
|
532
|
+
|
|
532
533
|
context "converter file extension settings" do
|
|
533
534
|
setup do
|
|
534
|
-
stub(
|
|
535
|
-
@site = Site.new(
|
|
535
|
+
stub(Jekyll).configuration { Jekyll::Configuration::DEFAULTS }
|
|
536
|
+
@site = Site.new(Jekyll.configuration)
|
|
536
537
|
end
|
|
537
|
-
|
|
538
|
+
|
|
538
539
|
should "process .md as markdown under default configuration" do
|
|
539
540
|
post = setup_post '2011-04-12-md-extension.md'
|
|
540
541
|
conv = post.converter
|
|
541
|
-
assert conv.kind_of?
|
|
542
|
+
assert conv.kind_of? Jekyll::Converters::Markdown
|
|
542
543
|
end
|
|
543
|
-
|
|
544
|
+
|
|
544
545
|
should "process .text as identity under default configuration" do
|
|
545
546
|
post = setup_post '2011-04-12-text-extension.text'
|
|
546
547
|
conv = post.converter
|
|
547
|
-
assert conv.kind_of?
|
|
548
|
+
assert conv.kind_of? Jekyll::Converters::Identity
|
|
548
549
|
end
|
|
549
|
-
|
|
550
|
+
|
|
550
551
|
should "process .text as markdown under alternate configuration" do
|
|
551
552
|
@site.config['markdown_ext'] = 'markdown,mdw,mdwn,md,text'
|
|
552
553
|
post = setup_post '2011-04-12-text-extension.text'
|
|
553
554
|
conv = post.converter
|
|
554
|
-
assert conv.kind_of?
|
|
555
|
+
assert conv.kind_of? Jekyll::Converters::Markdown
|
|
555
556
|
end
|
|
556
|
-
|
|
557
|
+
|
|
557
558
|
should "process .md as markdown under alternate configuration" do
|
|
558
559
|
@site.config['markdown_ext'] = 'markdown,mkd,mkdn,md,text'
|
|
559
560
|
post = setup_post '2011-04-12-text-extension.text'
|
|
560
561
|
conv = post.converter
|
|
561
|
-
assert conv.kind_of?
|
|
562
|
+
assert conv.kind_of? Jekyll::Converters::Markdown
|
|
563
|
+
end
|
|
564
|
+
|
|
565
|
+
should "process .mkdn under text if it is not in the markdown config" do
|
|
566
|
+
@site.config['markdown_ext'] = 'markdown,mkd,md,text'
|
|
567
|
+
post = setup_post '2013-08-01-mkdn-extension.mkdn'
|
|
568
|
+
conv = post.converter
|
|
569
|
+
assert conv.kind_of? Jekyll::Converters::Identity
|
|
562
570
|
end
|
|
563
|
-
|
|
571
|
+
|
|
564
572
|
should "process .text as textile under alternate configuration" do
|
|
565
573
|
@site.config['textile_ext'] = 'textile,text'
|
|
566
574
|
post = setup_post '2011-04-12-text-extension.text'
|
|
567
575
|
conv = post.converter
|
|
568
|
-
assert conv.kind_of?
|
|
576
|
+
assert conv.kind_of? Jekyll::Converters::Textile
|
|
569
577
|
end
|
|
570
|
-
|
|
578
|
+
|
|
571
579
|
end
|
|
572
|
-
|
|
580
|
+
|
|
573
581
|
end
|
data/test/test_redcloth.rb
CHANGED
|
@@ -6,7 +6,7 @@ class TestRedCloth < Test::Unit::TestCase
|
|
|
6
6
|
setup do
|
|
7
7
|
@textile = Converters::Textile.new
|
|
8
8
|
end
|
|
9
|
-
|
|
9
|
+
|
|
10
10
|
should "preserve single line breaks in HTML output" do
|
|
11
11
|
assert_equal "<p>line1<br />\nline2</p>", @textile.convert("p. line1\nline2").strip
|
|
12
12
|
end
|
|
@@ -19,7 +19,7 @@ class TestRedCloth < Test::Unit::TestCase
|
|
|
19
19
|
}
|
|
20
20
|
@textile = Converters::Textile.new config
|
|
21
21
|
end
|
|
22
|
-
|
|
22
|
+
|
|
23
23
|
should "preserve single line breaks in HTML output" do
|
|
24
24
|
assert_equal "<p>line1<br />\nline2</p>", @textile.convert("p. line1\nline2").strip
|
|
25
25
|
end
|
|
@@ -34,7 +34,7 @@ class TestRedCloth < Test::Unit::TestCase
|
|
|
34
34
|
}
|
|
35
35
|
@textile = Converters::Textile.new config
|
|
36
36
|
end
|
|
37
|
-
|
|
37
|
+
|
|
38
38
|
should "preserve single line breaks in HTML output" do
|
|
39
39
|
assert_equal "<p>line1<br />\nline2</p>", @textile.convert("p. line1\nline2").strip
|
|
40
40
|
end
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
require 'helper'
|
|
2
|
+
|
|
3
|
+
class TestRelatedPosts < Test::Unit::TestCase
|
|
4
|
+
context "building related posts without lsi" do
|
|
5
|
+
setup do
|
|
6
|
+
stub(Jekyll).configuration do
|
|
7
|
+
Jekyll::Configuration::DEFAULTS.merge({'source' => source_dir,
|
|
8
|
+
'destination' => dest_dir})
|
|
9
|
+
end
|
|
10
|
+
@site = Site.new(Jekyll.configuration)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
should "use the most recent posts for related posts" do
|
|
14
|
+
@site.reset
|
|
15
|
+
@site.read
|
|
16
|
+
|
|
17
|
+
last_post = @site.posts.last
|
|
18
|
+
related_posts = Jekyll::RelatedPosts.new(last_post).build
|
|
19
|
+
|
|
20
|
+
last_10_recent_posts = (@site.posts.reverse - [last_post]).first(10)
|
|
21
|
+
assert_equal last_10_recent_posts, related_posts
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
context "building related posts with lsi" do
|
|
26
|
+
setup do
|
|
27
|
+
stub(Jekyll).configuration do
|
|
28
|
+
Jekyll::Configuration::DEFAULTS.merge({'source' => source_dir,
|
|
29
|
+
'destination' => dest_dir,
|
|
30
|
+
'lsi' => true})
|
|
31
|
+
end
|
|
32
|
+
any_instance_of(Jekyll::RelatedPosts) { |i| stub(i).display }
|
|
33
|
+
@site = Site.new(Jekyll.configuration)
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
should "use lsi for the related posts" do
|
|
37
|
+
@site.reset
|
|
38
|
+
@site.read
|
|
39
|
+
require 'classifier'
|
|
40
|
+
any_instance_of(::Classifier::LSI) do |c|
|
|
41
|
+
stub(c).find_related { @site.posts[-1..-9] }
|
|
42
|
+
stub(c).build_index
|
|
43
|
+
end
|
|
44
|
+
assert_equal @site.posts[-1..-9], Jekyll::RelatedPosts.new(@site.posts.last).build
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
data/test/test_site.rb
CHANGED
|
@@ -3,51 +3,51 @@ require 'helper'
|
|
|
3
3
|
class TestSite < Test::Unit::TestCase
|
|
4
4
|
context "configuring sites" do
|
|
5
5
|
should "have an array for plugins by default" do
|
|
6
|
-
site = Site.new(
|
|
6
|
+
site = Site.new(Jekyll::Configuration::DEFAULTS)
|
|
7
7
|
assert_equal [File.join(Dir.pwd, '_plugins')], site.plugins
|
|
8
8
|
end
|
|
9
9
|
|
|
10
10
|
should "look for plugins under the site directory by default" do
|
|
11
|
-
site = Site.new(
|
|
11
|
+
site = Site.new(Jekyll::Configuration::DEFAULTS.merge({'source' => File.expand_path(source_dir)}))
|
|
12
12
|
assert_equal [File.join(source_dir, '_plugins')], site.plugins
|
|
13
13
|
end
|
|
14
14
|
|
|
15
15
|
should "have an array for plugins if passed as a string" do
|
|
16
|
-
site = Site.new(
|
|
16
|
+
site = Site.new(Jekyll::Configuration::DEFAULTS.merge({'plugins' => '/tmp/plugins'}))
|
|
17
17
|
assert_equal ['/tmp/plugins'], site.plugins
|
|
18
18
|
end
|
|
19
19
|
|
|
20
20
|
should "have an array for plugins if passed as an array" do
|
|
21
|
-
site = Site.new(
|
|
21
|
+
site = Site.new(Jekyll::Configuration::DEFAULTS.merge({'plugins' => ['/tmp/plugins', '/tmp/otherplugins']}))
|
|
22
22
|
assert_equal ['/tmp/plugins', '/tmp/otherplugins'], site.plugins
|
|
23
23
|
end
|
|
24
24
|
|
|
25
25
|
should "have an empty array for plugins if nothing is passed" do
|
|
26
|
-
site = Site.new(
|
|
26
|
+
site = Site.new(Jekyll::Configuration::DEFAULTS.merge({'plugins' => []}))
|
|
27
27
|
assert_equal [], site.plugins
|
|
28
28
|
end
|
|
29
29
|
|
|
30
30
|
should "have an empty array for plugins if nil is passed" do
|
|
31
|
-
site = Site.new(
|
|
31
|
+
site = Site.new(Jekyll::Configuration::DEFAULTS.merge({'plugins' => nil}))
|
|
32
32
|
assert_equal [], site.plugins
|
|
33
33
|
end
|
|
34
34
|
|
|
35
35
|
should "expose default baseurl" do
|
|
36
|
-
site = Site.new(
|
|
37
|
-
assert_equal
|
|
36
|
+
site = Site.new(Jekyll::Configuration::DEFAULTS)
|
|
37
|
+
assert_equal Jekyll::Configuration::DEFAULTS['baseurl'], site.baseurl
|
|
38
38
|
end
|
|
39
39
|
|
|
40
40
|
should "expose baseurl passed in from config" do
|
|
41
|
-
site = Site.new(
|
|
41
|
+
site = Site.new(Jekyll::Configuration::DEFAULTS.merge({'baseurl' => '/blog'}))
|
|
42
42
|
assert_equal '/blog', site.baseurl
|
|
43
43
|
end
|
|
44
44
|
end
|
|
45
45
|
context "creating sites" do
|
|
46
46
|
setup do
|
|
47
|
-
stub(
|
|
48
|
-
|
|
47
|
+
stub(Jekyll).configuration do
|
|
48
|
+
Jekyll::Configuration::DEFAULTS.merge({'source' => source_dir, 'destination' => dest_dir})
|
|
49
49
|
end
|
|
50
|
-
@site = Site.new(
|
|
50
|
+
@site = Site.new(Jekyll.configuration)
|
|
51
51
|
@num_invalid_posts = 2
|
|
52
52
|
end
|
|
53
53
|
|
|
@@ -156,7 +156,7 @@ class TestSite < Test::Unit::TestCase
|
|
|
156
156
|
|
|
157
157
|
should "read layouts" do
|
|
158
158
|
@site.read_layouts
|
|
159
|
-
assert_equal ["default", "simple"].sort, @site.layouts.keys.sort
|
|
159
|
+
assert_equal ["default", "simple", "post/simple"].sort, @site.layouts.keys.sort
|
|
160
160
|
end
|
|
161
161
|
|
|
162
162
|
should "read posts" do
|
|
@@ -195,7 +195,7 @@ class TestSite < Test::Unit::TestCase
|
|
|
195
195
|
@site.exclude = excludes + ["exclude*"]
|
|
196
196
|
assert_equal files, @site.filter_entries(excludes + files + ["excludeA"])
|
|
197
197
|
end
|
|
198
|
-
|
|
198
|
+
|
|
199
199
|
should "not filter entries within include" do
|
|
200
200
|
includes = %w[_index.html .htaccess include*]
|
|
201
201
|
files = %w[index.html _index.html .htaccess includeA]
|
|
@@ -205,10 +205,10 @@ class TestSite < Test::Unit::TestCase
|
|
|
205
205
|
end
|
|
206
206
|
|
|
207
207
|
should "filter symlink entries when safe mode enabled" do
|
|
208
|
-
stub(
|
|
209
|
-
|
|
208
|
+
stub(Jekyll).configuration do
|
|
209
|
+
Jekyll::Configuration::DEFAULTS.merge({'source' => source_dir, 'destination' => dest_dir, 'safe' => true})
|
|
210
210
|
end
|
|
211
|
-
site = Site.new(
|
|
211
|
+
site = Site.new(Jekyll.configuration)
|
|
212
212
|
stub(File).symlink?('symlink.js') {true}
|
|
213
213
|
files = %w[symlink.js]
|
|
214
214
|
assert_equal [], site.filter_entries(files)
|
|
@@ -221,10 +221,10 @@ class TestSite < Test::Unit::TestCase
|
|
|
221
221
|
end
|
|
222
222
|
|
|
223
223
|
should "not include symlinks in safe mode" do
|
|
224
|
-
stub(
|
|
225
|
-
|
|
224
|
+
stub(Jekyll).configuration do
|
|
225
|
+
Jekyll::Configuration::DEFAULTS.merge({'source' => source_dir, 'destination' => dest_dir, 'safe' => true})
|
|
226
226
|
end
|
|
227
|
-
site = Site.new(
|
|
227
|
+
site = Site.new(Jekyll.configuration)
|
|
228
228
|
|
|
229
229
|
site.read_directories("symlink-test")
|
|
230
230
|
assert_equal [], site.pages
|
|
@@ -232,10 +232,10 @@ class TestSite < Test::Unit::TestCase
|
|
|
232
232
|
end
|
|
233
233
|
|
|
234
234
|
should "include symlinks in unsafe mode" do
|
|
235
|
-
stub(
|
|
236
|
-
|
|
235
|
+
stub(Jekyll).configuration do
|
|
236
|
+
Jekyll::Configuration::DEFAULTS.merge({'source' => source_dir, 'destination' => dest_dir, 'safe' => false})
|
|
237
237
|
end
|
|
238
|
-
site = Site.new(
|
|
238
|
+
site = Site.new(Jekyll.configuration)
|
|
239
239
|
|
|
240
240
|
site.read_directories("symlink-test")
|
|
241
241
|
assert_not_equal [], site.pages
|
|
@@ -244,22 +244,22 @@ class TestSite < Test::Unit::TestCase
|
|
|
244
244
|
|
|
245
245
|
context 'error handling' do
|
|
246
246
|
should "raise if destination is included in source" do
|
|
247
|
-
stub(
|
|
248
|
-
|
|
247
|
+
stub(Jekyll).configuration do
|
|
248
|
+
Jekyll::Configuration::DEFAULTS.merge({'source' => source_dir, 'destination' => source_dir})
|
|
249
249
|
end
|
|
250
250
|
|
|
251
|
-
assert_raise
|
|
252
|
-
site = Site.new(
|
|
251
|
+
assert_raise Jekyll::FatalException do
|
|
252
|
+
site = Site.new(Jekyll.configuration)
|
|
253
253
|
end
|
|
254
254
|
end
|
|
255
255
|
|
|
256
256
|
should "raise if destination is source" do
|
|
257
|
-
stub(
|
|
258
|
-
|
|
257
|
+
stub(Jekyll).configuration do
|
|
258
|
+
Jekyll::Configuration::DEFAULTS.merge({'source' => source_dir, 'destination' => File.join(source_dir, "..")})
|
|
259
259
|
end
|
|
260
260
|
|
|
261
|
-
assert_raise
|
|
262
|
-
site = Site.new(
|
|
261
|
+
assert_raise Jekyll::FatalException do
|
|
262
|
+
site = Site.new(Jekyll.configuration)
|
|
263
263
|
end
|
|
264
264
|
end
|
|
265
265
|
end
|
|
@@ -284,7 +284,7 @@ class TestSite < Test::Unit::TestCase
|
|
|
284
284
|
File.open(dest_dir('.svn/HEAD'), 'w')
|
|
285
285
|
File.open(dest_dir('.hg/HEAD'), 'w')
|
|
286
286
|
end
|
|
287
|
-
|
|
287
|
+
|
|
288
288
|
teardown do
|
|
289
289
|
FileUtils.rm_f(dest_dir('obsolete.html'))
|
|
290
290
|
FileUtils.rm_rf(dest_dir('qux'))
|
|
@@ -293,7 +293,7 @@ class TestSite < Test::Unit::TestCase
|
|
|
293
293
|
FileUtils.rm_rf(dest_dir('.svn'))
|
|
294
294
|
FileUtils.rm_rf(dest_dir('.hg'))
|
|
295
295
|
end
|
|
296
|
-
|
|
296
|
+
|
|
297
297
|
should 'remove orphaned files in destination' do
|
|
298
298
|
@site.process
|
|
299
299
|
assert !File.exist?(dest_dir('obsolete.html'))
|
|
@@ -304,7 +304,7 @@ class TestSite < Test::Unit::TestCase
|
|
|
304
304
|
end
|
|
305
305
|
|
|
306
306
|
should 'remove orphaned files in destination - keep_files .svn' do
|
|
307
|
-
config =
|
|
307
|
+
config = Jekyll::Configuration::DEFAULTS.merge({'source' => source_dir, 'destination' => dest_dir, 'keep_files' => ['.svn']})
|
|
308
308
|
@site = Site.new(config)
|
|
309
309
|
@site.process
|
|
310
310
|
assert !File.exist?(dest_dir('.htpasswd'))
|
|
@@ -317,39 +317,97 @@ class TestSite < Test::Unit::TestCase
|
|
|
317
317
|
assert File.exist?(dest_dir('.svn/HEAD'))
|
|
318
318
|
end
|
|
319
319
|
end
|
|
320
|
-
|
|
320
|
+
|
|
321
321
|
context 'with an invalid markdown processor in the configuration' do
|
|
322
322
|
should 'not throw an error at initialization time' do
|
|
323
323
|
bad_processor = 'not a processor name'
|
|
324
324
|
assert_nothing_raised do
|
|
325
|
-
Site.new(
|
|
325
|
+
Site.new(Jekyll.configuration.merge({ 'markdown' => bad_processor }))
|
|
326
326
|
end
|
|
327
327
|
end
|
|
328
|
-
|
|
328
|
+
|
|
329
329
|
should 'throw FatalException at process time' do
|
|
330
330
|
bad_processor = 'not a processor name'
|
|
331
|
-
s = Site.new(
|
|
332
|
-
assert_raise
|
|
331
|
+
s = Site.new(Jekyll.configuration.merge({ 'markdown' => bad_processor }))
|
|
332
|
+
assert_raise Jekyll::FatalException do
|
|
333
333
|
s.process
|
|
334
334
|
end
|
|
335
335
|
end
|
|
336
336
|
end
|
|
337
|
-
|
|
337
|
+
|
|
338
|
+
context 'data directory' do
|
|
339
|
+
should 'auto load yaml files' do
|
|
340
|
+
site = Site.new(Jekyll.configuration)
|
|
341
|
+
site.process
|
|
342
|
+
|
|
343
|
+
file_content = YAML.safe_load_file(File.join(source_dir, '_data', 'members.yaml'))
|
|
344
|
+
|
|
345
|
+
assert_equal site.data['members'], file_content
|
|
346
|
+
assert_equal site.site_payload['site']['data']['members'], file_content
|
|
347
|
+
end
|
|
348
|
+
|
|
349
|
+
should 'auto load yml files' do
|
|
350
|
+
site = Site.new(Jekyll.configuration)
|
|
351
|
+
site.process
|
|
352
|
+
|
|
353
|
+
file_content = YAML.safe_load_file(File.join(source_dir, '_data', 'languages.yml'))
|
|
354
|
+
|
|
355
|
+
assert_equal site.data['languages'], file_content
|
|
356
|
+
assert_equal site.site_payload['site']['data']['languages'], file_content
|
|
357
|
+
end
|
|
358
|
+
|
|
359
|
+
should "load symlink files in unsafe mode" do
|
|
360
|
+
site = Site.new(Jekyll.configuration.merge({'safe' => false}))
|
|
361
|
+
site.process
|
|
362
|
+
|
|
363
|
+
file_content = YAML.safe_load_file(File.join(source_dir, '_data', 'products.yml'))
|
|
364
|
+
|
|
365
|
+
assert_equal site.data['products'], file_content
|
|
366
|
+
assert_equal site.site_payload['site']['data']['products'], file_content
|
|
367
|
+
end
|
|
368
|
+
|
|
369
|
+
should "not load symlink files in safe mode" do
|
|
370
|
+
site = Site.new(Jekyll.configuration.merge({'safe' => true}))
|
|
371
|
+
site.process
|
|
372
|
+
|
|
373
|
+
assert_nil site.data['products']
|
|
374
|
+
assert_nil site.site_payload['site']['data']['products']
|
|
375
|
+
end
|
|
376
|
+
|
|
377
|
+
should "load symlink directory in unsafe mode" do
|
|
378
|
+
site = Site.new(Jekyll.configuration.merge({'safe' => false, 'data_source' => File.join('symlink-test', '_data')}))
|
|
379
|
+
site.process
|
|
380
|
+
|
|
381
|
+
assert_not_nil site.data['products']
|
|
382
|
+
assert_not_nil site.data['languages']
|
|
383
|
+
assert_not_nil site.data['members']
|
|
384
|
+
end
|
|
385
|
+
|
|
386
|
+
should "not load symlink directory in safe mode" do
|
|
387
|
+
site = Site.new(Jekyll.configuration.merge({'safe' => true, 'data_source' => File.join('symlink-test', '_data')}))
|
|
388
|
+
site.process
|
|
389
|
+
|
|
390
|
+
assert_nil site.data['products']
|
|
391
|
+
assert_nil site.data['languages']
|
|
392
|
+
assert_nil site.data['members']
|
|
393
|
+
end
|
|
394
|
+
end
|
|
395
|
+
|
|
338
396
|
context 'data sources' do
|
|
339
397
|
should 'not throw exception if data sources is nil' do
|
|
340
398
|
assert_nothing_raised do
|
|
341
|
-
Site.new(
|
|
399
|
+
Site.new(Jekyll.configuration.merge({ 'data_sources' => nil }))
|
|
342
400
|
end
|
|
343
401
|
end
|
|
344
402
|
|
|
345
403
|
should 'not throw exception if data sources is empty' do
|
|
346
404
|
assert_nothing_raised do
|
|
347
|
-
Site.new(
|
|
405
|
+
Site.new(Jekyll.configuration.merge({ 'data_sources' => [] }))
|
|
348
406
|
end
|
|
349
407
|
end
|
|
350
408
|
|
|
351
409
|
should 'load one data source' do
|
|
352
|
-
site = Site.new(
|
|
410
|
+
site = Site.new(Jekyll.configuration.merge({ 'data_sources' => [{'name' => 'jsonip', 'type' => 'json', 'url' => 'http://jsonip.com/'}] }))
|
|
353
411
|
site.process
|
|
354
412
|
|
|
355
413
|
assert_not_nil site.data_sources['jsonip']['ip']
|
|
@@ -362,7 +420,7 @@ class TestSite < Test::Unit::TestCase
|
|
|
362
420
|
base = File.expand_path('../fixtures', __FILE__)
|
|
363
421
|
members = {'name' => 'members', 'type' => 'yaml', 'path' => File.join(base, 'members.yaml')}
|
|
364
422
|
|
|
365
|
-
site = Site.new(
|
|
423
|
+
site = Site.new(Jekyll.configuration.merge({ 'data_sources' => [jsonip, members] }))
|
|
366
424
|
site.process
|
|
367
425
|
|
|
368
426
|
assert_not_nil site.data_sources['jsonip']['ip']
|