jekyll 1.5.1 → 2.0.0.alpha.1
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.
- checksums.yaml +4 -4
- data/CONTRIBUTING.markdown +6 -6
- data/History.markdown +99 -23
- data/README.markdown +7 -3
- data/Rakefile +5 -5
- data/bin/jekyll +101 -116
- data/features/embed_filters.feature +13 -0
- data/features/include_tag.feature +11 -0
- data/features/markdown.feature +3 -3
- data/features/site_configuration.feature +34 -3
- data/features/step_definitions/jekyll_steps.rb +47 -34
- data/features/support/env.rb +25 -28
- data/jekyll.gemspec +38 -18
- data/lib/jekyll.rb +7 -15
- data/lib/jekyll/commands/build.rb +2 -0
- data/lib/jekyll/commands/serve.rb +11 -1
- data/lib/jekyll/configuration.rb +22 -6
- data/lib/jekyll/converter.rb +16 -16
- data/lib/jekyll/converters/markdown.rb +30 -15
- data/lib/jekyll/converters/markdown/maruku_parser.rb +4 -5
- data/lib/jekyll/converters/markdown/redcarpet_parser.rb +34 -3
- data/lib/jekyll/converters/sass.rb +58 -0
- data/lib/jekyll/converters/textile.rb +2 -2
- data/lib/jekyll/convertible.rb +25 -6
- data/lib/jekyll/core_ext.rb +0 -35
- data/lib/jekyll/deprecator.rb +2 -2
- data/lib/jekyll/entry_filter.rb +61 -25
- data/lib/jekyll/excerpt.rb +8 -6
- data/lib/jekyll/filters.rb +46 -2
- data/lib/jekyll/layout_reader.rb +40 -0
- data/lib/jekyll/mime.types +19 -9
- data/lib/jekyll/page.rb +6 -4
- data/lib/jekyll/post.rb +11 -18
- data/lib/jekyll/site.rb +34 -32
- data/lib/jekyll/tags/highlight.rb +26 -4
- data/lib/jekyll/tags/include.rb +29 -17
- data/lib/jekyll/tags/post_url.rb +10 -1
- data/lib/jekyll/url.rb +0 -2
- data/lib/site_template/_config.yml +1 -1
- data/lib/site_template/_posts/0000-00-00-welcome-to-jekyll.markdown.erb +1 -1
- data/lib/site_template/css/main.css +8 -1
- data/script/bootstrap +2 -0
- data/script/branding +11 -0
- data/script/cibuild +5 -0
- data/script/rebund +140 -0
- data/site/_config.yml +2 -2
- data/site/_data/docs.yml +44 -0
- data/site/{css → _includes/css}/gridism.css +0 -0
- data/site/_includes/css/normalize.css +1 -0
- data/site/{css → _includes/css}/pygments.css +2 -0
- data/site/{css → _includes/css}/style.css +10 -0
- data/site/_includes/docs_contents.html +4 -12
- data/site/_includes/docs_contents_mobile.html +4 -17
- data/site/_includes/docs_option.html +1 -1
- data/site/_includes/docs_ul.html +2 -2
- data/site/_includes/footer.html +1 -1
- data/site/_includes/top.html +1 -4
- data/site/_layouts/news_item.html +2 -2
- data/site/_posts/2013-07-24-jekyll-1-1-1-released.markdown +4 -4
- data/site/_posts/2013-09-14-jekyll-1-2-1-released.markdown +1 -1
- data/site/_posts/2013-10-28-jekyll-1-3-0-rc1-released.markdown +1 -1
- data/site/_posts/2013-12-09-jekyll-1-4-1-released.markdown +20 -0
- data/site/_posts/2014-01-13-jekyll-1-4-3-released.markdown +1 -2
- data/site/css/screen.css +27 -0
- data/site/docs/assets.md +46 -0
- data/site/docs/configuration.md +18 -4
- data/site/docs/contributing.md +2 -2
- data/site/docs/datafiles.md +6 -6
- data/site/docs/deployment-methods.md +5 -0
- data/site/docs/extras.md +38 -2
- data/site/docs/frontmatter.md +2 -1
- data/site/docs/history.md +0 -22
- data/site/docs/installation.md +7 -7
- data/site/docs/migrations.md +1 -1
- data/site/docs/plugins.md +11 -2
- data/site/docs/posts.md +25 -4
- data/site/docs/sites.md +1 -1
- data/site/docs/structure.md +1 -1
- data/site/docs/templates.md +13 -8
- data/site/docs/troubleshooting.md +8 -5
- data/site/docs/usage.md +11 -0
- data/site/docs/variables.md +18 -0
- data/site/docs/windows.md +44 -0
- data/test/helper.rb +5 -8
- data/test/source/_includes/include.html +1 -0
- data/test/source/_includes/sig.markdown +2 -2
- data/test/source/_posts/2013-12-17-include-variable-filters.markdown +21 -0
- data/test/source/_posts/2013-12-20-properties.text +11 -0
- data/test/source/_sass/_grid.scss +1 -0
- data/test/source/css/main.scss +4 -0
- data/test/source/js/coffeescript.coffee +10 -0
- data/test/source/properties.html +8 -0
- data/test/source/unpublished.html +7 -0
- data/test/test_coffeescript.rb +49 -0
- data/test/test_configuration.rb +29 -18
- data/test/test_convertible.rb +7 -9
- data/test/test_core_ext.rb +0 -22
- data/test/test_entry_filter.rb +36 -2
- data/test/test_excerpt.rb +43 -1
- data/test/test_filters.rb +44 -5
- data/test/test_generated_site.rb +5 -1
- data/test/test_layout_reader.rb +17 -0
- data/test/test_page.rb +28 -10
- data/test/test_post.rb +32 -15
- data/test/test_redcarpet.rb +19 -3
- data/test/test_sass.rb +122 -0
- data/test/test_site.rb +56 -7
- data/test/test_tags.rb +102 -51
- metadata +154 -80
- data/site/_posts/2014-03-24-jekyll-1-5-0-released.markdown +0 -19
- data/site/_posts/2014-03-27-jekyll-1-5-1-released.markdown +0 -26
- data/site/css/normalize.css +0 -1
- data/test/source/_posts/2014-01-06-permalink-traversal.md +0 -5
- data/test/source/exploit.md +0 -5
- data/test/test_path_sanitization.rb +0 -18
data/site/docs/templates.md
CHANGED
@@ -209,9 +209,7 @@ root of your source directory. This will embed the contents of
|
|
209
209
|
|
210
210
|
The name of the file you wish to embed can be literal (as in the example above),
|
211
211
|
or you can use a variable, using liquid-like variable syntax as in
|
212
|
-
<code>{% raw %}{% include {{my_variable}} %}{% endraw %}</code>.
|
213
|
-
|
214
|
-
Note that unlike usual liquid variable syntax, you cannot have spaces inside the curly braces.
|
212
|
+
<code>{% raw %}{% include {{ my_variable }} %}{% endraw %}</code>.
|
215
213
|
|
216
214
|
</p>
|
217
215
|
</div>
|
@@ -232,8 +230,14 @@ These parameters are available via Liquid in the include:
|
|
232
230
|
|
233
231
|
Jekyll has built in support for syntax highlighting of [over 100
|
234
232
|
languages](http://pygments.org/languages/) thanks to
|
235
|
-
[Pygments](http://pygments.org/). To use Pygments, you must have Python installed
|
236
|
-
system and set `
|
233
|
+
[Pygments](http://pygments.org/). To use Pygments, you must have Python installed
|
234
|
+
on your system and set `highlighter` to `pygments` in your site's configuration
|
235
|
+
file.
|
236
|
+
|
237
|
+
Alternatively, you can use [Rouge](https://github.com/jayferd/rouge) to highlight
|
238
|
+
your code snippets. It doesn't support as many languages as Pygments does but
|
239
|
+
it should fit in most cases and it's written in pure Ruby ; you don't need Python
|
240
|
+
on your system!
|
237
241
|
|
238
242
|
To render a code block with syntax highlighting, surround your code as follows:
|
239
243
|
|
@@ -249,8 +253,9 @@ end
|
|
249
253
|
|
250
254
|
The argument to the `highlight` tag (`ruby` in the example above) is the
|
251
255
|
language identifier. To find the appropriate identifier to use for the language
|
252
|
-
you want to highlight, look for the “short name” on the [Lexers
|
253
|
-
page](http://pygments.org/docs/lexers/)
|
256
|
+
you want to highlight, look for the “short name” on the [Pygments' Lexers
|
257
|
+
page](http://pygments.org/docs/lexers/) or the [Rouge
|
258
|
+
wiki](https://github.com/jayferd/rouge/wiki/List-of-supported-languages-and-lexers).
|
254
259
|
|
255
260
|
#### Line numbers
|
256
261
|
|
@@ -290,7 +295,7 @@ will generate the correct permalink URL for the post you specify.
|
|
290
295
|
{% endraw %}
|
291
296
|
{% endhighlight %}
|
292
297
|
|
293
|
-
If you organize your posts in subdirectories, you need to include subdirectory
|
298
|
+
If you organize your posts in subdirectories, you need to include subdirectory
|
294
299
|
path to the post:
|
295
300
|
|
296
301
|
{% highlight text %}
|
@@ -28,10 +28,13 @@ sudo yum install ruby-devel
|
|
28
28
|
{% endhighlight %}
|
29
29
|
|
30
30
|
On [NearlyFreeSpeech](http://nearlyfreespeech.net/) you need to run the
|
31
|
-
|
31
|
+
following commands before installing Jekyll:
|
32
32
|
|
33
33
|
{% highlight bash %}
|
34
|
-
|
34
|
+
export GEM_HOME=/home/private/gems
|
35
|
+
export GEM_PATH=/home/private/gems:/usr/local/lib/ruby/gems/1.8/
|
36
|
+
export PATH=$PATH:/home/private/gems/bin
|
37
|
+
export RB_USER_INSTALL='true'
|
35
38
|
{% endhighlight %}
|
36
39
|
|
37
40
|
On OSX, you may need to update RubyGems:
|
@@ -41,7 +44,7 @@ sudo gem update --system
|
|
41
44
|
{% endhighlight %}
|
42
45
|
|
43
46
|
If you still have issues, you may need to [use XCode to install Command Line
|
44
|
-
Tools](http://www.zlu.me/
|
47
|
+
Tools](http://www.zlu.me/ruby/os%20x/gem/mountain%20lion/2012/02/21/install-native-ruby-gem-in-mountain-lion-preview.html)
|
45
48
|
that will allow you to install native gems using the following command:
|
46
49
|
|
47
50
|
{% highlight bash %}
|
@@ -123,8 +126,8 @@ bug](http://aaronqian.com/articles/2009/04/07/redcloth-ate-my-notextile.html)
|
|
123
126
|
and will hopefully be fixed for 4.2. You can still use 4.1.9, but the
|
124
127
|
test suite requires that 4.1.0 be installed. If you use a version of
|
125
128
|
RedCloth that does not have the notextile tag, you may notice that
|
126
|
-
syntax highlighted blocks from Pygments are not formatted
|
127
|
-
among other things. If you’re seeing this just install 4.1.0.
|
129
|
+
syntax highlighted blocks from Pygments or Rouge are not formatted
|
130
|
+
correctly, among other things. If you’re seeing this just install 4.1.0.
|
128
131
|
|
129
132
|
### Liquid
|
130
133
|
|
data/site/docs/usage.md
CHANGED
@@ -24,6 +24,17 @@ $ jekyll build --watch
|
|
24
24
|
# watched for changes, and regenerated automatically.
|
25
25
|
{% endhighlight %}
|
26
26
|
|
27
|
+
<div class="note warning">
|
28
|
+
<h5>Destination folders are cleaned on site builds</h5>
|
29
|
+
<p>
|
30
|
+
The contents of <code><destination></code> are automatically
|
31
|
+
cleaned when the site is built. Files or folders that are not
|
32
|
+
created by your site will be removed. Do not use an important
|
33
|
+
location for <code><destination></code>; instead, use it as
|
34
|
+
a staging area and copy files from there to your web server.
|
35
|
+
</p>
|
36
|
+
</div>
|
37
|
+
|
27
38
|
Jekyll also comes with a built-in development server that will allow you to
|
28
39
|
preview what the generated site will look like in your browser locally.
|
29
40
|
|
data/site/docs/variables.md
CHANGED
@@ -244,6 +244,24 @@ following is a reference of the available data.
|
|
244
244
|
|
245
245
|
</p></td>
|
246
246
|
</tr>
|
247
|
+
<tr>
|
248
|
+
<td><p><code>page.next</code></p></td>
|
249
|
+
<td><p>
|
250
|
+
|
251
|
+
The next post relative to the position of the current post in
|
252
|
+
<code>site.posts</code>. Returns <code>nil</code> for the last entry.
|
253
|
+
|
254
|
+
</p></td>
|
255
|
+
</tr>
|
256
|
+
<tr>
|
257
|
+
<td><p><code>page.previous</code></p></td>
|
258
|
+
<td><p>
|
259
|
+
|
260
|
+
The previous post relative to the position of the current post in
|
261
|
+
<code>site.posts</code>. Returns <code>nil</code> for the first entry.
|
262
|
+
|
263
|
+
</p></td>
|
264
|
+
</tr>
|
247
265
|
</tbody>
|
248
266
|
</table>
|
249
267
|
</div>
|
@@ -0,0 +1,44 @@
|
|
1
|
+
---
|
2
|
+
layout: docs
|
3
|
+
title: Jekyll on Windows
|
4
|
+
prev_section: configuration
|
5
|
+
next_section: posts
|
6
|
+
permalink: /docs/windows/
|
7
|
+
---
|
8
|
+
|
9
|
+
While Windows is not an officially-supported platform, it can be used to run
|
10
|
+
Jekyll with the proper tweaks. This page aims to collect some of the general
|
11
|
+
knowledge and lessons that have been unearthed by Windows users.
|
12
|
+
|
13
|
+
## Installation
|
14
|
+
|
15
|
+
Madhur Ahuja has written up instructions to get
|
16
|
+
[Jekyll running on Windows][windows-installation] and it seems to work for most.
|
17
|
+
|
18
|
+
## Encoding
|
19
|
+
|
20
|
+
If you use UTF-8 encoding, make sure that no `BOM` header
|
21
|
+
characters exist in your files or very, very bad things will happen to
|
22
|
+
Jekyll. This is especially relevant if you're running Jekyll on Windows.
|
23
|
+
|
24
|
+
Additionally, you might need to change the code page of the console window to UTF-8
|
25
|
+
in case you get a "Liquid Exception: Incompatible character encoding" error during
|
26
|
+
the site generation process. It can be done with the following command:
|
27
|
+
|
28
|
+
{% highlight bash %}
|
29
|
+
$ chcp 65001
|
30
|
+
{% endhighlight %}
|
31
|
+
|
32
|
+
[windows-installation]: http://www.madhur.co.in/blog/2011/09/01/runningjekyllwindows.html
|
33
|
+
|
34
|
+
## Auto-regeneration
|
35
|
+
|
36
|
+
As of v1.3.0, Jekyll uses the `listen` gem to watch for changes when the
|
37
|
+
`--watch` switch is specified during a build or serve. While `listen` has
|
38
|
+
built-in support for UNIX systems, it requires an extra gem for compatibility
|
39
|
+
with Windows. Add the following to the Gemfile for your site:
|
40
|
+
|
41
|
+
{% highlight ruby %}
|
42
|
+
require 'rbconfig'
|
43
|
+
gem 'wdm', '~> 0.1.0' if RbConfig::CONFIG['target_os'] =~ /mswin|mingw/i
|
44
|
+
{% endhighlight %}
|
data/test/helper.rb
CHANGED
@@ -1,11 +1,9 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
SimpleCov.start('gem')
|
1
|
+
require 'simplecov'
|
2
|
+
require 'simplecov-gem-adapter'
|
3
|
+
SimpleCov.start('gem')
|
5
4
|
|
6
|
-
|
7
|
-
|
8
|
-
end
|
5
|
+
require 'coveralls'
|
6
|
+
Coveralls.wear_merged!
|
9
7
|
|
10
8
|
require 'rubygems'
|
11
9
|
require 'test/unit'
|
@@ -19,7 +17,6 @@ require 'rdiscount'
|
|
19
17
|
require 'kramdown'
|
20
18
|
require 'redcarpet'
|
21
19
|
|
22
|
-
require 'redgreen' if RUBY_VERSION < '1.9'
|
23
20
|
require 'shoulda'
|
24
21
|
require 'rr'
|
25
22
|
|
@@ -0,0 +1 @@
|
|
1
|
+
included
|
@@ -1,3 +1,3 @@
|
|
1
|
-
|
1
|
+
---
|
2
2
|
Tom Preston-Werner
|
3
|
-
github.com/mojombo
|
3
|
+
github.com/mojombo
|
@@ -0,0 +1,21 @@
|
|
1
|
+
---
|
2
|
+
title: Post
|
3
|
+
layout: post
|
4
|
+
include1: include.html
|
5
|
+
include2: include
|
6
|
+
include3: INCLUDE
|
7
|
+
include4: params
|
8
|
+
---
|
9
|
+
|
10
|
+
Liquid tests
|
11
|
+
- 1 {% include {{ page.include1 }} %}
|
12
|
+
- 2 {% include {{ page.include2 | append: '.html' }} %}
|
13
|
+
- 3 {% include {{ page.include3 | downcase | append: '.html' }} %}
|
14
|
+
|
15
|
+
Whitespace tests
|
16
|
+
- 4 {% include {{page.include1}} %}
|
17
|
+
- 5 {% include {{ page.include1}} %}
|
18
|
+
- 6 {% include {{ page.include3 | downcase | append: '.html'}} %}
|
19
|
+
|
20
|
+
Parameters test
|
21
|
+
- 7 {% include {{ page.include4 | append: '.html' }} var1='foo' var2='bar' %}
|
@@ -0,0 +1 @@
|
|
1
|
+
.half { width: 50%; }
|
@@ -0,0 +1,49 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
class TestCoffeeScript < Test::Unit::TestCase
|
4
|
+
context "converting CoffeeScript" do
|
5
|
+
setup do
|
6
|
+
@site = Jekyll::Site.new(Jekyll.configuration({
|
7
|
+
"source" => source_dir,
|
8
|
+
"destination" => dest_dir
|
9
|
+
}))
|
10
|
+
@site.process
|
11
|
+
@test_coffeescript_file = dest_dir("js/coffeescript.js")
|
12
|
+
@js_output = <<-JS
|
13
|
+
(function() {
|
14
|
+
$(function() {
|
15
|
+
var cube, cubes, list, num, square;
|
16
|
+
list = [1, 2, 3, 4, 5];
|
17
|
+
square = function(x) {
|
18
|
+
return x * x;
|
19
|
+
};
|
20
|
+
cube = function(x) {
|
21
|
+
return square(x) * x;
|
22
|
+
};
|
23
|
+
cubes = (function() {
|
24
|
+
var _i, _len, _results;
|
25
|
+
_results = [];
|
26
|
+
for (_i = 0, _len = list.length; _i < _len; _i++) {
|
27
|
+
num = list[_i];
|
28
|
+
_results.push(math.cube(num));
|
29
|
+
}
|
30
|
+
return _results;
|
31
|
+
})();
|
32
|
+
if (typeof elvis !== \"undefined\" && elvis !== null) {
|
33
|
+
return alert(\"I knew it!\");
|
34
|
+
}
|
35
|
+
});
|
36
|
+
|
37
|
+
}).call(this);
|
38
|
+
JS
|
39
|
+
end
|
40
|
+
|
41
|
+
should "write a JS file in place" do
|
42
|
+
assert File.exists?(@test_coffeescript_file), "Can't find the converted CoffeeScript file in the dest_dir."
|
43
|
+
end
|
44
|
+
|
45
|
+
should "produce JS" do
|
46
|
+
assert_equal @js_output, File.read(@test_coffeescript_file)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
data/test/test_configuration.rb
CHANGED
@@ -4,14 +4,14 @@ class TestConfiguration < Test::Unit::TestCase
|
|
4
4
|
context "#stringify_keys" do
|
5
5
|
setup do
|
6
6
|
@mixed_keys = Configuration[{
|
7
|
-
'markdown' => '
|
7
|
+
'markdown' => 'kramdown',
|
8
8
|
:permalink => 'date',
|
9
9
|
'baseurl' => '/',
|
10
10
|
:include => ['.htaccess'],
|
11
11
|
:source => './'
|
12
12
|
}]
|
13
13
|
@string_keys = Configuration[{
|
14
|
-
'markdown' => '
|
14
|
+
'markdown' => 'kramdown',
|
15
15
|
'permalink' => 'date',
|
16
16
|
'baseurl' => '/',
|
17
17
|
'include' => ['.htaccess'],
|
@@ -51,11 +51,12 @@ class TestConfiguration < Test::Unit::TestCase
|
|
51
51
|
context "#backwards_compatibilize" do
|
52
52
|
setup do
|
53
53
|
@config = Configuration[{
|
54
|
-
"auto"
|
55
|
-
"watch"
|
56
|
-
"server"
|
57
|
-
"exclude"
|
58
|
-
"include"
|
54
|
+
"auto" => true,
|
55
|
+
"watch" => true,
|
56
|
+
"server" => true,
|
57
|
+
"exclude" => "READ-ME.md, Gemfile,CONTRIBUTING.hello.markdown",
|
58
|
+
"include" => "STOP_THE_PRESSES.txt,.heloses, .git",
|
59
|
+
"pygments" => true,
|
59
60
|
}]
|
60
61
|
end
|
61
62
|
should "unset 'auto' and 'watch'" do
|
@@ -78,6 +79,11 @@ class TestConfiguration < Test::Unit::TestCase
|
|
78
79
|
assert @config.backwards_compatibilize.has_key?("include")
|
79
80
|
assert_equal @config.backwards_compatibilize["include"], %w[STOP_THE_PRESSES.txt .heloses .git]
|
80
81
|
end
|
82
|
+
should "set highlighter to pygments" do
|
83
|
+
assert @config.has_key?("pygments")
|
84
|
+
assert !@config.backwards_compatibilize.has_key?("pygments")
|
85
|
+
assert_equal @config.backwards_compatibilize["highlighter"], "pygments"
|
86
|
+
end
|
81
87
|
end
|
82
88
|
context "#fix_common_issues" do
|
83
89
|
setup do
|
@@ -100,31 +106,36 @@ class TestConfiguration < Test::Unit::TestCase
|
|
100
106
|
end
|
101
107
|
|
102
108
|
should "fire warning with no _config.yml" do
|
103
|
-
mock(
|
109
|
+
mock(SafeYAML).load_file(@path) { raise SystemCallError, "No such file or directory - #{@path}" }
|
104
110
|
mock($stderr).puts("Configuration file: none".yellow)
|
105
111
|
assert_equal Jekyll::Configuration::DEFAULTS, Jekyll.configuration({})
|
106
112
|
end
|
107
113
|
|
108
114
|
should "load configuration as hash" do
|
109
|
-
mock(
|
115
|
+
mock(SafeYAML).load_file(@path) { Hash.new }
|
110
116
|
mock($stdout).puts("Configuration file: #{@path}")
|
111
117
|
assert_equal Jekyll::Configuration::DEFAULTS, Jekyll.configuration({})
|
112
118
|
end
|
113
119
|
|
114
120
|
should "fire warning with bad config" do
|
115
|
-
mock(
|
121
|
+
mock(SafeYAML).load_file(@path) { Array.new }
|
116
122
|
mock($stderr).puts(("WARNING: ".rjust(20) + "Error reading configuration. Using defaults (and options).").yellow)
|
117
123
|
mock($stderr).puts("Configuration file: (INVALID) #{@path}".yellow)
|
118
124
|
assert_equal Jekyll::Configuration::DEFAULTS, Jekyll.configuration({})
|
119
125
|
end
|
120
126
|
|
121
127
|
should "fire warning when user-specified config file isn't there" do
|
122
|
-
mock(
|
128
|
+
mock(SafeYAML).load_file(@user_config) { raise SystemCallError, "No such file or directory - #{@user_config}" }
|
123
129
|
mock($stderr).puts(("Fatal: ".rjust(20) + "The configuration file '#{@user_config}' could not be found.").red)
|
124
130
|
assert_raises LoadError do
|
125
131
|
Jekyll.configuration({'config' => [@user_config]})
|
126
132
|
end
|
127
133
|
end
|
134
|
+
|
135
|
+
should "not clobber YAML.load to the dismay of other libraries" do
|
136
|
+
assert_equal :foo, YAML.load(':foo')
|
137
|
+
# as opposed to: assert_equal ':foo', SafeYAML.load(':foo')
|
138
|
+
end
|
128
139
|
end
|
129
140
|
context "loading config from external file" do
|
130
141
|
setup do
|
@@ -137,19 +148,19 @@ class TestConfiguration < Test::Unit::TestCase
|
|
137
148
|
end
|
138
149
|
|
139
150
|
should "load default config if no config_file is set" do
|
140
|
-
mock(
|
151
|
+
mock(SafeYAML).load_file(@paths[:default]) { Hash.new }
|
141
152
|
mock($stdout).puts("Configuration file: #{@paths[:default]}")
|
142
153
|
assert_equal Jekyll::Configuration::DEFAULTS, Jekyll.configuration({})
|
143
154
|
end
|
144
155
|
|
145
156
|
should "load different config if specified" do
|
146
|
-
mock(
|
157
|
+
mock(SafeYAML).load_file(@paths[:other]) { {"baseurl" => "http://wahoo.dev"} }
|
147
158
|
mock($stdout).puts("Configuration file: #{@paths[:other]}")
|
148
159
|
assert_equal Jekyll::Configuration::DEFAULTS.deep_merge({ "baseurl" => "http://wahoo.dev" }), Jekyll.configuration({ "config" => @paths[:other] })
|
149
160
|
end
|
150
161
|
|
151
162
|
should "load default config if path passed is empty" do
|
152
|
-
mock(
|
163
|
+
mock(SafeYAML).load_file(@paths[:default]) { Hash.new }
|
153
164
|
mock($stdout).puts("Configuration file: #{@paths[:default]}")
|
154
165
|
assert_equal Jekyll::Configuration::DEFAULTS, Jekyll.configuration({ "config" => @paths[:empty] })
|
155
166
|
end
|
@@ -161,8 +172,8 @@ class TestConfiguration < Test::Unit::TestCase
|
|
161
172
|
end
|
162
173
|
|
163
174
|
should "load multiple config files" do
|
164
|
-
mock(
|
165
|
-
mock(
|
175
|
+
mock(SafeYAML).load_file(@paths[:default]) { Hash.new }
|
176
|
+
mock(SafeYAML).load_file(@paths[:other]) { Hash.new }
|
166
177
|
mock(TOML).load_file(@paths[:toml]) { Hash.new }
|
167
178
|
mock($stdout).puts("Configuration file: #{@paths[:default]}")
|
168
179
|
mock($stdout).puts("Configuration file: #{@paths[:other]}")
|
@@ -171,8 +182,8 @@ class TestConfiguration < Test::Unit::TestCase
|
|
171
182
|
end
|
172
183
|
|
173
184
|
should "load multiple config files and last config should win" do
|
174
|
-
mock(
|
175
|
-
mock(
|
185
|
+
mock(SafeYAML).load_file(@paths[:default]) { {"baseurl" => "http://example.dev"} }
|
186
|
+
mock(SafeYAML).load_file(@paths[:other]) { {"baseurl" => "http://wahoo.dev"} }
|
176
187
|
mock($stdout).puts("Configuration file: #{@paths[:default]}")
|
177
188
|
mock($stdout).puts("Configuration file: #{@paths[:other]}")
|
178
189
|
assert_equal Jekyll::Configuration::DEFAULTS.deep_merge({ "baseurl" => "http://wahoo.dev" }), Jekyll.configuration({ "config" => [@paths[:default], @paths[:other]] })
|