jberkel-jekyll 0.5.4
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.
- data/.gitignore +6 -0
- data/History.txt +151 -0
- data/README.textile +42 -0
- data/Rakefile +90 -0
- data/VERSION.yml +4 -0
- data/bin/jekyll +168 -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 +65 -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 +141 -0
- data/lib/jekyll/albino.rb +122 -0
- data/lib/jekyll/converters/csv.rb +26 -0
- data/lib/jekyll/converters/marley.rb +53 -0
- data/lib/jekyll/converters/mephisto.rb +79 -0
- data/lib/jekyll/converters/mt.rb +59 -0
- data/lib/jekyll/converters/textpattern.rb +50 -0
- data/lib/jekyll/converters/typo.rb +49 -0
- data/lib/jekyll/converters/wordpress.rb +54 -0
- data/lib/jekyll/convertible.rb +117 -0
- data/lib/jekyll/core_ext.rb +38 -0
- data/lib/jekyll/filters.rb +51 -0
- data/lib/jekyll/haml_helpers.rb +15 -0
- data/lib/jekyll/layout.rb +37 -0
- data/lib/jekyll/page.rb +112 -0
- data/lib/jekyll/pager.rb +45 -0
- data/lib/jekyll/post.rb +310 -0
- data/lib/jekyll/site.rb +316 -0
- data/lib/jekyll/tags/highlight.rb +56 -0
- data/lib/jekyll/tags/include.rb +31 -0
- data/lib/jekyll.rb +86 -0
- data/test/helper.rb +27 -0
- data/test/source/_includes/sig.markdown +3 -0
- data/test/source/_layouts/default.html +27 -0
- data/test/source/_layouts/simple.html +1 -0
- data/test/source/_posts/2008-02-02-not-published.textile +8 -0
- data/test/source/_posts/2008-02-02-published.textile +8 -0
- data/test/source/_posts/2008-10-18-foo-bar.textile +8 -0
- data/test/source/_posts/2008-11-21-complex.textile +8 -0
- data/test/source/_posts/2008-12-03-permalinked-post.textile +9 -0
- data/test/source/_posts/2008-12-13-include.markdown +8 -0
- data/test/source/_posts/2009-01-27-array-categories.textile +10 -0
- data/test/source/_posts/2009-01-27-categories.textile +7 -0
- data/test/source/_posts/2009-01-27-category.textile +7 -0
- data/test/source/_posts/2009-03-12-hash-#1.markdown +6 -0
- 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/category/_posts/2008-9-23-categories.textile +6 -0
- data/test/source/contacts.html +5 -0
- data/test/source/css/screen.css +76 -0
- data/test/source/foo/_posts/bar/2008-12-12-topical-post.textile +8 -0
- data/test/source/index.html +22 -0
- data/test/source/sitemap.xml +23 -0
- data/test/source/win/_posts/2009-05-24-yaml-linebreak.markdown +7 -0
- data/test/source/z_category/_posts/2008-9-23-categories.textile +6 -0
- data/test/suite.rb +9 -0
- data/test/test_configuration.rb +29 -0
- data/test/test_filters.rb +49 -0
- data/test/test_generated_site.rb +40 -0
- data/test/test_page.rb +98 -0
- data/test/test_pager.rb +47 -0
- data/test/test_post.rb +302 -0
- data/test/test_site.rb +85 -0
- data/test/test_tags.rb +116 -0
- metadata +194 -0
@@ -0,0 +1,153 @@
|
|
1
|
+
Feature: Post data
|
2
|
+
As a hacker who likes to blog
|
3
|
+
I want to be able to embed data into my posts
|
4
|
+
In order to make the posts slightly dynamic
|
5
|
+
|
6
|
+
Scenario: Use post.title variable
|
7
|
+
Given I have a _posts directory
|
8
|
+
And I have a _layouts directory
|
9
|
+
And I have the following post:
|
10
|
+
| title | date | layout | content |
|
11
|
+
| Star Wars | 3/27/2009 | simple | Luke, I am your father. |
|
12
|
+
And I have a simple layout that contains "Post title: {{ site.posts.first.title }}"
|
13
|
+
When I run jekyll
|
14
|
+
Then the _site directory should exist
|
15
|
+
And I should see "Post title: Star Wars" in "_site/2009/03/27/star-wars.html"
|
16
|
+
|
17
|
+
Scenario: Use post.url variable
|
18
|
+
Given I have a _posts directory
|
19
|
+
And I have a _layouts directory
|
20
|
+
And I have the following post:
|
21
|
+
| title | date | layout | content |
|
22
|
+
| Star Wars | 3/27/2009 | simple | Luke, I am your father. |
|
23
|
+
And I have a simple layout that contains "Post url: {{ site.posts.first.url }}"
|
24
|
+
When I run jekyll
|
25
|
+
Then the _site directory should exist
|
26
|
+
And I should see "Post url: /2009/03/27/star-wars.html" in "_site/2009/03/27/star-wars.html"
|
27
|
+
|
28
|
+
Scenario: Use post.date variable
|
29
|
+
Given I have a _posts directory
|
30
|
+
And I have a _layouts directory
|
31
|
+
And I have the following post:
|
32
|
+
| title | date | layout | content |
|
33
|
+
| Star Wars | 3/27/2009 | simple | Luke, I am your father. |
|
34
|
+
And I have a simple layout that contains "Post date: {{ site.posts.first.date }}"
|
35
|
+
When I run jekyll
|
36
|
+
Then the _site directory should exist
|
37
|
+
And I should see "Post date: Fri Mar 27" in "_site/2009/03/27/star-wars.html"
|
38
|
+
|
39
|
+
Scenario: Use post.id variable
|
40
|
+
Given I have a _posts directory
|
41
|
+
And I have a _layouts directory
|
42
|
+
And I have the following post:
|
43
|
+
| title | date | layout | content |
|
44
|
+
| Star Wars | 3/27/2009 | simple | Luke, I am your father. |
|
45
|
+
And I have a simple layout that contains "Post id: {{ site.posts.first.id }}"
|
46
|
+
When I run jekyll
|
47
|
+
Then the _site directory should exist
|
48
|
+
And I should see "Post id: /2009/03/27/star-wars" in "_site/2009/03/27/star-wars.html"
|
49
|
+
|
50
|
+
Scenario: Use post.content variable
|
51
|
+
Given I have a _posts directory
|
52
|
+
And I have a _layouts directory
|
53
|
+
And I have the following post:
|
54
|
+
| title | date | layout | content |
|
55
|
+
| Star Wars | 3/27/2009 | simple | Luke, I am your father. |
|
56
|
+
And I have a simple layout that contains "Post content: {{ site.posts.first.content }}"
|
57
|
+
When I run jekyll
|
58
|
+
Then the _site directory should exist
|
59
|
+
And I should see "Post content: <p>Luke, I am your father.</p>" in "_site/2009/03/27/star-wars.html"
|
60
|
+
|
61
|
+
Scenario: Use post.categories variable when category is in a folder
|
62
|
+
Given I have a movies directory
|
63
|
+
And I have a movies/_posts directory
|
64
|
+
And I have a _layouts directory
|
65
|
+
And I have the following post in "movies":
|
66
|
+
| title | date | layout | content |
|
67
|
+
| Star Wars | 3/27/2009 | simple | Luke, I am your father. |
|
68
|
+
And I have a simple layout that contains "Post category: {{ site.posts.first.categories }}"
|
69
|
+
When I run jekyll
|
70
|
+
Then the _site directory should exist
|
71
|
+
And I should see "Post category: movies" in "_site/movies/2009/03/27/star-wars.html"
|
72
|
+
|
73
|
+
Scenario: Use post.tags variable
|
74
|
+
Given I have a _posts directory
|
75
|
+
And I have a _layouts directory
|
76
|
+
And I have the following post:
|
77
|
+
| title | date | layout | tag | content |
|
78
|
+
| Star Wars | 5/18/2009 | simple | twist | Luke, I am your father. |
|
79
|
+
And I have a simple layout that contains "Post tags: {{ site.posts.first.tags }}"
|
80
|
+
When I run jekyll
|
81
|
+
Then the _site directory should exist
|
82
|
+
And I should see "Post tags: twist" in "_site/2009/05/18/star-wars.html"
|
83
|
+
|
84
|
+
Scenario: Use post.categories variable when categories are in folders
|
85
|
+
Given I have a movies directory
|
86
|
+
And I have a movies/scifi directory
|
87
|
+
And I have a movies/scifi/_posts directory
|
88
|
+
And I have a _layouts directory
|
89
|
+
And I have the following post in "movies/scifi":
|
90
|
+
| title | date | layout | content |
|
91
|
+
| Star Wars | 3/27/2009 | simple | Luke, I am your father. |
|
92
|
+
And I have a simple layout that contains "Post categories: {{ site.posts.first.categories | array_to_sentence_string }}"
|
93
|
+
When I run jekyll
|
94
|
+
Then the _site directory should exist
|
95
|
+
And I should see "Post categories: movies and scifi" in "_site/movies/scifi/2009/03/27/star-wars.html"
|
96
|
+
|
97
|
+
Scenario: Use post.categories variable when category is in YAML
|
98
|
+
Given I have a _posts directory
|
99
|
+
And I have a _layouts directory
|
100
|
+
And I have the following post:
|
101
|
+
| title | date | layout | category | content |
|
102
|
+
| Star Wars | 3/27/2009 | simple | movies | Luke, I am your father. |
|
103
|
+
And I have a simple layout that contains "Post category: {{ site.posts.first.categories }}"
|
104
|
+
When I run jekyll
|
105
|
+
Then the _site directory should exist
|
106
|
+
And I should see "Post category: movies" in "_site/movies/2009/03/27/star-wars.html"
|
107
|
+
|
108
|
+
Scenario: Use post.categories variable when categories are in YAML
|
109
|
+
Given I have a _posts directory
|
110
|
+
And I have a _layouts directory
|
111
|
+
And I have the following post:
|
112
|
+
| title | date | layout | categories | content |
|
113
|
+
| Star Wars | 3/27/2009 | simple | ['movies', 'scifi'] | Luke, I am your father. |
|
114
|
+
And I have a simple layout that contains "Post categories: {{ site.posts.first.categories | array_to_sentence_string }}"
|
115
|
+
When I run jekyll
|
116
|
+
Then the _site directory should exist
|
117
|
+
And I should see "Post categories: movies and scifi" in "_site/movies/scifi/2009/03/27/star-wars.html"
|
118
|
+
|
119
|
+
Scenario: Disable a post from being published
|
120
|
+
Given I have a _posts directory
|
121
|
+
And I have an "index.html" file that contains "Published!"
|
122
|
+
And I have the following post:
|
123
|
+
| title | date | layout | published | content |
|
124
|
+
| Star Wars | 3/27/2009 | simple | false | Luke, I am your father. |
|
125
|
+
When I run jekyll
|
126
|
+
Then the _site directory should exist
|
127
|
+
And the "_site/2009/03/27/star-wars.html" file should not exist
|
128
|
+
And I should see "Published!" in "_site/index.html"
|
129
|
+
|
130
|
+
Scenario: Use a custom variable
|
131
|
+
Given I have a _posts directory
|
132
|
+
And I have a _layouts directory
|
133
|
+
And I have the following post:
|
134
|
+
| title | date | layout | author | content |
|
135
|
+
| Star Wars | 3/27/2009 | simple | Darth Vader | Luke, I am your father. |
|
136
|
+
And I have a simple layout that contains "Post author: {{ site.posts.first.author }}"
|
137
|
+
When I run jekyll
|
138
|
+
Then the _site directory should exist
|
139
|
+
And I should see "Post author: Darth Vader" in "_site/2009/03/27/star-wars.html"
|
140
|
+
|
141
|
+
Scenario: Previous and next posts title
|
142
|
+
Given I have a _posts directory
|
143
|
+
And I have a _layouts directory
|
144
|
+
And I have the following posts:
|
145
|
+
| title | date | layout | author | content |
|
146
|
+
| Star Wars | 3/27/2009 | ordered | Darth Vader | Luke, I am your father. |
|
147
|
+
| Some like it hot | 4/27/2009 | ordered | Osgood | Nobody is perfect. |
|
148
|
+
| Terminator | 5/27/2009 | ordered | Arnold | Sayonara, baby |
|
149
|
+
And I have a ordered layout that contains "Previous post: {{ page.previous.title }} and next post: {{ page.next.title }}"
|
150
|
+
When I run jekyll
|
151
|
+
Then the _site directory should exist
|
152
|
+
And I should see "next post: Some like it hot" in "_site/2009/03/27/star-wars.html"
|
153
|
+
And I should see "Previous post: Some like it hot" in "_site/2009/05/27/terminator.html"
|
@@ -0,0 +1,63 @@
|
|
1
|
+
Feature: Site configuration
|
2
|
+
As a hacker who likes to blog
|
3
|
+
I want to be able to configure jekyll
|
4
|
+
In order to make setting up a site easier
|
5
|
+
|
6
|
+
Scenario: Change destination directory
|
7
|
+
Given I have a blank site in "_sourcedir"
|
8
|
+
And I have an "_sourcedir/index.html" file that contains "Changing source directory"
|
9
|
+
And I have a configuration file with "source" set to "_sourcedir"
|
10
|
+
When I run jekyll
|
11
|
+
Then the _site directory should exist
|
12
|
+
And I should see "Changing source directory" in "_site/index.html"
|
13
|
+
|
14
|
+
Scenario: Change destination directory
|
15
|
+
Given I have an "index.html" file that contains "Changing destination directory"
|
16
|
+
And I have a configuration file with "destination" set to "_mysite"
|
17
|
+
When I run jekyll
|
18
|
+
Then the _mysite directory should exist
|
19
|
+
And I should see "Changing destination directory" in "_mysite/index.html"
|
20
|
+
|
21
|
+
Scenario: Exclude files inline
|
22
|
+
Given I have an "Rakefile" file that contains "I want to be excluded"
|
23
|
+
And I have an "README" file that contains "I want to be excluded"
|
24
|
+
And I have an "index.html" file that contains "I want to be included"
|
25
|
+
And I have a configuration file with "exclude" set to "Rakefile", "README"
|
26
|
+
When I run jekyll
|
27
|
+
Then I should see "I want to be included" in "_site/index.html"
|
28
|
+
And the "_site/Rakefile" file should not exist
|
29
|
+
And the "_site/README" file should not exist
|
30
|
+
|
31
|
+
Scenario: Exclude files with YAML array
|
32
|
+
Given I have an "Rakefile" file that contains "I want to be excluded"
|
33
|
+
And I have an "README" file that contains "I want to be excluded"
|
34
|
+
And I have an "index.html" file that contains "I want to be included"
|
35
|
+
And I have a configuration file with "exclude" set to:
|
36
|
+
| Value |
|
37
|
+
| README |
|
38
|
+
| Rakefile |
|
39
|
+
When I run jekyll
|
40
|
+
Then I should see "I want to be included" in "_site/index.html"
|
41
|
+
And the "_site/Rakefile" file should not exist
|
42
|
+
And the "_site/README" file should not exist
|
43
|
+
|
44
|
+
Scenario: Use RDiscount for markup
|
45
|
+
Given I have an "index.markdown" page that contains "[Google](http://google.com)"
|
46
|
+
And I have a configuration file with "markdown" set to "rdiscount"
|
47
|
+
When I run jekyll
|
48
|
+
Then the _site directory should exist
|
49
|
+
And I should see "<a href="http://google.com">Google</a>" in "_site/index.html"
|
50
|
+
|
51
|
+
Scenario: Use Maruku for markup
|
52
|
+
Given I have an "index.markdown" page that contains "[Google](http://google.com)"
|
53
|
+
And I have a configuration file with "markdown" set to "maruku"
|
54
|
+
When I run jekyll
|
55
|
+
Then the _site directory should exist
|
56
|
+
And I should see "<a href='http://google.com'>Google</a>" in "_site/index.html"
|
57
|
+
|
58
|
+
Scenario: Highlight code with pygments
|
59
|
+
Given I have an "index.html" file that contains "{% highlight ruby %} puts 'Hello world!' {% endhighlight %}"
|
60
|
+
And I have a configuration file with "pygments" set to "true"
|
61
|
+
When I run jekyll
|
62
|
+
Then the _site directory should exist
|
63
|
+
And I should see "puts 'Hello world!'" in "_site/index.html"
|
@@ -0,0 +1,82 @@
|
|
1
|
+
Feature: Site data
|
2
|
+
As a hacker who likes to blog
|
3
|
+
I want to be able to embed data into my site
|
4
|
+
In order to make the site slightly dynamic
|
5
|
+
|
6
|
+
Scenario: Use page variable in a page
|
7
|
+
Given I have an "contact.html" page with title "Contact" that contains "{{ page.title }}: email@me.com"
|
8
|
+
When I run jekyll
|
9
|
+
Then the _site directory should exist
|
10
|
+
And I should see "Contact: email@me.com" in "_site/contact.html"
|
11
|
+
|
12
|
+
Scenario: Use site.time variable
|
13
|
+
Given I have an "index.html" page that contains "{{ site.time }}"
|
14
|
+
When I run jekyll
|
15
|
+
Then the _site directory should exist
|
16
|
+
And I should see today's time in "_site/index.html"
|
17
|
+
|
18
|
+
Scenario: Use site.posts variable for latest post
|
19
|
+
Given I have a _posts directory
|
20
|
+
And I have an "index.html" page that contains "{{ site.posts.first.title }}: {{ site.posts.first.url }}"
|
21
|
+
And I have the following posts:
|
22
|
+
| title | date | content |
|
23
|
+
| First Post | 3/25/2009 | My First Post |
|
24
|
+
| Second Post | 3/26/2009 | My Second Post |
|
25
|
+
| Third Post | 3/27/2009 | My Third Post |
|
26
|
+
When I run jekyll
|
27
|
+
Then the _site directory should exist
|
28
|
+
And I should see "Third Post: /2009/03/27/third-post.html" in "_site/index.html"
|
29
|
+
|
30
|
+
Scenario: Use site.posts variable in a loop
|
31
|
+
Given I have a _posts directory
|
32
|
+
And I have an "index.html" page that contains "{% for post in site.posts %} {{ post.title }} {% endfor %}"
|
33
|
+
And I have the following posts:
|
34
|
+
| title | date | content |
|
35
|
+
| First Post | 3/25/2009 | My First Post |
|
36
|
+
| Second Post | 3/26/2009 | My Second Post |
|
37
|
+
| Third Post | 3/27/2009 | My Third Post |
|
38
|
+
When I run jekyll
|
39
|
+
Then the _site directory should exist
|
40
|
+
And I should see "Third Post Second Post First Post" in "_site/index.html"
|
41
|
+
|
42
|
+
Scenario: Use site.categories.code variable
|
43
|
+
Given I have a _posts directory
|
44
|
+
And I have an "index.html" page that contains "{% for post in site.categories.code %} {{ post.title }} {% endfor %}"
|
45
|
+
And I have the following posts:
|
46
|
+
| title | date | category | content |
|
47
|
+
| Awesome Hack | 3/26/2009 | code | puts 'Hello World' |
|
48
|
+
| Delicious Beer | 3/26/2009 | food | 1) Yuengling |
|
49
|
+
When I run jekyll
|
50
|
+
Then the _site directory should exist
|
51
|
+
And I should see "Awesome Hack" in "_site/index.html"
|
52
|
+
|
53
|
+
Scenario: Use site.tags variable
|
54
|
+
Given I have a _posts directory
|
55
|
+
And I have an "index.html" page that contains "{% for post in site.tags.beer %} {{ post.content }} {% endfor %}"
|
56
|
+
And I have the following posts:
|
57
|
+
| title | date | tag | content |
|
58
|
+
| Delicious Beer | 3/26/2009 | beer | 1) Yuengling |
|
59
|
+
When I run jekyll
|
60
|
+
Then the _site directory should exist
|
61
|
+
And I should see "Yuengling" in "_site/index.html"
|
62
|
+
|
63
|
+
Scenario: Order Posts by name when on the same date
|
64
|
+
Given I have a _posts directory
|
65
|
+
And I have an "index.html" page that contains "{% for post in site.posts %}{{ post.title }}:{{ post.previous.title}},{{ post.next.title}} {% endfor %}"
|
66
|
+
And I have the following posts:
|
67
|
+
| title | date | content |
|
68
|
+
| first | 2/26/2009 | first |
|
69
|
+
| A | 3/26/2009 | A |
|
70
|
+
| B | 3/26/2009 | B |
|
71
|
+
| C | 3/26/2009 | C |
|
72
|
+
| last | 4/26/2009 | last |
|
73
|
+
When I run jekyll
|
74
|
+
Then the _site directory should exist
|
75
|
+
And I should see "last:C, C:B,last B:A,C A:first,B first:,A" in "_site/index.html"
|
76
|
+
|
77
|
+
Scenario: Use configuration date in site payload
|
78
|
+
Given I have an "index.html" page that contains "{{ site.url }}"
|
79
|
+
And I have a configuration file with "url" set to "http://mysite.com"
|
80
|
+
When I run jekyll
|
81
|
+
Then the _site directory should exist
|
82
|
+
And I should see "http://mysite.com" in "_site/index.html"
|
@@ -0,0 +1,136 @@
|
|
1
|
+
Before do
|
2
|
+
FileUtils.mkdir(TEST_DIR)
|
3
|
+
Dir.chdir(TEST_DIR)
|
4
|
+
end
|
5
|
+
|
6
|
+
After do
|
7
|
+
Dir.chdir(TEST_DIR)
|
8
|
+
FileUtils.rm_rf(TEST_DIR)
|
9
|
+
end
|
10
|
+
|
11
|
+
Given /^I have a blank site in "(.*)"$/ do |path|
|
12
|
+
FileUtils.mkdir(path)
|
13
|
+
end
|
14
|
+
|
15
|
+
# Like "I have a foo file" but gives a yaml front matter so jekyll actually processes it
|
16
|
+
Given /^I have an "(.*)" page(?: with (.*) "(.*)")? that contains "(.*)"$/ do |file, key, value, text|
|
17
|
+
File.open(file, 'w') do |f|
|
18
|
+
f.write <<EOF
|
19
|
+
---
|
20
|
+
#{key || 'layout'}: #{value || 'nil'}
|
21
|
+
---
|
22
|
+
#{text}
|
23
|
+
EOF
|
24
|
+
f.close
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
Given /^I have an "(.*)" file that contains "(.*)"$/ do |file, text|
|
29
|
+
File.open(file, 'w') do |f|
|
30
|
+
f.write(text)
|
31
|
+
f.close
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
Given /^I have a (.*) layout that contains "(.*)"$/ do |layout, text|
|
36
|
+
File.open(File.join('_layouts', layout + '.html'), 'w') do |f|
|
37
|
+
f.write(text)
|
38
|
+
f.close
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
Given /^I have a (.*) directory$/ do |dir|
|
43
|
+
FileUtils.mkdir(dir)
|
44
|
+
end
|
45
|
+
|
46
|
+
Given /^I have the following posts?(?: (.*) "(.*)")?:$/ do |direction, folder, table|
|
47
|
+
table.hashes.each do |post|
|
48
|
+
date = Date.parse(post['date']).strftime('%Y-%m-%d')
|
49
|
+
title = post['title'].downcase.gsub(/[^\w]/, " ").strip.gsub(/\s+/, '-')
|
50
|
+
|
51
|
+
if direction && direction == "in"
|
52
|
+
before = folder || '.'
|
53
|
+
elsif direction && direction == "under"
|
54
|
+
after = folder || '.'
|
55
|
+
end
|
56
|
+
|
57
|
+
path = File.join(before || '.', '_posts', after || '.', "#{date}-#{title}.#{post['type'] || 'textile'}")
|
58
|
+
|
59
|
+
matter_hash = {}
|
60
|
+
%w(title layout tag tags category categories published author).each do |key|
|
61
|
+
matter_hash[key] = post[key] if post[key]
|
62
|
+
end
|
63
|
+
matter = matter_hash.map { |k, v| "#{k}: #{v}\n" }.join.chomp
|
64
|
+
|
65
|
+
content = post['content']
|
66
|
+
if post['input'] && post['filter']
|
67
|
+
content = "{{ #{post['input']} | #{post['filter']} }}"
|
68
|
+
end
|
69
|
+
|
70
|
+
File.open(path, 'w') do |f|
|
71
|
+
f.write <<EOF
|
72
|
+
---
|
73
|
+
#{matter}
|
74
|
+
---
|
75
|
+
#{content}
|
76
|
+
EOF
|
77
|
+
f.close
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
Given /^I have a configuration file with "(.*)" set to "(.*)"$/ do |key, value|
|
83
|
+
File.open('_config.yml', 'w') do |f|
|
84
|
+
f.write("#{key}: #{value}")
|
85
|
+
f.close
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
Given /^I have a configuration file with "([^\"]*)" set to:$/ do |key, table|
|
90
|
+
File.open('_config.yml', 'w') do |f|
|
91
|
+
f.write("#{key}:\n")
|
92
|
+
table.hashes.each do |row|
|
93
|
+
f.write("- #{row["Value"]}\n")
|
94
|
+
end
|
95
|
+
f.close
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
|
100
|
+
When /^I run jekyll$/ do
|
101
|
+
run_jekyll
|
102
|
+
end
|
103
|
+
|
104
|
+
When /^I debug jekyll$/ do
|
105
|
+
run_jekyll(:debug => true)
|
106
|
+
end
|
107
|
+
|
108
|
+
When /^I change "(.*)" to contain "(.*)"$/ do |file, text|
|
109
|
+
File.open(file, 'a') do |f|
|
110
|
+
f.write(text)
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
Then /^the (.*) directory should exist$/ do |dir|
|
115
|
+
assert File.directory?(dir)
|
116
|
+
end
|
117
|
+
|
118
|
+
Then /^the (.*) file should exist$/ do |file|
|
119
|
+
assert File.file?(file)
|
120
|
+
end
|
121
|
+
|
122
|
+
Then /^I should see "(.*)" in "(.*)"$/ do |text, file|
|
123
|
+
assert_match Regexp.new(text), File.open(file).readlines.join
|
124
|
+
end
|
125
|
+
|
126
|
+
Then /^the "(.*)" file should not exist$/ do |file|
|
127
|
+
assert !File.exists?(file)
|
128
|
+
end
|
129
|
+
|
130
|
+
Then /^I should see today's time in "(.*)"$/ do |file|
|
131
|
+
assert_match Regexp.new(Regexp.escape(Time.now.to_s)), File.open(file).readlines.join
|
132
|
+
end
|
133
|
+
|
134
|
+
Then /^I should see today's date in "(.*)"$/ do |file|
|
135
|
+
assert_match Regexp.new(Date.today.to_s), File.open(file).readlines.join
|
136
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
require 'rr'
|
3
|
+
require 'test/unit'
|
4
|
+
|
5
|
+
World do
|
6
|
+
include Test::Unit::Assertions
|
7
|
+
end
|
8
|
+
|
9
|
+
TEST_DIR = File.join('/', 'tmp', 'jekyll')
|
10
|
+
JEKYLL_PATH = File.join(ENV['PWD'], 'bin', 'jekyll')
|
11
|
+
|
12
|
+
def run_jekyll(opts = {})
|
13
|
+
command = JEKYLL_PATH
|
14
|
+
command << " >> /dev/null 2>&1" if opts[:debug].nil?
|
15
|
+
system command
|
16
|
+
end
|
data/jekyll.gemspec
ADDED
@@ -0,0 +1,141 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{jekyll}
|
8
|
+
s.version = "0.5.4"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Tom Preston-Werner"]
|
12
|
+
s.date = %q{2009-12-05}
|
13
|
+
s.default_executable = %q{jekyll}
|
14
|
+
s.description = %q{Jekyll is a simple, blog aware, static site generator.}
|
15
|
+
s.email = %q{tom@mojombo.com}
|
16
|
+
s.executables = ["jekyll"]
|
17
|
+
s.extra_rdoc_files = [
|
18
|
+
"README.textile"
|
19
|
+
]
|
20
|
+
s.files = [
|
21
|
+
".gitignore",
|
22
|
+
"History.txt",
|
23
|
+
"README.textile",
|
24
|
+
"Rakefile",
|
25
|
+
"VERSION.yml",
|
26
|
+
"bin/jekyll",
|
27
|
+
"features/create_sites.feature",
|
28
|
+
"features/embed_filters.feature",
|
29
|
+
"features/pagination.feature",
|
30
|
+
"features/permalinks.feature",
|
31
|
+
"features/post_data.feature",
|
32
|
+
"features/site_configuration.feature",
|
33
|
+
"features/site_data.feature",
|
34
|
+
"features/step_definitions/jekyll_steps.rb",
|
35
|
+
"features/support/env.rb",
|
36
|
+
"jekyll.gemspec",
|
37
|
+
"lib/jekyll.rb",
|
38
|
+
"lib/jekyll/albino.rb",
|
39
|
+
"lib/jekyll/converters/csv.rb",
|
40
|
+
"lib/jekyll/converters/marley.rb",
|
41
|
+
"lib/jekyll/converters/mephisto.rb",
|
42
|
+
"lib/jekyll/converters/mt.rb",
|
43
|
+
"lib/jekyll/converters/textpattern.rb",
|
44
|
+
"lib/jekyll/converters/typo.rb",
|
45
|
+
"lib/jekyll/converters/wordpress.rb",
|
46
|
+
"lib/jekyll/convertible.rb",
|
47
|
+
"lib/jekyll/core_ext.rb",
|
48
|
+
"lib/jekyll/filters.rb",
|
49
|
+
"lib/jekyll/haml_helpers.rb",
|
50
|
+
"lib/jekyll/layout.rb",
|
51
|
+
"lib/jekyll/page.rb",
|
52
|
+
"lib/jekyll/pager.rb",
|
53
|
+
"lib/jekyll/post.rb",
|
54
|
+
"lib/jekyll/site.rb",
|
55
|
+
"lib/jekyll/tags/highlight.rb",
|
56
|
+
"lib/jekyll/tags/include.rb",
|
57
|
+
"test/helper.rb",
|
58
|
+
"test/source/_includes/sig.markdown",
|
59
|
+
"test/source/_layouts/default.html",
|
60
|
+
"test/source/_layouts/simple.html",
|
61
|
+
"test/source/_posts/2008-02-02-not-published.textile",
|
62
|
+
"test/source/_posts/2008-02-02-published.textile",
|
63
|
+
"test/source/_posts/2008-10-18-foo-bar.textile",
|
64
|
+
"test/source/_posts/2008-11-21-complex.textile",
|
65
|
+
"test/source/_posts/2008-12-03-permalinked-post.textile",
|
66
|
+
"test/source/_posts/2008-12-13-include.markdown",
|
67
|
+
"test/source/_posts/2009-01-27-array-categories.textile",
|
68
|
+
"test/source/_posts/2009-01-27-categories.textile",
|
69
|
+
"test/source/_posts/2009-01-27-category.textile",
|
70
|
+
"test/source/_posts/2009-03-12-hash-#1.markdown",
|
71
|
+
"test/source/_posts/2009-05-18-tag.textile",
|
72
|
+
"test/source/_posts/2009-05-18-tags.textile",
|
73
|
+
"test/source/_posts/2009-06-22-empty-yaml.textile",
|
74
|
+
"test/source/_posts/2009-06-22-no-yaml.textile",
|
75
|
+
"test/source/about.html",
|
76
|
+
"test/source/category/_posts/2008-9-23-categories.textile",
|
77
|
+
"test/source/contacts.html",
|
78
|
+
"test/source/css/screen.css",
|
79
|
+
"test/source/foo/_posts/bar/2008-12-12-topical-post.textile",
|
80
|
+
"test/source/index.html",
|
81
|
+
"test/source/sitemap.xml",
|
82
|
+
"test/source/win/_posts/2009-05-24-yaml-linebreak.markdown",
|
83
|
+
"test/source/z_category/_posts/2008-9-23-categories.textile",
|
84
|
+
"test/suite.rb",
|
85
|
+
"test/test_configuration.rb",
|
86
|
+
"test/test_filters.rb",
|
87
|
+
"test/test_generated_site.rb",
|
88
|
+
"test/test_page.rb",
|
89
|
+
"test/test_pager.rb",
|
90
|
+
"test/test_post.rb",
|
91
|
+
"test/test_site.rb",
|
92
|
+
"test/test_tags.rb"
|
93
|
+
]
|
94
|
+
s.homepage = %q{http://github.com/mojombo/jekyll}
|
95
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
96
|
+
s.require_paths = ["lib"]
|
97
|
+
s.rubyforge_project = %q{jekyll}
|
98
|
+
s.rubygems_version = %q{1.3.5}
|
99
|
+
s.summary = %q{Jekyll is a simple, blog aware, static site generator.}
|
100
|
+
s.test_files = [
|
101
|
+
"test/helper.rb",
|
102
|
+
"test/suite.rb",
|
103
|
+
"test/test_configuration.rb",
|
104
|
+
"test/test_filters.rb",
|
105
|
+
"test/test_generated_site.rb",
|
106
|
+
"test/test_page.rb",
|
107
|
+
"test/test_pager.rb",
|
108
|
+
"test/test_post.rb",
|
109
|
+
"test/test_site.rb",
|
110
|
+
"test/test_tags.rb"
|
111
|
+
]
|
112
|
+
|
113
|
+
if s.respond_to? :specification_version then
|
114
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
115
|
+
s.specification_version = 3
|
116
|
+
|
117
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
118
|
+
s.add_runtime_dependency(%q<RedCloth>, [">= 4.2.1"])
|
119
|
+
s.add_runtime_dependency(%q<liquid>, [">= 1.9.0"])
|
120
|
+
s.add_runtime_dependency(%q<classifier>, [">= 1.3.1"])
|
121
|
+
s.add_runtime_dependency(%q<maruku>, [">= 0.5.9"])
|
122
|
+
s.add_runtime_dependency(%q<directory_watcher>, [">= 1.1.1"])
|
123
|
+
s.add_runtime_dependency(%q<open4>, [">= 0.9.6"])
|
124
|
+
else
|
125
|
+
s.add_dependency(%q<RedCloth>, [">= 4.2.1"])
|
126
|
+
s.add_dependency(%q<liquid>, [">= 1.9.0"])
|
127
|
+
s.add_dependency(%q<classifier>, [">= 1.3.1"])
|
128
|
+
s.add_dependency(%q<maruku>, [">= 0.5.9"])
|
129
|
+
s.add_dependency(%q<directory_watcher>, [">= 1.1.1"])
|
130
|
+
s.add_dependency(%q<open4>, [">= 0.9.6"])
|
131
|
+
end
|
132
|
+
else
|
133
|
+
s.add_dependency(%q<RedCloth>, [">= 4.2.1"])
|
134
|
+
s.add_dependency(%q<liquid>, [">= 1.9.0"])
|
135
|
+
s.add_dependency(%q<classifier>, [">= 1.3.1"])
|
136
|
+
s.add_dependency(%q<maruku>, [">= 0.5.9"])
|
137
|
+
s.add_dependency(%q<directory_watcher>, [">= 1.1.1"])
|
138
|
+
s.add_dependency(%q<open4>, [">= 0.9.6"])
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|