cypher-jekyll 0.5.2 → 0.5.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +6 -0
- data/History.txt +0 -12
- data/README.textile +630 -22
- data/Rakefile +2 -2
- data/TODO +3 -0
- data/VERSION.yml +1 -1
- data/features/create_sites.feature +46 -0
- data/features/embed_filters.feature +60 -0
- data/features/permalinks.feature +54 -0
- data/features/post_data.feature +155 -0
- data/features/site_configuration.feature +40 -0
- data/features/site_data.feature +51 -0
- data/features/step_definitions/jekyll_steps.rb +118 -0
- data/features/support/env.rb +18 -0
- data/jekyll.gemspec +120 -0
- data/lib/jekyll/filters.rb +1 -5
- data/lib/jekyll/post.rb +2 -3
- data/lib/jekyll/site.rb +9 -6
- data/test/helper.rb +0 -3
- data/test/test_filters.rb +0 -8
- data/test/test_post.rb +0 -7
- data/test/test_site.rb +0 -8
- data/test/test_tags.rb +7 -72
- metadata +18 -7
- data/test/source/_posts/2009-03-12-hash-#1.markdown +0 -6
data/Rakefile
CHANGED
@@ -11,11 +11,11 @@ begin
|
|
11
11
|
s.email = "tom@mojombo.com"
|
12
12
|
s.homepage = "http://github.com/mojombo/jekyll"
|
13
13
|
s.description = "Jekyll is a simple, blog aware, static site generator."
|
14
|
-
s.authors = ["Tom Preston-Werner"]
|
14
|
+
s.authors = ["Tom Preston-Werner", "Henrik Nyh", "Markus Prinz"]
|
15
15
|
s.rubyforge_project = "jekyll"
|
16
16
|
s.files.exclude 'test/dest'
|
17
17
|
s.test_files.exclude 'test/dest'
|
18
|
-
s.add_dependency('RedCloth', '
|
18
|
+
s.add_dependency('RedCloth', '>= 4.0.4')
|
19
19
|
s.add_dependency('liquid', '>= 1.9.0')
|
20
20
|
s.add_dependency('classifier', '>= 1.3.1')
|
21
21
|
s.add_dependency('maruku', '>= 0.5.9')
|
data/TODO
ADDED
data/VERSION.yml
CHANGED
@@ -0,0 +1,46 @@
|
|
1
|
+
Feature: Create sites
|
2
|
+
As a hacker who likes to blog
|
3
|
+
I want to be able to make a static site
|
4
|
+
In order to share my awesome ideas with the interwebs
|
5
|
+
|
6
|
+
Scenario: Basic site
|
7
|
+
Given I have an "index.html" file that contains "Basic Site"
|
8
|
+
When I run jekyll
|
9
|
+
Then the _site directory should exist
|
10
|
+
And I should see "Basic Site" in "_site/index.html"
|
11
|
+
|
12
|
+
Scenario: Basic site with a post
|
13
|
+
Given I have a _posts directory
|
14
|
+
And I have the following post:
|
15
|
+
| title | date | content |
|
16
|
+
| Hackers | 3/27/2009 | My First Exploit |
|
17
|
+
When I run jekyll
|
18
|
+
Then the _site directory should exist
|
19
|
+
And I should see "My First Exploit" in "_site/2009/03/27/hackers.html"
|
20
|
+
|
21
|
+
Scenario: Basic site with layout and a page
|
22
|
+
Given I have a _layouts directory
|
23
|
+
And I have an "index.html" page with layout "default" that contains "Basic Site with Layout"
|
24
|
+
And I have a default layout that contains "Page Layout: {{ content }}"
|
25
|
+
When I run jekyll
|
26
|
+
Then the _site directory should exist
|
27
|
+
And I should see "Page Layout: Basic Site with Layout" in "_site/index.html"
|
28
|
+
|
29
|
+
Scenario: Basic site with layout and a post
|
30
|
+
Given I have a _layouts directory
|
31
|
+
And I have a _posts directory
|
32
|
+
And I have the following post:
|
33
|
+
| title | date | layout | content |
|
34
|
+
| Wargames | 3/27/2009 | default | The only winning move is not to play. |
|
35
|
+
And I have a default layout that contains "Post Layout: {{ content }}"
|
36
|
+
When I run jekyll
|
37
|
+
Then the _site directory should exist
|
38
|
+
And I should see "Post Layout: <p>The only winning move is not to play.</p>" in "_site/2009/03/27/wargames.html"
|
39
|
+
|
40
|
+
Scenario: Basic site with include tag
|
41
|
+
Given I have a _includes directory
|
42
|
+
And I have an "index.html" page that contains "Basic Site with include tag: {% include about.textile %}"
|
43
|
+
And I have an "_includes/about.textile" file that contains "Generated by Jekyll"
|
44
|
+
When I run jekyll
|
45
|
+
Then the _site directory should exist
|
46
|
+
And I should see "Basic Site with include tag: Generated by Jekyll" in "_site/index.html"
|
@@ -0,0 +1,60 @@
|
|
1
|
+
Feature: Embed filters
|
2
|
+
As a hacker who likes to blog
|
3
|
+
I want to be able to transform text inside a post or page
|
4
|
+
In order to perform cool stuff in my posts
|
5
|
+
|
6
|
+
Scenario: Convert date to XML schema
|
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 | default | These aren't the droids you're looking for. |
|
12
|
+
And I have a default layout that contains "{{ site.time | date_to_xmlschema }}"
|
13
|
+
When I run jekyll
|
14
|
+
Then the _site directory should exist
|
15
|
+
And I should see today's date in "_site/2009/03/27/star-wars.html"
|
16
|
+
|
17
|
+
Scenario: Escape text for XML
|
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 | default | These aren't the droids you're looking for. |
|
23
|
+
And I have a default layout that contains "{{ site.posts.first.title | xml_escape }}"
|
24
|
+
When I run jekyll
|
25
|
+
Then the _site directory should exist
|
26
|
+
And I should see "Star & Wars" in "_site/2009/03/27/star-wars.html"
|
27
|
+
|
28
|
+
Scenario: Calculate number of words
|
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 | default | These aren't the droids you're looking for. |
|
34
|
+
And I have a default layout that contains "{{ site.posts.first.content | xml_escape }}"
|
35
|
+
When I run jekyll
|
36
|
+
Then the _site directory should exist
|
37
|
+
And I should see "7" in "_site/2009/03/27/star-wars.html"
|
38
|
+
|
39
|
+
Scenario: Convert an array into a sentence
|
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 | tags | content |
|
44
|
+
| Star Wars | 3/27/2009 | default | [scifi, movies, force] | These aren't the droids you're looking for. |
|
45
|
+
And I have a default layout that contains "{{ site.posts.first.tags | array_to_sentence_string }}"
|
46
|
+
When I run jekyll
|
47
|
+
Then the _site directory should exist
|
48
|
+
And I should see "scifi, movies, and force" in "_site/2009/03/27/star-wars.html"
|
49
|
+
|
50
|
+
Scenario: Textilize a given string
|
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 | default | These aren't the droids you're looking for. |
|
56
|
+
And I have a default layout that contains "By {{ '_Obi-wan_' | textilize }}"
|
57
|
+
When I run jekyll
|
58
|
+
Then the _site directory should exist
|
59
|
+
And I should see "By <p><em>Obi-wan</em></p>" in "_site/2009/03/27/star-wars.html"
|
60
|
+
|
@@ -0,0 +1,54 @@
|
|
1
|
+
Feature: Fancy permalinks
|
2
|
+
As a hacker who likes to blog
|
3
|
+
I want to be able to set permalinks
|
4
|
+
In order to make my blog URLs awesome
|
5
|
+
|
6
|
+
Scenario: Use none permalink schema
|
7
|
+
Given I have a _posts directory
|
8
|
+
And I have the following post:
|
9
|
+
| title | date | content |
|
10
|
+
| None Permalink Schema | 3/27/2009 | Totally nothing. |
|
11
|
+
And I have a configuration file with "permalink" set to "none"
|
12
|
+
When I run jekyll
|
13
|
+
Then the _site directory should exist
|
14
|
+
And I should see "Totally nothing." in "_site/none-permalink-schema.html"
|
15
|
+
|
16
|
+
Scenario: Use pretty permalink schema
|
17
|
+
Given I have a _posts directory
|
18
|
+
And I have the following post:
|
19
|
+
| title | date | content |
|
20
|
+
| Pretty Permalink Schema | 3/27/2009 | Totally wordpress. |
|
21
|
+
And I have a configuration file with "permalink" set to "pretty"
|
22
|
+
When I run jekyll
|
23
|
+
Then the _site directory should exist
|
24
|
+
And I should see "Totally wordpress." in "_site/2009/03/27/pretty-permalink-schema/index.html"
|
25
|
+
|
26
|
+
Scenario: Use custom permalink schema with prefix
|
27
|
+
Given I have a _posts directory
|
28
|
+
And I have the following post:
|
29
|
+
| title | category | date | content |
|
30
|
+
| Custom Permalink Schema | stuff | 3/27/2009 | Totally custom. |
|
31
|
+
And I have a configuration file with "permalink" set to "/blog/:year/:month/:day/:title"
|
32
|
+
When I run jekyll
|
33
|
+
Then the _site directory should exist
|
34
|
+
And I should see "Totally custom." in "_site/blog/2009/03/27/custom-permalink-schema/index.html"
|
35
|
+
|
36
|
+
Scenario: Use custom permalink schema with category
|
37
|
+
Given I have a _posts directory
|
38
|
+
And I have the following post:
|
39
|
+
| title | category | date | content |
|
40
|
+
| Custom Permalink Schema | stuff | 3/27/2009 | Totally custom. |
|
41
|
+
And I have a configuration file with "permalink" set to "/:categories/:title.html"
|
42
|
+
When I run jekyll
|
43
|
+
Then the _site directory should exist
|
44
|
+
And I should see "Totally custom." in "_site/stuff/custom-permalink-schema.html"
|
45
|
+
|
46
|
+
Scenario: Use custom permalink schema with squished date
|
47
|
+
Given I have a _posts directory
|
48
|
+
And I have the following post:
|
49
|
+
| title | category | date | content |
|
50
|
+
| Custom Permalink Schema | stuff | 3/27/2009 | Totally custom. |
|
51
|
+
And I have a configuration file with "permalink" set to "/:month-:day-:year/:title.html"
|
52
|
+
When I run jekyll
|
53
|
+
Then the _site directory should exist
|
54
|
+
And I should see "Totally custom." in "_site/03-27-2009/custom-permalink-schema.html"
|
@@ -0,0 +1,155 @@
|
|
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.categories variable when categories are in folders
|
74
|
+
Given I have a movies directory
|
75
|
+
And I have a movies/scifi directory
|
76
|
+
And I have a movies/scifi/_posts directory
|
77
|
+
And I have a _layouts directory
|
78
|
+
And I have the following post in "movies/scifi":
|
79
|
+
| title | date | layout | content |
|
80
|
+
| Star Wars | 3/27/2009 | simple | Luke, I am your father. |
|
81
|
+
And I have a simple layout that contains "Post categories: {{ site.posts.first.categories | array_to_sentence_string }}"
|
82
|
+
When I run jekyll
|
83
|
+
Then the _site directory should exist
|
84
|
+
And I should see "Post categories: movies and scifi" in "_site/movies/scifi/2009/03/27/star-wars.html"
|
85
|
+
|
86
|
+
Scenario: Use post.categories variable when category is in YAML
|
87
|
+
Given I have a _posts directory
|
88
|
+
And I have a _layouts directory
|
89
|
+
And I have the following post:
|
90
|
+
| title | date | layout | category | content |
|
91
|
+
| Star Wars | 3/27/2009 | simple | movies | Luke, I am your father. |
|
92
|
+
And I have a simple layout that contains "Post category: {{ site.posts.first.categories }}"
|
93
|
+
When I run jekyll
|
94
|
+
Then the _site directory should exist
|
95
|
+
And I should see "Post category: movies" in "_site/movies/2009/03/27/star-wars.html"
|
96
|
+
|
97
|
+
Scenario: Use post.categories variable when categories are 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 | categories | content |
|
102
|
+
| Star Wars | 3/27/2009 | simple | ['movies', 'scifi'] | Luke, I am your father. |
|
103
|
+
And I have a simple layout that contains "Post categories: {{ site.posts.first.categories | array_to_sentence_string }}"
|
104
|
+
When I run jekyll
|
105
|
+
Then the _site directory should exist
|
106
|
+
And I should see "Post categories: movies and scifi" in "_site/movies/scifi/2009/03/27/star-wars.html"
|
107
|
+
|
108
|
+
Scenario: Use post.topics variable
|
109
|
+
Given I have a _posts directory
|
110
|
+
And I have a _posts/movies directory
|
111
|
+
And I have a _posts/movies/scifi directory
|
112
|
+
And I have a _layouts directory
|
113
|
+
And I have the following post under "movies/scifi":
|
114
|
+
| title | date | layout | content |
|
115
|
+
| Star Wars | 3/27/2009 | simple | Luke, I am your father. |
|
116
|
+
And I have a simple layout that contains "Post topics: {{ site.posts.first.topics | array_to_sentence_string }}"
|
117
|
+
When I run jekyll
|
118
|
+
Then the _site directory should exist
|
119
|
+
And I should see "Post topics: movies and scifi" in "_site/2009/03/27/star-wars.html"
|
120
|
+
|
121
|
+
Scenario: Disable a post from being published
|
122
|
+
Given I have a _posts directory
|
123
|
+
And I have an "index.html" file that contains "Published!"
|
124
|
+
And I have the following post:
|
125
|
+
| title | date | layout | published | content |
|
126
|
+
| Star Wars | 3/27/2009 | simple | false | Luke, I am your father. |
|
127
|
+
When I run jekyll
|
128
|
+
Then the _site directory should exist
|
129
|
+
And the "_site/2009/03/27/star-wars.html" file should not exist
|
130
|
+
And I should see "Published!" in "_site/index.html"
|
131
|
+
|
132
|
+
Scenario: Use a custom variable
|
133
|
+
Given I have a _posts directory
|
134
|
+
And I have a _layouts directory
|
135
|
+
And I have the following post:
|
136
|
+
| title | date | layout | author | content |
|
137
|
+
| Star Wars | 3/27/2009 | simple | Darth Vader | Luke, I am your father. |
|
138
|
+
And I have a simple layout that contains "Post author: {{ site.posts.first.author }}"
|
139
|
+
When I run jekyll
|
140
|
+
Then the _site directory should exist
|
141
|
+
And I should see "Post author: Darth Vader" in "_site/2009/03/27/star-wars.html"
|
142
|
+
|
143
|
+
Scenario: Previous and next posts title
|
144
|
+
Given I have a _posts directory
|
145
|
+
And I have a _layouts directory
|
146
|
+
And I have the following posts:
|
147
|
+
| title | date | layout | author | content |
|
148
|
+
| Star Wars | 3/27/2009 | ordered | Darth Vader | Luke, I am your father. |
|
149
|
+
| Some like it hot | 4/27/2009 | ordered | Osgood | Nobody is perfect. |
|
150
|
+
| Terminator | 5/27/2009 | ordered | Arnold | Sayonara, baby |
|
151
|
+
And I have a ordered layout that contains "Previous post: {{ page.previous.title }} and next post: {{ page.next.title }}"
|
152
|
+
When I run jekyll
|
153
|
+
Then the _site directory should exist
|
154
|
+
And I should see "next post: Some like it hot" in "_site/2009/03/27/star-wars.html"
|
155
|
+
And I should see "Previous post: Some like it hot" in "_site/2009/05/27/terminator.html"
|
@@ -0,0 +1,40 @@
|
|
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: Use RDiscount for markup
|
22
|
+
Given I have an "index.markdown" page that contains "[Google](http://google.com)"
|
23
|
+
And I have a configuration file with "markdown" set to "rdiscount"
|
24
|
+
When I run jekyll
|
25
|
+
Then the _site directory should exist
|
26
|
+
And I should see "<a href="http://google.com">Google</a>" in "_site/index.html"
|
27
|
+
|
28
|
+
Scenario: Use Maruku for markup
|
29
|
+
Given I have an "index.markdown" page that contains "[Google](http://google.com)"
|
30
|
+
And I have a configuration file with "markdown" set to "maruku"
|
31
|
+
When I run jekyll
|
32
|
+
Then the _site directory should exist
|
33
|
+
And I should see "<a href='http://google.com'>Google</a>" in "_site/index.html"
|
34
|
+
|
35
|
+
Scenario: Highlight code with pygments
|
36
|
+
Given I have an "index.html" file that contains "{% highlight ruby %} puts 'Hello world!' {% endhighlight %}"
|
37
|
+
And I have a configuration file with "pygments" set to "true"
|
38
|
+
When I run jekyll
|
39
|
+
Then the _site directory should exist
|
40
|
+
And I should see "puts 'Hello world!'" in "_site/index.html"
|
@@ -0,0 +1,51 @@
|
|
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 "Generated on: {{ 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"
|
@@ -0,0 +1,118 @@
|
|
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 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
|
+
When /^I run jekyll$/ do
|
90
|
+
run_jekyll
|
91
|
+
end
|
92
|
+
|
93
|
+
When /^I change "(.*)" to contain "(.*)"$/ do |file, text|
|
94
|
+
File.open(file, 'a') do |f|
|
95
|
+
f.write(text)
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
Then /^the (.*) directory should exist$/ do |dir|
|
100
|
+
assert File.directory?(dir)
|
101
|
+
end
|
102
|
+
|
103
|
+
Then /^I should see "(.*)" in "(.*)"$/ do |text, file|
|
104
|
+
assert_match Regexp.new(text), File.open(file).readlines.join
|
105
|
+
end
|
106
|
+
|
107
|
+
Then /^the "(.*)" file should not exist$/ do |file|
|
108
|
+
assert !File.exists?(file)
|
109
|
+
end
|
110
|
+
|
111
|
+
Then /^I should see today's time in "(.*)"$/ do |file|
|
112
|
+
assert_match Regexp.new(Time.now.to_s), File.open(file).readlines.join
|
113
|
+
end
|
114
|
+
|
115
|
+
Then /^I should see today's date in "(.*)"$/ do |file|
|
116
|
+
assert_match Regexp.new(Date.today.to_s), File.open(file).readlines.join
|
117
|
+
end
|
118
|
+
|