jekyll 2.2.0 → 2.3.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of jekyll might be problematic. Click here for more details.

Files changed (306) hide show
  1. checksums.yaml +4 -4
  2. data/README.markdown +1 -1
  3. data/lib/jekyll.rb +0 -1
  4. data/lib/jekyll/collection.rb +18 -3
  5. data/lib/jekyll/command.rb +0 -25
  6. data/lib/jekyll/commands/build.rb +7 -2
  7. data/lib/jekyll/commands/help.rb +33 -0
  8. data/lib/jekyll/configuration.rb +36 -28
  9. data/lib/jekyll/converters/markdown/kramdown_parser.rb +1 -1
  10. data/lib/jekyll/convertible.rb +43 -20
  11. data/lib/jekyll/deprecator.rb +15 -8
  12. data/lib/jekyll/document.rb +21 -4
  13. data/lib/jekyll/filters.rb +27 -1
  14. data/lib/jekyll/frontmatter_defaults.rb +46 -12
  15. data/lib/jekyll/plugin.rb +10 -1
  16. data/lib/jekyll/post.rb +6 -13
  17. data/lib/jekyll/related_posts.rb +2 -2
  18. data/lib/jekyll/renderer.rb +7 -2
  19. data/lib/jekyll/site.rb +5 -7
  20. data/lib/jekyll/static_file.rb +24 -4
  21. data/lib/jekyll/tags/include.rb +3 -1
  22. data/lib/jekyll/tags/post_url.rb +2 -2
  23. data/lib/jekyll/utils.rb +88 -69
  24. data/lib/jekyll/version.rb +1 -1
  25. data/lib/site_template/_config.yml +6 -4
  26. data/lib/site_template/_includes/footer.html +43 -49
  27. data/lib/site_template/_includes/head.html +3 -4
  28. data/lib/site_template/_includes/header.html +9 -10
  29. data/lib/site_template/_layouts/default.html +6 -5
  30. data/lib/site_template/_layouts/page.html +3 -3
  31. data/lib/site_template/_layouts/post.html +4 -4
  32. data/lib/site_template/_posts/0000-00-00-welcome-to-jekyll.markdown.erb +6 -5
  33. data/lib/site_template/_sass/_base.scss +203 -0
  34. data/lib/site_template/_sass/_layout.scss +236 -0
  35. data/lib/site_template/_sass/_syntax-highlighting.scss +67 -0
  36. data/lib/site_template/css/main.scss +49 -0
  37. data/lib/site_template/feed.xml +1 -1
  38. data/lib/site_template/index.html +7 -4
  39. metadata +24 -431
  40. data/.gitignore +0 -15
  41. data/.travis.yml +0 -27
  42. data/CONTRIBUTING.markdown +0 -91
  43. data/Gemfile +0 -2
  44. data/History.markdown +0 -1310
  45. data/Rakefile +0 -268
  46. data/cucumber.yml +0 -3
  47. data/docs/jp/CONTRIBUTING.jp.markdown +0 -93
  48. data/docs/jp/README.jp.markdown +0 -68
  49. data/features/collections.feature +0 -145
  50. data/features/create_sites.feature +0 -158
  51. data/features/data.feature +0 -105
  52. data/features/drafts.feature +0 -46
  53. data/features/embed_filters.feature +0 -107
  54. data/features/frontmatter_defaults.feature +0 -136
  55. data/features/include_tag.feature +0 -68
  56. data/features/markdown.feature +0 -67
  57. data/features/pagination.feature +0 -82
  58. data/features/permalinks.feature +0 -85
  59. data/features/post_data.feature +0 -261
  60. data/features/post_excerpts.feature +0 -50
  61. data/features/rendering.feature +0 -34
  62. data/features/site_configuration.feature +0 -283
  63. data/features/site_data.feature +0 -107
  64. data/features/step_definitions/jekyll_steps.rb +0 -201
  65. data/features/support/env.rb +0 -65
  66. data/jekyll.gemspec +0 -66
  67. data/lib/site_template/css/main.css +0 -410
  68. data/script/bootstrap +0 -4
  69. data/script/branding +0 -11
  70. data/script/cibuild +0 -7
  71. data/script/console +0 -38
  72. data/script/proof +0 -22
  73. data/script/rebund +0 -140
  74. data/script/test +0 -17
  75. data/site/.gitignore +0 -4
  76. data/site/CNAME +0 -1
  77. data/site/README +0 -1
  78. data/site/_config.yml +0 -9
  79. data/site/_data/docs.yml +0 -46
  80. data/site/_includes/analytics.html +0 -30
  81. data/site/_includes/anchor_links.html +0 -32
  82. data/site/_includes/css/font-awesome.css +0 -44
  83. data/site/_includes/css/gridism.css +0 -110
  84. data/site/_includes/css/normalize.css +0 -1
  85. data/site/_includes/css/pygments.css +0 -72
  86. data/site/_includes/css/style.css +0 -1045
  87. data/site/_includes/docs_contents.html +0 -8
  88. data/site/_includes/docs_contents_mobile.html +0 -10
  89. data/site/_includes/docs_option.html +0 -11
  90. data/site/_includes/docs_ul.html +0 -20
  91. data/site/_includes/footer.html +0 -15
  92. data/site/_includes/header.html +0 -18
  93. data/site/_includes/news_contents.html +0 -33
  94. data/site/_includes/news_contents_mobile.html +0 -11
  95. data/site/_includes/news_item.html +0 -24
  96. data/site/_includes/primary-nav-items.html +0 -17
  97. data/site/_includes/section_nav.html +0 -22
  98. data/site/_includes/top.html +0 -17
  99. data/site/_layouts/default.html +0 -13
  100. data/site/_layouts/docs.html +0 -23
  101. data/site/_layouts/news.html +0 -19
  102. data/site/_layouts/news_item.html +0 -27
  103. data/site/_posts/2013-05-06-jekyll-1-0-0-released.markdown +0 -23
  104. data/site/_posts/2013-05-08-jekyll-1-0-1-released.markdown +0 -27
  105. data/site/_posts/2013-05-12-jekyll-1-0-2-released.markdown +0 -28
  106. data/site/_posts/2013-06-07-jekyll-1-0-3-released.markdown +0 -25
  107. data/site/_posts/2013-07-14-jekyll-1-1-0-released.markdown +0 -27
  108. data/site/_posts/2013-07-24-jekyll-1-1-1-released.markdown +0 -31
  109. data/site/_posts/2013-07-25-jekyll-1-0-4-released.markdown +0 -20
  110. data/site/_posts/2013-07-25-jekyll-1-1-2-released.markdown +0 -20
  111. data/site/_posts/2013-09-06-jekyll-1-2-0-released.markdown +0 -23
  112. data/site/_posts/2013-09-14-jekyll-1-2-1-released.markdown +0 -19
  113. data/site/_posts/2013-10-28-jekyll-1-3-0-rc1-released.markdown +0 -19
  114. data/site/_posts/2013-11-04-jekyll-1-3-0-released.markdown +0 -43
  115. data/site/_posts/2013-11-26-jekyll-1-3-1-released.markdown +0 -21
  116. data/site/_posts/2013-12-07-jekyll-1-4-0-released.markdown +0 -30
  117. data/site/_posts/2013-12-09-jekyll-1-4-1-released.markdown +0 -20
  118. data/site/_posts/2013-12-16-jekyll-1-4-2-released.markdown +0 -18
  119. data/site/_posts/2014-01-13-jekyll-1-4-3-released.markdown +0 -26
  120. data/site/_posts/2014-03-24-jekyll-1-5-0-released.markdown +0 -19
  121. data/site/_posts/2014-03-27-jekyll-1-5-1-released.markdown +0 -26
  122. data/site/_posts/2014-05-06-jekyll-turns-2-0-0.markdown +0 -31
  123. data/site/_posts/2014-05-08-jekyll-2-0-3-released.markdown +0 -18
  124. data/site/_posts/2014-06-04-jekyll-stickers-1-dollar-stickermule.markdown +0 -19
  125. data/site/_posts/2014-06-28-jekyll-turns-21-i-mean-2-1-0.markdown +0 -31
  126. data/site/_posts/2014-07-01-jekyll-2-1-1-released.markdown +0 -30
  127. data/site/_posts/2014-07-29-jekyll-2-2-0-released.markdown +0 -19
  128. data/site/css/screen.css +0 -31
  129. data/site/docs/assets.md +0 -66
  130. data/site/docs/collections.md +0 -259
  131. data/site/docs/configuration.md +0 -536
  132. data/site/docs/continuous-integration.md +0 -177
  133. data/site/docs/contributing.md +0 -133
  134. data/site/docs/datafiles.md +0 -108
  135. data/site/docs/deployment-methods.md +0 -127
  136. data/site/docs/drafts.md +0 -21
  137. data/site/docs/extras.md +0 -18
  138. data/site/docs/frontmatter.md +0 -191
  139. data/site/docs/github-pages.md +0 -91
  140. data/site/docs/history.md +0 -1514
  141. data/site/docs/index.md +0 -58
  142. data/site/docs/installation.md +0 -106
  143. data/site/docs/migrations.md +0 -11
  144. data/site/docs/pages.md +0 -86
  145. data/site/docs/pagination.md +0 -212
  146. data/site/docs/permalinks.md +0 -188
  147. data/site/docs/plugins.md +0 -561
  148. data/site/docs/posts.md +0 -211
  149. data/site/docs/quickstart.md +0 -26
  150. data/site/docs/resources.md +0 -43
  151. data/site/docs/sites.md +0 -29
  152. data/site/docs/structure.md +0 -190
  153. data/site/docs/templates.md +0 -376
  154. data/site/docs/troubleshooting.md +0 -147
  155. data/site/docs/upgrading.md +0 -146
  156. data/site/docs/usage.md +0 -74
  157. data/site/docs/variables.md +0 -382
  158. data/site/docs/windows.md +0 -44
  159. data/site/favicon.ico +0 -0
  160. data/site/feed.xml +0 -48
  161. data/site/fonts/FontAwesome.otf +0 -0
  162. data/site/fonts/fontawesome-webfont.eot +0 -0
  163. data/site/fonts/fontawesome-webfont.svg +0 -504
  164. data/site/fonts/fontawesome-webfont.ttf +0 -0
  165. data/site/fonts/fontawesome-webfont.woff +0 -0
  166. data/site/freenode.txt +0 -1
  167. data/site/img/article-footer.png +0 -0
  168. data/site/img/footer-arrow.png +0 -0
  169. data/site/img/footer-logo.png +0 -0
  170. data/site/img/jekyll-sticker.jpg +0 -0
  171. data/site/img/logo-2x.png +0 -0
  172. data/site/img/logo-rss.png +0 -0
  173. data/site/img/octojekyll.png +0 -0
  174. data/site/index.html +0 -90
  175. data/site/js/html5shiv.min.js +0 -4
  176. data/site/js/respond.min.js +0 -5
  177. data/site/news/index.html +0 -10
  178. data/site/news/releases/index.html +0 -10
  179. data/test/fixtures/broken_front_matter1.erb +0 -5
  180. data/test/fixtures/broken_front_matter2.erb +0 -4
  181. data/test/fixtures/broken_front_matter3.erb +0 -7
  182. data/test/fixtures/exploit_front_matter.erb +0 -4
  183. data/test/fixtures/front_matter.erb +0 -4
  184. data/test/helper.rb +0 -80
  185. data/test/source/+/%# +.md +0 -6
  186. data/test/source/+/foo.md +0 -7
  187. data/test/source/.htaccess +0 -8
  188. data/test/source/_config.dev.toml +0 -2
  189. data/test/source/_data/categories/dairy.yaml +0 -6
  190. data/test/source/_data/languages.yml +0 -2
  191. data/test/source/_data/members.json +0 -12
  192. data/test/source/_data/members.yaml +0 -7
  193. data/test/source/_data/products.yml +0 -4
  194. data/test/source/_drafts/draft-properties.text +0 -11
  195. data/test/source/_includes/include.html +0 -1
  196. data/test/source/_includes/params.html +0 -7
  197. data/test/source/_includes/sig.markdown +0 -3
  198. data/test/source/_layouts/default.html +0 -27
  199. data/test/source/_layouts/post/simple.html +0 -1
  200. data/test/source/_layouts/simple.html +0 -1
  201. data/test/source/_methods/_do_not_read_me.md +0 -5
  202. data/test/source/_methods/configuration.md +0 -8
  203. data/test/source/_methods/sanitized_path.md +0 -5
  204. data/test/source/_methods/site/_dont_include_me_either.md +0 -5
  205. data/test/source/_methods/site/generate.md +0 -6
  206. data/test/source/_methods/site/initialize.md +0 -4
  207. data/test/source/_methods/um_hi.md +0 -6
  208. data/test/source/_plugins/dummy.rb +0 -8
  209. data/test/source/_posts/2008-02-02-not-published.textile +0 -8
  210. data/test/source/_posts/2008-02-02-published.textile +0 -8
  211. data/test/source/_posts/2008-10-18-foo-bar.textile +0 -8
  212. data/test/source/_posts/2008-11-21-complex.textile +0 -8
  213. data/test/source/_posts/2008-12-03-permalinked-post.textile +0 -9
  214. data/test/source/_posts/2008-12-13-include.markdown +0 -8
  215. data/test/source/_posts/2009-01-27-array-categories.textile +0 -10
  216. data/test/source/_posts/2009-01-27-categories.textile +0 -7
  217. data/test/source/_posts/2009-01-27-category.textile +0 -7
  218. data/test/source/_posts/2009-01-27-empty-categories.textile +0 -7
  219. data/test/source/_posts/2009-01-27-empty-category.textile +0 -7
  220. data/test/source/_posts/2009-01-27-no-category.textile +0 -6
  221. data/test/source/_posts/2009-03-12-hash-#1.markdown +0 -6
  222. data/test/source/_posts/2009-05-18-empty-tag.textile +0 -6
  223. data/test/source/_posts/2009-05-18-empty-tags.textile +0 -6
  224. data/test/source/_posts/2009-05-18-tag.textile +0 -6
  225. data/test/source/_posts/2009-05-18-tags.textile +0 -9
  226. data/test/source/_posts/2009-06-22-empty-yaml.textile +0 -3
  227. data/test/source/_posts/2009-06-22-no-yaml.textile +0 -1
  228. data/test/source/_posts/2010-01-08-triple-dash.markdown +0 -5
  229. data/test/source/_posts/2010-01-09-date-override.textile +0 -7
  230. data/test/source/_posts/2010-01-09-time-override.textile +0 -7
  231. data/test/source/_posts/2010-01-09-timezone-override.textile +0 -7
  232. data/test/source/_posts/2010-01-16-override-data.textile +0 -4
  233. data/test/source/_posts/2011-04-12-md-extension.md +0 -7
  234. data/test/source/_posts/2011-04-12-text-extension.text +0 -0
  235. data/test/source/_posts/2013-01-02-post-excerpt.markdown +0 -14
  236. data/test/source/_posts/2013-01-12-nil-layout.textile +0 -6
  237. data/test/source/_posts/2013-01-12-no-layout.textile +0 -5
  238. data/test/source/_posts/2013-03-19-not-a-post.markdown/.gitkeep +0 -0
  239. data/test/source/_posts/2013-04-11-custom-excerpt.markdown +0 -10
  240. data/test/source/_posts/2013-05-10-number-category.textile +0 -7
  241. data/test/source/_posts/2013-07-22-post-excerpt-with-layout.markdown +0 -23
  242. data/test/source/_posts/2013-08-01-mkdn-extension.mkdn +0 -0
  243. data/test/source/_posts/2013-12-17-include-variable-filters.markdown +0 -21
  244. data/test/source/_posts/2013-12-20-properties.text +0 -11
  245. data/test/source/_posts/2014-01-06-permalink-traversal.md +0 -5
  246. data/test/source/_posts/2014-03-03-yaml-with-dots.md +0 -5
  247. data/test/source/_posts/2014-03-22-escape-+ %20[].markdown +0 -6
  248. data/test/source/_posts/es/2008-11-21-nested.textile +0 -8
  249. data/test/source/_sass/_grid.scss +0 -1
  250. data/test/source/_slides/example-slide-1.html +0 -4
  251. data/test/source/_slides/example-slide-2.html +0 -7
  252. data/test/source/_slides/example-slide-3.html +0 -5
  253. data/test/source/_with.dots/all.dots/2.4.0.md +0 -5
  254. data/test/source/_with.dots/file.with.dots.md +0 -0
  255. data/test/source/about.html +0 -6
  256. data/test/source/category/_posts/2008-9-23-categories.textile +0 -6
  257. data/test/source/contacts.html +0 -5
  258. data/test/source/contacts/bar.html +0 -5
  259. data/test/source/contacts/index.html +0 -5
  260. data/test/source/css/main.scss +0 -4
  261. data/test/source/css/screen.css +0 -76
  262. data/test/source/deal.with.dots.html +0 -7
  263. data/test/source/environment.html +0 -5
  264. data/test/source/exploit.md +0 -5
  265. data/test/source/foo/_posts/bar/2008-12-12-topical-post.textile +0 -8
  266. data/test/source/index.html +0 -22
  267. data/test/source/js/coffeescript.coffee +0 -10
  268. data/test/source/pgp.key +0 -2
  269. data/test/source/products.yml +0 -4
  270. data/test/source/properties.html +0 -8
  271. data/test/source/sitemap.xml +0 -32
  272. data/test/source/static_files.html +0 -4
  273. data/test/source/symlink-test/symlinked-file +0 -22
  274. data/test/source/unpublished.html +0 -7
  275. data/test/source/win/_posts/2009-05-24-yaml-linebreak.markdown +0 -7
  276. data/test/source/z_category/_posts/2008-9-23-categories.textile +0 -6
  277. data/test/suite.rb +0 -11
  278. data/test/test_cleaner.rb +0 -77
  279. data/test/test_coffeescript.rb +0 -49
  280. data/test/test_collections.rb +0 -224
  281. data/test/test_command.rb +0 -53
  282. data/test/test_configuration.rb +0 -201
  283. data/test/test_convertible.rb +0 -49
  284. data/test/test_document.rb +0 -193
  285. data/test/test_draft.rb +0 -56
  286. data/test/test_entry_filter.rb +0 -124
  287. data/test/test_excerpt.rb +0 -131
  288. data/test/test_filters.rb +0 -207
  289. data/test/test_generated_site.rb +0 -97
  290. data/test/test_kramdown.rb +0 -62
  291. data/test/test_layout_reader.rb +0 -34
  292. data/test/test_liquid_extensions.rb +0 -31
  293. data/test/test_log_adapter.rb +0 -59
  294. data/test/test_new_command.rb +0 -104
  295. data/test/test_page.rb +0 -254
  296. data/test/test_path_sanitization.rb +0 -18
  297. data/test/test_post.rb +0 -741
  298. data/test/test_rdiscount.rb +0 -22
  299. data/test/test_redcarpet.rb +0 -77
  300. data/test/test_redcloth.rb +0 -86
  301. data/test/test_related_posts.rb +0 -47
  302. data/test/test_sass.rb +0 -26
  303. data/test/test_site.rb +0 -452
  304. data/test/test_tags.rb +0 -509
  305. data/test/test_url.rb +0 -28
  306. data/test/test_utils.rb +0 -67
@@ -1,53 +0,0 @@
1
- require 'helper'
2
-
3
- class TestCommand < Test::Unit::TestCase
4
- context "when calling .ignore_paths" do
5
- context "when source is absolute" do
6
- setup { @source = source_dir }
7
- should "return an array with regex for destination" do
8
- absolute = source_dir('dest')
9
- relative = Pathname.new(source_dir('dest')).relative_path_from(Pathname.new('.').expand_path).to_s
10
- [absolute, relative].each do |dest|
11
- config = build_configs("source" => @source, "destination" => dest)
12
- assert Command.ignore_paths(config).include?(/dest/), "failed with destination: #{dest}"
13
- end
14
- end
15
- end
16
- context "when source is relative" do
17
- setup { @source = Pathname.new(source_dir).relative_path_from(Pathname.new('.').expand_path).to_s }
18
- should "return an array with regex for destination" do
19
- absolute = source_dir('dest')
20
- relative = Pathname.new(source_dir('dest')).relative_path_from(Pathname.new('.').expand_path).to_s
21
- [absolute, relative].each do |dest|
22
- config = build_configs("source" => @source, "destination" => dest)
23
- assert Command.ignore_paths(config).include?(/dest/), "failed with destination: #{dest}"
24
- end
25
- end
26
- end
27
- context "multiple config files" do
28
- should "return an array with regex for config files" do
29
- config = build_configs("config"=> ["_config.yaml", "_config2.yml"])
30
- ignore_paths = Command.ignore_paths(config)
31
- assert ignore_paths.include?(/_config\.yaml/), 'did not include _config.yaml'
32
- assert ignore_paths.include?(/_config2\.yml/), 'did not include _config2.yml'
33
- end
34
- end
35
- end
36
- context "when calling .add_build_options" do
37
- should "add common options" do
38
- cmd = Object.new
39
- mock(cmd).option.with_any_args.at_least(1)
40
- Command.add_build_options(cmd)
41
- end
42
- end
43
- context "when calling .process_site" do
44
- context "when fatal error occurs" do
45
- should "exit with non-zero error code" do
46
- site = Object.new
47
- stub(site).process { raise Jekyll::Errors::FatalException }
48
- error = assert_raise(SystemExit) { Command.process_site(site) }
49
- assert_not_equal 0, error.status
50
- end
51
- end
52
- end
53
- end
@@ -1,201 +0,0 @@
1
- require 'helper'
2
-
3
- class TestConfiguration < Test::Unit::TestCase
4
- context "#stringify_keys" do
5
- setup do
6
- @mixed_keys = Configuration[{
7
- 'markdown' => 'kramdown',
8
- :permalink => 'date',
9
- 'baseurl' => '/',
10
- :include => ['.htaccess'],
11
- :source => './'
12
- }]
13
- @string_keys = Configuration[{
14
- 'markdown' => 'kramdown',
15
- 'permalink' => 'date',
16
- 'baseurl' => '/',
17
- 'include' => ['.htaccess'],
18
- 'source' => './'
19
- }]
20
- end
21
- should "stringify symbol keys" do
22
- assert_equal @string_keys, @mixed_keys.stringify_keys
23
- end
24
- should "not mess with keys already strings" do
25
- assert_equal @string_keys, @string_keys.stringify_keys
26
- end
27
- end
28
- context "#config_files" do
29
- setup do
30
- @config = Configuration[{"source" => source_dir}]
31
- @no_override = {}
32
- @one_config_file = {"config" => "config.yml"}
33
- @multiple_files = {"config" => %w[config/site.yml config/deploy.toml configuration.yml]}
34
- end
35
-
36
- should "always return an array" do
37
- assert @config.config_files(@no_override).is_a?(Array)
38
- assert @config.config_files(@one_config_file).is_a?(Array)
39
- assert @config.config_files(@multiple_files).is_a?(Array)
40
- end
41
- should "return the default config path if no config files are specified" do
42
- assert_equal [source_dir("_config.yml")], @config.config_files(@no_override)
43
- end
44
- should "return .yaml if it exists but .yml does not" do
45
- mock(File).exists?(source_dir("_config.yml")) { false }
46
- mock(File).exists?(source_dir("_config.yaml")) { true }
47
- assert_equal [source_dir("_config.yaml")], @config.config_files(@no_override)
48
- end
49
- should "return .yml if both .yml and .yaml exist" do
50
- mock(File).exists?(source_dir("_config.yml")) { true }
51
- assert_equal [source_dir("_config.yml")], @config.config_files(@no_override)
52
- end
53
- should "return the config if given one config file" do
54
- assert_equal %w[config.yml], @config.config_files(@one_config_file)
55
- end
56
- should "return an array of the config files if given many config files" do
57
- assert_equal %w[config/site.yml config/deploy.toml configuration.yml], @config.config_files(@multiple_files)
58
- end
59
- end
60
- context "#backwards_compatibilize" do
61
- setup do
62
- @config = Configuration[{
63
- "auto" => true,
64
- "watch" => true,
65
- "server" => true,
66
- "exclude" => "READ-ME.md, Gemfile,CONTRIBUTING.hello.markdown",
67
- "include" => "STOP_THE_PRESSES.txt,.heloses, .git",
68
- "pygments" => true,
69
- }]
70
- end
71
- should "unset 'auto' and 'watch'" do
72
- assert @config.has_key?("auto")
73
- assert @config.has_key?("watch")
74
- assert !@config.backwards_compatibilize.has_key?("auto")
75
- assert !@config.backwards_compatibilize.has_key?("watch")
76
- end
77
- should "unset 'server'" do
78
- assert @config.has_key?("server")
79
- assert !@config.backwards_compatibilize.has_key?("server")
80
- end
81
- should "transform string exclude into an array" do
82
- assert @config.has_key?("exclude")
83
- assert @config.backwards_compatibilize.has_key?("exclude")
84
- assert_equal @config.backwards_compatibilize["exclude"], %w[READ-ME.md Gemfile CONTRIBUTING.hello.markdown]
85
- end
86
- should "transform string include into an array" do
87
- assert @config.has_key?("include")
88
- assert @config.backwards_compatibilize.has_key?("include")
89
- assert_equal @config.backwards_compatibilize["include"], %w[STOP_THE_PRESSES.txt .heloses .git]
90
- end
91
- should "set highlighter to pygments" do
92
- assert @config.has_key?("pygments")
93
- assert !@config.backwards_compatibilize.has_key?("pygments")
94
- assert_equal @config.backwards_compatibilize["highlighter"], "pygments"
95
- end
96
- end
97
- context "#fix_common_issues" do
98
- setup do
99
- @config = Proc.new do |val|
100
- Configuration[{
101
- 'paginate' => val
102
- }]
103
- end
104
- end
105
- should "sets an invalid 'paginate' value to nil" do
106
- assert_nil @config.call(0).fix_common_issues['paginate']
107
- assert_nil @config.call(-1).fix_common_issues['paginate']
108
- assert_nil @config.call(true).fix_common_issues['paginate']
109
- end
110
- end
111
- context "loading configuration" do
112
- setup do
113
- @path = File.join(Dir.pwd, '_config.yml')
114
- @user_config = File.join(Dir.pwd, "my_config_file.yml")
115
- end
116
-
117
- should "fire warning with no _config.yml" do
118
- mock(SafeYAML).load_file(@path) { raise SystemCallError, "No such file or directory - #{@path}" }
119
- mock($stderr).puts("Configuration file: none".yellow)
120
- assert_equal Jekyll::Configuration::DEFAULTS, Jekyll.configuration({})
121
- end
122
-
123
- should "load configuration as hash" do
124
- mock(SafeYAML).load_file(@path) { Hash.new }
125
- mock($stdout).puts("Configuration file: #{@path}")
126
- assert_equal Jekyll::Configuration::DEFAULTS, Jekyll.configuration({})
127
- end
128
-
129
- should "fire warning with bad config" do
130
- mock(SafeYAML).load_file(@path) { Array.new }
131
- mock($stderr).puts(("WARNING: ".rjust(20) + "Error reading configuration. Using defaults (and options).").yellow)
132
- mock($stderr).puts("Configuration file: (INVALID) #{@path}".yellow)
133
- assert_equal Jekyll::Configuration::DEFAULTS, Jekyll.configuration({})
134
- end
135
-
136
- should "fire warning when user-specified config file isn't there" do
137
- mock(SafeYAML).load_file(@user_config) { raise SystemCallError, "No such file or directory - #{@user_config}" }
138
- mock($stderr).puts(("Fatal: ".rjust(20) + "The configuration file '#{@user_config}' could not be found.").red)
139
- assert_raises LoadError do
140
- Jekyll.configuration({'config' => [@user_config]})
141
- end
142
- end
143
-
144
- should "not clobber YAML.load to the dismay of other libraries" do
145
- assert_equal :foo, YAML.load(':foo')
146
- # as opposed to: assert_equal ':foo', SafeYAML.load(':foo')
147
- end
148
- end
149
- context "loading config from external file" do
150
- setup do
151
- @paths = {
152
- :default => File.join(Dir.pwd, '_config.yml'),
153
- :other => File.join(Dir.pwd, '_config.live.yml'),
154
- :toml => source_dir('_config.dev.toml'),
155
- :empty => ""
156
- }
157
- end
158
-
159
- should "load default config if no config_file is set" do
160
- mock(SafeYAML).load_file(@paths[:default]) { Hash.new }
161
- mock($stdout).puts("Configuration file: #{@paths[:default]}")
162
- assert_equal Jekyll::Configuration::DEFAULTS, Jekyll.configuration({})
163
- end
164
-
165
- should "load different config if specified" do
166
- mock(SafeYAML).load_file(@paths[:other]) { {"baseurl" => "http://wahoo.dev"} }
167
- mock($stdout).puts("Configuration file: #{@paths[:other]}")
168
- assert_equal Utils.deep_merge_hashes(Jekyll::Configuration::DEFAULTS, { "baseurl" => "http://wahoo.dev" }), Jekyll.configuration({ "config" => @paths[:other] })
169
- end
170
-
171
- should "load default config if path passed is empty" do
172
- mock(SafeYAML).load_file(@paths[:default]) { Hash.new }
173
- mock($stdout).puts("Configuration file: #{@paths[:default]}")
174
- assert_equal Jekyll::Configuration::DEFAULTS, Jekyll.configuration({ "config" => @paths[:empty] })
175
- end
176
-
177
- should "successfully load a TOML file" do
178
- Jekyll.logger.log_level = :warn
179
- assert_equal Jekyll::Configuration::DEFAULTS.merge({ "baseurl" => "/you-beautiful-blog-you", "title" => "My magnificent site, wut" }), Jekyll.configuration({ "config" => [@paths[:toml]] })
180
- Jekyll.logger.log_level = :info
181
- end
182
-
183
- should "load multiple config files" do
184
- mock(SafeYAML).load_file(@paths[:default]) { Hash.new }
185
- mock(SafeYAML).load_file(@paths[:other]) { Hash.new }
186
- mock(TOML).load_file(@paths[:toml]) { Hash.new }
187
- mock($stdout).puts("Configuration file: #{@paths[:default]}")
188
- mock($stdout).puts("Configuration file: #{@paths[:other]}")
189
- mock($stdout).puts("Configuration file: #{@paths[:toml]}")
190
- assert_equal Jekyll::Configuration::DEFAULTS, Jekyll.configuration({ "config" => [@paths[:default], @paths[:other], @paths[:toml]] })
191
- end
192
-
193
- should "load multiple config files and last config should win" do
194
- mock(SafeYAML).load_file(@paths[:default]) { {"baseurl" => "http://example.dev"} }
195
- mock(SafeYAML).load_file(@paths[:other]) { {"baseurl" => "http://wahoo.dev"} }
196
- mock($stdout).puts("Configuration file: #{@paths[:default]}")
197
- mock($stdout).puts("Configuration file: #{@paths[:other]}")
198
- assert_equal Utils.deep_merge_hashes(Jekyll::Configuration::DEFAULTS, { "baseurl" => "http://wahoo.dev" }), Jekyll.configuration({ "config" => [@paths[:default], @paths[:other]] })
199
- end
200
- end
201
- end
@@ -1,49 +0,0 @@
1
- require 'helper'
2
- require 'ostruct'
3
-
4
- class TestConvertible < Test::Unit::TestCase
5
- context "yaml front-matter" do
6
- setup do
7
- @convertible = OpenStruct.new
8
- @convertible.extend Jekyll::Convertible
9
- @base = File.expand_path('../fixtures', __FILE__)
10
- end
11
-
12
- should "parse the front-matter correctly" do
13
- ret = @convertible.read_yaml(@base, 'front_matter.erb')
14
- assert_equal({'test' => 'good'}, ret)
15
- end
16
-
17
- should "not parse if the front-matter is not at the start of the file" do
18
- ret = @convertible.read_yaml(@base, 'broken_front_matter1.erb')
19
- assert_equal({}, ret)
20
- end
21
-
22
- should "not parse if there is syntax error in front-matter" do
23
- name = 'broken_front_matter2.erb'
24
- out = capture_stderr do
25
- ret = @convertible.read_yaml(@base, name)
26
- assert_equal({}, ret)
27
- end
28
- assert_match(/YAML Exception|syntax error|Error reading file/, out)
29
- assert_match(/#{File.join(@base, name)}/, out)
30
- end
31
-
32
- should "not allow ruby objects in yaml" do
33
- out = capture_stderr do
34
- @convertible.read_yaml(@base, 'exploit_front_matter.erb')
35
- end
36
- assert_no_match /undefined class\/module DoesNotExist/, out
37
- end
38
-
39
- should "not parse if there is encoding error in file" do
40
- name = 'broken_front_matter3.erb'
41
- out = capture_stderr do
42
- ret = @convertible.read_yaml(@base, name, :encoding => 'utf-8')
43
- assert_equal({}, ret)
44
- end
45
- assert_match(/invalid byte sequence in UTF-8/, out)
46
- assert_match(/#{File.join(@base, name)}/, out)
47
- end
48
- end
49
- end
@@ -1,193 +0,0 @@
1
- require 'helper'
2
-
3
- class TestDocument < Test::Unit::TestCase
4
-
5
- context "a document in a collection" do
6
- setup do
7
- @site = Site.new(Jekyll.configuration({
8
- "collections" => ["methods"],
9
- "source" => source_dir,
10
- "destination" => dest_dir
11
- }))
12
- @site.process
13
- @document = @site.collections["methods"].docs.first
14
- end
15
-
16
- should "know its relative path" do
17
- assert_equal "_methods/configuration.md", @document.relative_path
18
- end
19
-
20
- should "knows its extname" do
21
- assert_equal ".md", @document.extname
22
- end
23
-
24
- should "know its basename" do
25
- assert_equal "configuration.md", @document.basename
26
- end
27
-
28
- should "allow the suffix to be specified for the basename" do
29
- assert_equal "configuration", @document.basename(".*")
30
- end
31
-
32
- should "know whether its a yaml file" do
33
- assert_equal false, @document.yaml_file?
34
- end
35
-
36
- should "know its data" do
37
- assert_equal({
38
- "title" => "Jekyll.configuration",
39
- "whatever" => "foo.bar"
40
- }, @document.data)
41
- end
42
-
43
- should "output the collection name in the #to_liquid method" do
44
- assert_equal @document.to_liquid['collection'], "methods"
45
- end
46
-
47
- end
48
-
49
- context "a document as part of a collection with frontmatter defaults" do
50
- setup do
51
- @site = Site.new(Jekyll.configuration({
52
- "collections" => ["slides"],
53
- "source" => source_dir,
54
- "destination" => dest_dir,
55
- "defaults" => [{
56
- "scope"=> {"path"=>"", "type"=>"slides"},
57
- "values"=> {
58
- "nested"=> {
59
- "key"=>"myval",
60
- }
61
- }
62
- }]
63
- }))
64
- @site.process
65
- @document = @site.collections["slides"].docs.first
66
- end
67
-
68
- should "know the frontmatter defaults" do
69
- assert_equal({
70
- "title"=>"Example slide",
71
- "layout"=>"slide",
72
- "nested"=> {
73
- "key"=>"myval"
74
- }
75
- }, @document.data)
76
- end
77
- end
78
-
79
- context "a document as part of a collection with overriden default values" do
80
- setup do
81
- @site = Site.new(Jekyll.configuration({
82
- "collections" => ["slides"],
83
- "source" => source_dir,
84
- "destination" => dest_dir,
85
- "defaults" => [{
86
- "scope"=> {"path"=>"", "type"=>"slides"},
87
- "values"=> {
88
- "nested"=> {
89
- "test1"=>"default1",
90
- "test2"=>"default1"
91
- }
92
- }
93
- }]
94
- }))
95
- @site.process
96
- @document = @site.collections["slides"].docs[1]
97
- end
98
-
99
- should "override default values in the document frontmatter" do
100
- assert_equal({
101
- "title"=>"Override title",
102
- "layout"=>"slide",
103
- "nested"=> {
104
- "test1"=>"override1",
105
- "test2"=>"override2"
106
- }
107
- }, @document.data)
108
- end
109
- end
110
-
111
- context "a document as part of a collection with valid path" do
112
- setup do
113
- @site = Site.new(Jekyll.configuration({
114
- "collections" => ["slides"],
115
- "source" => source_dir,
116
- "destination" => dest_dir,
117
- "defaults" => [{
118
- "scope"=> {"path"=>"slides", "type"=>"slides"},
119
- "values"=> {
120
- "nested"=> {
121
- "key"=>"value123",
122
- }
123
- }
124
- }]
125
- }))
126
- @site.process
127
- @document = @site.collections["slides"].docs.first
128
- end
129
-
130
- should "know the frontmatter defaults" do
131
- assert_equal({
132
- "title"=>"Example slide",
133
- "layout"=>"slide",
134
- "nested"=> {
135
- "key"=>"value123"
136
- }
137
- }, @document.data)
138
- end
139
- end
140
-
141
- context "a document as part of a collection with invalid path" do
142
- setup do
143
- @site = Site.new(Jekyll.configuration({
144
- "collections" => ["slides"],
145
- "source" => source_dir,
146
- "destination" => dest_dir,
147
- "defaults" => [{
148
- "scope"=> {"path"=>"somepath", "type"=>"slides"},
149
- "values"=> {
150
- "nested"=> {
151
- "key"=>"myval",
152
- }
153
- }
154
- }]
155
- }))
156
- @site.process
157
- @document = @site.collections["slides"].docs.first
158
- end
159
-
160
- should "not know the specified frontmatter defaults" do
161
- assert_equal({
162
- "title"=>"Example slide",
163
- "layout"=>"slide"
164
- }, @document.data)
165
- end
166
- end
167
-
168
- context "a document in a collection with a custom permalink" do
169
- setup do
170
- @site = Site.new(Jekyll.configuration({
171
- "collections" => ["slides"],
172
- "source" => source_dir,
173
- "destination" => dest_dir
174
- }))
175
- @site.process
176
- @document = @site.collections["slides"].docs[2]
177
- @dest_file = dest_dir("slide/3/index.html")
178
- end
179
-
180
- should "know its permalink" do
181
- assert_equal "/slide/3/", @document.permalink
182
- end
183
-
184
- should "produce the right URL" do
185
- assert_equal "/slide/3/", @document.url
186
- end
187
- end
188
-
189
-
190
- context " a document part of a rendered collection" do
191
- end
192
-
193
- end