monad 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (188) hide show
  1. checksums.yaml +7 -0
  2. data/CONTRIBUTING.markdown +91 -0
  3. data/Gemfile +1 -1
  4. data/History.markdown +772 -0
  5. data/{README.md → README.markdown} +5 -2
  6. data/Rakefile +163 -1
  7. data/bin/monad +86 -30
  8. data/features/create_sites.feature +54 -25
  9. data/features/data.feature +65 -0
  10. data/features/data_sources.feature +10 -10
  11. data/features/drafts.feature +5 -5
  12. data/features/embed_filters.feature +10 -10
  13. data/features/include_tag.feature +48 -0
  14. data/features/markdown.feature +5 -5
  15. data/features/pagination.feature +38 -10
  16. data/features/permalinks.feature +31 -11
  17. data/features/post_data.feature +41 -41
  18. data/features/post_excerpts.feature +50 -0
  19. data/features/site_configuration.feature +47 -26
  20. data/features/site_data.feature +30 -24
  21. data/features/step_definitions/{monad_steps.rb → jekyll_steps.rb} +66 -52
  22. data/features/support/env.rb +27 -8
  23. data/lib/jekyll.rb +99 -0
  24. data/lib/jekyll/cleaner.rb +73 -0
  25. data/lib/{monad → jekyll}/command.rb +6 -6
  26. data/lib/{monad → jekyll}/commands/build.rb +9 -9
  27. data/lib/jekyll/commands/doctor.rb +67 -0
  28. data/lib/jekyll/commands/new.rb +67 -0
  29. data/lib/jekyll/commands/serve.rb +65 -0
  30. data/lib/{monad → jekyll}/configuration.rb +60 -18
  31. data/lib/{monad → jekyll}/converter.rb +1 -1
  32. data/lib/{monad → jekyll}/converters/identity.rb +1 -1
  33. data/lib/{monad → jekyll}/converters/markdown.rb +2 -2
  34. data/lib/jekyll/converters/markdown/kramdown_parser.rb +29 -0
  35. data/lib/{monad → jekyll}/converters/markdown/maruku_parser.rb +12 -8
  36. data/lib/{monad → jekyll}/converters/markdown/rdiscount_parser.rb +4 -2
  37. data/lib/{monad → jekyll}/converters/markdown/redcarpet_parser.rb +1 -1
  38. data/lib/{monad → jekyll}/converters/textile.rb +1 -1
  39. data/lib/{monad → jekyll}/convertible.rb +39 -17
  40. data/lib/{monad → jekyll}/core_ext.rb +22 -4
  41. data/lib/jekyll/deprecator.rb +36 -0
  42. data/lib/{monad → jekyll}/draft.rb +1 -1
  43. data/lib/{monad → jekyll}/drivers/json_driver.rb +1 -1
  44. data/lib/{monad → jekyll}/drivers/yaml_driver.rb +1 -1
  45. data/lib/{monad → jekyll}/errors.rb +1 -1
  46. data/lib/jekyll/excerpt.rb +113 -0
  47. data/lib/{monad → jekyll}/filters.rb +16 -6
  48. data/lib/{monad → jekyll}/generator.rb +1 -1
  49. data/lib/jekyll/generators/pagination.rb +214 -0
  50. data/lib/{monad → jekyll}/layout.rb +4 -1
  51. data/lib/{monad → jekyll}/mime.types +0 -0
  52. data/lib/{monad → jekyll}/page.rb +36 -39
  53. data/lib/{monad → jekyll}/plugin.rb +1 -1
  54. data/lib/{monad → jekyll}/post.rb +58 -123
  55. data/lib/jekyll/related_posts.rb +59 -0
  56. data/lib/{monad → jekyll}/site.rb +120 -123
  57. data/lib/{monad → jekyll}/static_file.rb +1 -1
  58. data/lib/jekyll/stevenson.rb +89 -0
  59. data/lib/jekyll/tags/gist.rb +48 -0
  60. data/lib/{monad → jekyll}/tags/highlight.rb +3 -3
  61. data/lib/jekyll/tags/include.rb +135 -0
  62. data/lib/{monad → jekyll}/tags/post_url.rb +8 -6
  63. data/lib/jekyll/url.rb +67 -0
  64. data/lib/monad.rb +36 -27
  65. data/lib/site_template/_config.yml +2 -1
  66. data/lib/site_template/_layouts/default.html +21 -23
  67. data/lib/site_template/_layouts/post.html +1 -1
  68. data/lib/site_template/_posts/{0000-00-00-welcome-to-monad.markdown.erb → 0000-00-00-welcome-to-jekyll.markdown.erb} +6 -6
  69. data/lib/site_template/css/main.css +22 -27
  70. data/lib/site_template/index.html +2 -2
  71. data/monad.gemspec +153 -52
  72. data/site/.gitignore +4 -0
  73. data/site/CNAME +1 -0
  74. data/site/README +1 -0
  75. data/site/_config.yml +6 -0
  76. data/site/_includes/analytics.html +32 -0
  77. data/site/_includes/docs_contents.html +16 -0
  78. data/site/_includes/docs_contents_mobile.html +23 -0
  79. data/site/_includes/docs_option.html +11 -0
  80. data/site/_includes/docs_ul.html +20 -0
  81. data/site/_includes/footer.html +15 -0
  82. data/site/_includes/header.html +18 -0
  83. data/site/_includes/news_contents.html +23 -0
  84. data/site/_includes/news_contents_mobile.html +11 -0
  85. data/site/_includes/news_item.html +24 -0
  86. data/site/_includes/primary-nav-items.html +14 -0
  87. data/site/_includes/section_nav.html +22 -0
  88. data/site/_includes/top.html +17 -0
  89. data/site/_layouts/default.html +12 -0
  90. data/site/_layouts/docs.html +23 -0
  91. data/site/_layouts/news.html +19 -0
  92. data/site/_layouts/news_item.html +27 -0
  93. data/site/_posts/2013-05-06-jekyll-1-0-0-released.markdown +23 -0
  94. data/site/_posts/2013-05-08-jekyll-1-0-1-released.markdown +27 -0
  95. data/site/_posts/2013-05-12-jekyll-1-0-2-released.markdown +28 -0
  96. data/site/_posts/2013-06-07-jekyll-1-0-3-released.markdown +25 -0
  97. data/site/_posts/2013-07-14-jekyll-1-1-0-released.markdown +27 -0
  98. data/site/_posts/2013-07-24-jekyll-1-1-1-released.markdown +31 -0
  99. data/site/_posts/2013-07-25-jekyll-1-0-4-released.markdown +20 -0
  100. data/site/_posts/2013-07-25-jekyll-1-1-2-released.markdown +20 -0
  101. data/site/_posts/2013-09-06-jekyll-1-2-0-released.markdown +23 -0
  102. data/site/_posts/2013-09-14-jekyll-1-2-1-released.markdown +19 -0
  103. data/site/css/gridism.css +110 -0
  104. data/site/css/normalize.css +1 -0
  105. data/site/css/pygments.css +70 -0
  106. data/site/css/style.css +946 -0
  107. data/site/docs/configuration.md +373 -0
  108. data/site/docs/contributing.md +128 -0
  109. data/site/docs/datafiles.md +63 -0
  110. data/site/docs/deployment-methods.md +109 -0
  111. data/site/docs/drafts.md +20 -0
  112. data/site/docs/extras.md +56 -0
  113. data/site/docs/frontmatter.md +180 -0
  114. data/site/docs/github-pages.md +91 -0
  115. data/site/docs/heroku.md +9 -0
  116. data/site/docs/history.md +722 -0
  117. data/site/docs/index.md +52 -0
  118. data/site/docs/installation.md +76 -0
  119. data/site/docs/migrations.md +257 -0
  120. data/site/docs/pages.md +86 -0
  121. data/site/docs/pagination.md +211 -0
  122. data/site/docs/permalinks.md +180 -0
  123. data/site/docs/plugins.md +508 -0
  124. data/site/docs/posts.md +181 -0
  125. data/site/docs/quickstart.md +32 -0
  126. data/site/docs/resources.md +46 -0
  127. data/site/docs/sites.md +29 -0
  128. data/site/docs/structure.md +190 -0
  129. data/site/docs/templates.md +319 -0
  130. data/site/docs/troubleshooting.md +150 -0
  131. data/site/docs/upgrading.md +146 -0
  132. data/site/docs/usage.md +63 -0
  133. data/site/docs/variables.md +322 -0
  134. data/site/favicon.png +0 -0
  135. data/site/feed.xml +36 -0
  136. data/site/freenode.txt +1 -0
  137. data/site/img/article-footer.png +0 -0
  138. data/site/img/footer-arrow.png +0 -0
  139. data/site/img/footer-logo.png +0 -0
  140. data/site/img/logo-2x.png +0 -0
  141. data/site/img/octojekyll.png +0 -0
  142. data/site/img/tube.png +0 -0
  143. data/site/img/tube1x.png +0 -0
  144. data/site/index.html +90 -0
  145. data/site/js/modernizr-2.5.3.min.js +4 -0
  146. data/site/news/index.html +10 -0
  147. data/site/news/releases/index.html +10 -0
  148. data/test/helper.rb +6 -3
  149. data/test/source/+/foo.md +7 -0
  150. data/test/source/_data/languages.yml +2 -0
  151. data/test/source/_data/members.yaml +7 -0
  152. data/test/source/_data/products.yml +4 -0
  153. data/test/source/_includes/params.html +7 -0
  154. data/test/source/_layouts/default.html +1 -1
  155. data/test/source/_layouts/post/simple.html +1 -0
  156. data/test/source/_plugins/dummy.rb +1 -1
  157. data/test/source/_posts/2013-01-02-post-excerpt.markdown +1 -1
  158. data/test/source/_posts/2013-07-22-post-excerpt-with-layout.markdown +23 -0
  159. data/test/source/_posts/2013-08-01-mkdn-extension.mkdn +0 -0
  160. data/test/source/deal.with.dots.html +1 -1
  161. data/test/source/products.yml +4 -0
  162. data/test/test_configuration.rb +46 -11
  163. data/test/test_convertible.rb +2 -2
  164. data/test/test_excerpt.rb +78 -0
  165. data/test/test_filters.rb +4 -4
  166. data/test/test_generated_site.rb +13 -13
  167. data/test/test_json_driver.rb +9 -9
  168. data/test/test_kramdown.rb +32 -5
  169. data/test/test_new_command.rb +8 -8
  170. data/test/test_page.rb +12 -3
  171. data/test/test_pager.rb +34 -33
  172. data/test/test_post.rb +34 -26
  173. data/test/test_redcloth.rb +3 -3
  174. data/test/test_related_posts.rb +47 -0
  175. data/test/test_site.rb +102 -44
  176. data/test/test_tags.rb +168 -23
  177. data/test/test_url.rb +28 -0
  178. data/test/test_yaml_driver.rb +6 -6
  179. metadata +215 -137
  180. data/lib/monad/commands/doctor.rb +0 -29
  181. data/lib/monad/commands/new.rb +0 -50
  182. data/lib/monad/commands/serve.rb +0 -33
  183. data/lib/monad/converters/markdown/kramdown_parser.rb +0 -44
  184. data/lib/monad/deprecator.rb +0 -32
  185. data/lib/monad/generators/pagination.rb +0 -143
  186. data/lib/monad/logger.rb +0 -54
  187. data/lib/monad/tags/gist.rb +0 -30
  188. data/lib/monad/tags/include.rb +0 -37
@@ -0,0 +1,50 @@
1
+ Feature: Post excerpts
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
+ But some people can only focus for a few moments
6
+ So just give them a taste
7
+
8
+ Scenario: An excerpt without a layout
9
+ Given I have an "index.html" page that contains "{% for post in site.posts %}{{ post.excerpt }}{% endfor %}"
10
+ And I have a _posts directory
11
+ And I have the following posts:
12
+ | title | date | layout | content |
13
+ | entry1 | 2007-12-31 | post | content for entry1. |
14
+ When I run jekyll
15
+ Then the _site directory should exist
16
+ And I should see exactly "<p>content for entry1.</p>" in "_site/index.html"
17
+
18
+ Scenario: An excerpt from a post with a layout
19
+ Given I have an "index.html" page that contains "{% for post in site.posts %}{{ post.excerpt }}{% endfor %}"
20
+ And I have a _posts directory
21
+ And I have a _layouts directory
22
+ And I have a post layout that contains "{{ page.excerpt }}"
23
+ And I have the following posts:
24
+ | title | date | layout | content |
25
+ | entry1 | 2007-12-31 | post | content for entry1. |
26
+ When I run jekyll
27
+ Then the _site directory should exist
28
+ And the _site/2007 directory should exist
29
+ And the _site/2007/12 directory should exist
30
+ And the _site/2007/12/31 directory should exist
31
+ And the "_site/2007/12/31/entry1.html" file should exist
32
+ And I should see exactly "<p>content for entry1.</p>" in "_site/2007/12/31/entry1.html"
33
+ And I should see exactly "<p>content for entry1.</p>" in "_site/index.html"
34
+
35
+ Scenario: An excerpt from a post with a layout which has context
36
+ Given I have an "index.html" page that contains "{% for post in site.posts %}{{ post.excerpt }}{% endfor %}"
37
+ And I have a _posts directory
38
+ And I have a _layouts directory
39
+ And I have a post layout that contains "<html><head></head><body>{{ page.excerpt }}</body></html>"
40
+ And I have the following posts:
41
+ | title | date | layout | content |
42
+ | entry1 | 2007-12-31 | post | content for entry1. |
43
+ When I run jekyll
44
+ Then the _site directory should exist
45
+ And the _site/2007 directory should exist
46
+ And the _site/2007/12 directory should exist
47
+ And the _site/2007/12/31 directory should exist
48
+ And the "_site/2007/12/31/entry1.html" file should exist
49
+ And I should see exactly "<p>content for entry1.</p>" in "_site/index.html"
50
+ And I should see exactly "<html><head></head><body><p>content for entry1.</p></body></html>" in "_site/2007/12/31/entry1.html"
@@ -1,29 +1,50 @@
1
1
  Feature: Site configuration
2
2
  As a hacker who likes to blog
3
- I want to be able to configure monad
3
+ I want to be able to configure jekyll
4
4
  In order to make setting up a site easier
5
5
 
6
6
  Scenario: Change source directory
7
7
  Given I have a blank site in "_sourcedir"
8
8
  And I have an "_sourcedir/index.html" file that contains "Changing source directory"
9
9
  And I have a configuration file with "source" set to "_sourcedir"
10
- When I run monad
10
+ When I run jekyll
11
11
  Then the _site directory should exist
12
12
  And I should see "Changing source directory" in "_site/index.html"
13
13
 
14
14
  Scenario: Change destination directory
15
15
  Given I have an "index.html" file that contains "Changing destination directory"
16
16
  And I have a configuration file with "destination" set to "_mysite"
17
- When I run monad
17
+ When I run jekyll
18
18
  Then the _mysite directory should exist
19
19
  And I should see "Changing destination directory" in "_mysite/index.html"
20
20
 
21
+ Scenario Outline: Similarly named source and destination
22
+ Given I have a blank site in "<source>"
23
+ And I have an "<source>/index.md" page that contains "markdown"
24
+ And I have a configuration file with:
25
+ | key | value |
26
+ | source | <source> |
27
+ | destination | <dest> |
28
+ When I run jekyll
29
+ Then the <source> directory should exist
30
+ And the "<dest>/index.html" file should <file_exist> exist
31
+ And I should see "markdown" in "<source>/index.md"
32
+
33
+ Examples:
34
+ | source | dest | file_exist |
35
+ | mysite_source | mysite | |
36
+ | mysite | mysite_dest | |
37
+ | mysite/ | mysite | not |
38
+ | mysite | ./mysite | not |
39
+ | mysite/source | mysite | not |
40
+ | mysite | mysite/dest | |
41
+
21
42
  Scenario: Exclude files inline
22
43
  Given I have an "Rakefile" file that contains "I want to be excluded"
23
44
  And I have an "README" file that contains "I want to be excluded"
24
45
  And I have an "index.html" file that contains "I want to be included"
25
46
  And I have a configuration file with "exclude" set to "['Rakefile', 'README']"
26
- When I run monad
47
+ When I run jekyll
27
48
  Then I should see "I want to be included" in "_site/index.html"
28
49
  And the "_site/Rakefile" file should not exist
29
50
  And the "_site/README" file should not exist
@@ -36,7 +57,7 @@ Feature: Site configuration
36
57
  | value |
37
58
  | README |
38
59
  | Rakefile |
39
- When I run monad
60
+ When I run jekyll
40
61
  Then I should see "I want to be included" in "_site/index.html"
41
62
  And the "_site/Rakefile" file should not exist
42
63
  And the "_site/README" file should not exist
@@ -44,35 +65,35 @@ Feature: Site configuration
44
65
  Scenario: Use RDiscount for markup
45
66
  Given I have an "index.markdown" page that contains "[Google](http://google.com)"
46
67
  And I have a configuration file with "markdown" set to "rdiscount"
47
- When I run monad
68
+ When I run jekyll
48
69
  Then the _site directory should exist
49
70
  And I should see "<a href="http://google.com">Google</a>" in "_site/index.html"
50
71
 
51
72
  Scenario: Use Kramdown for markup
52
73
  Given I have an "index.markdown" page that contains "[Google](http://google.com)"
53
74
  And I have a configuration file with "markdown" set to "kramdown"
54
- When I run monad
75
+ When I run jekyll
55
76
  Then the _site directory should exist
56
77
  And I should see "<a href="http://google.com">Google</a>" in "_site/index.html"
57
78
 
58
79
  Scenario: Use Redcarpet for markup
59
80
  Given I have an "index.markdown" page that contains "[Google](http://google.com)"
60
81
  And I have a configuration file with "markdown" set to "redcarpet"
61
- When I run monad
82
+ When I run jekyll
62
83
  Then the _site directory should exist
63
84
  And I should see "<a href="http://google.com">Google</a>" in "_site/index.html"
64
85
 
65
86
  Scenario: Use Maruku for markup
66
87
  Given I have an "index.markdown" page that contains "[Google](http://google.com)"
67
88
  And I have a configuration file with "markdown" set to "maruku"
68
- When I run monad
89
+ When I run jekyll
69
90
  Then the _site directory should exist
70
91
  And I should see "<a href='http://google.com'>Google</a>" in "_site/index.html"
71
92
 
72
93
  Scenario: Highlight code with pygments
73
94
  Given I have an "index.html" file that contains "{% highlight ruby %} puts 'Hello world!' {% endhighlight %}"
74
95
  And I have a configuration file with "pygments" set to "true"
75
- When I run monad
96
+ When I run jekyll
76
97
  Then the _site directory should exist
77
98
  And I should see "puts 'Hello world!'" in "_site/index.html"
78
99
 
@@ -88,9 +109,9 @@ Feature: Site configuration
88
109
  And I have a _posts directory
89
110
  And I have the following posts:
90
111
  | title | date | layout | content |
91
- | entry1 | 12/31/2007 | post | content for entry1. |
92
- | entry2 | 01/31/2020 | post | content for entry2. |
93
- When I run monad
112
+ | entry1 | 2007-12-31 | post | content for entry1. |
113
+ | entry2 | 2020-01-31 | post | content for entry2. |
114
+ When I run jekyll
94
115
  Then the _site directory should exist
95
116
  And I should see "Page Layout: 1 on 2010-01-01" in "_site/index.html"
96
117
  And I should see "Post Layout: <p>content for entry1.</p>" in "_site/2007/12/31/entry1.html"
@@ -108,9 +129,9 @@ Feature: Site configuration
108
129
  And I have a _posts directory
109
130
  And I have the following posts:
110
131
  | title | date | layout | content |
111
- | entry1 | 12/31/2007 | post | content for entry1. |
112
- | entry2 | 01/31/2020 | post | content for entry2. |
113
- When I run monad
132
+ | entry1 | 2007-12-31 | post | content for entry1. |
133
+ | entry2 | 2020-01-31 | post | content for entry2. |
134
+ When I run jekyll
114
135
  Then the _site directory should exist
115
136
  And I should see "Page Layout: 2 on 2010-01-01" in "_site/index.html"
116
137
  And I should see "Post Layout: <p>content for entry1.</p>" in "_site/2007/12/31/entry1.html"
@@ -129,7 +150,7 @@ Feature: Site configuration
129
150
  | title | date | layout | content |
130
151
  | entry1 | 2013-04-09 23:22 -0400 | post | content for entry1. |
131
152
  | entry2 | 2013-04-10 03:14 -0400 | post | content for entry2. |
132
- When I run monad
153
+ When I run jekyll
133
154
  Then the _site directory should exist
134
155
  And I should see "Page Layout: 2" in "_site/index.html"
135
156
  And I should see "Post Layout: <p>content for entry1.</p> built at 2013-04-09T23:22:00-04:00" in "_site/2013/04/09/entry1.html"
@@ -148,7 +169,7 @@ Feature: Site configuration
148
169
  | title | date | layout | content |
149
170
  | entry1 | 2013-04-09 23:22 -0400 | post | content for entry1. |
150
171
  | entry2 | 2013-04-10 03:14 -0400 | post | content for entry2. |
151
- When I run monad
172
+ When I run jekyll
152
173
  Then the _site directory should exist
153
174
  And I should see "Page Layout: 2" in "_site/index.html"
154
175
  And the "_site/2013/04/10/entry1.html" file should exist
@@ -163,10 +184,10 @@ Feature: Site configuration
163
184
  | limit_posts | 2 |
164
185
  And I have the following posts:
165
186
  | title | date | content |
166
- | Apples | 3/27/2009 | An article about apples |
167
- | Oranges | 4/1/2009 | An article about oranges |
168
- | Bananas | 4/5/2009 | An article about bananas |
169
- When I run monad
187
+ | Apples | 2009-03-27 | An article about apples |
188
+ | Oranges | 2009-04-01 | An article about oranges |
189
+ | Bananas | 2009-04-05 | An article about bananas |
190
+ When I run jekyll
170
191
  Then the _site directory should exist
171
192
  And the "_site/2009/04/05/bananas.html" file should exist
172
193
  And the "_site/2009/04/01/oranges.html" file should exist
@@ -179,7 +200,7 @@ Feature: Site configuration
179
200
  | value |
180
201
  | .gitignore |
181
202
  | .foo |
182
- When I run monad
203
+ When I run jekyll
183
204
  Then the _site directory should exist
184
205
  And I should see ".DS_Store" in "_site/.gitignore"
185
206
  And the "_site/.htaccess" file should not exist
@@ -197,9 +218,9 @@ Feature: Site configuration
197
218
  And I have a _posts directory
198
219
  And I have the following posts:
199
220
  | title | date | layout | content |
200
- | entry1 | 12/31/2007 | post | content for entry1. |
201
- | entry2 | 01/31/2020 | post | content for entry2. |
202
- When I run monad
221
+ | entry1 | 2007-12-31 | post | content for entry1. |
222
+ | entry2 | 2020-01-31 | post | content for entry2. |
223
+ When I run jekyll
203
224
  Then the _site directory should exist
204
225
  And I should see "Page Layout: 2 on 2010-01-01" in "_site/index.html"
205
226
  And I should see "Post Layout: <p>content for entry1.</p>" in "_site/2007/12/31/entry1.html"
@@ -5,14 +5,14 @@ Feature: Site data
5
5
 
6
6
  Scenario: Use page variable in a page
7
7
  Given I have an "contact.html" page with title "Contact" that contains "{{ page.title }}: email@me.com"
8
- When I run monad
8
+ When I run jekyll
9
9
  Then the _site directory should exist
10
10
  And I should see "Contact: email@me.com" in "_site/contact.html"
11
11
 
12
12
  Scenario Outline: Use page.path variable in a page
13
13
  Given I have a <dir> directory
14
14
  And I have a "<path>" page that contains "Source path: {{ page.path }}"
15
- When I run monad
15
+ When I run jekyll
16
16
  Then the _site directory should exist
17
17
  And I should see "Source path: <path>" in "_site/<path>"
18
18
 
@@ -24,13 +24,13 @@ Feature: Site data
24
24
 
25
25
  Scenario: Override page.path
26
26
  Given I have an "override.html" page with path "custom-override.html" that contains "Custom path: {{ page.path }}"
27
- When I run monad
27
+ When I run jekyll
28
28
  Then the _site directory should exist
29
29
  And I should see "Custom path: custom-override.html" in "_site/override.html"
30
30
 
31
31
  Scenario: Use site.time variable
32
32
  Given I have an "index.html" page that contains "{{ site.time }}"
33
- When I run monad
33
+ When I run jekyll
34
34
  Then the _site directory should exist
35
35
  And I should see today's time in "_site/index.html"
36
36
 
@@ -39,10 +39,10 @@ Feature: Site data
39
39
  And I have an "index.html" page that contains "{{ site.posts.first.title }}: {{ site.posts.first.url }}"
40
40
  And I have the following posts:
41
41
  | title | date | content |
42
- | First Post | 3/25/2009 | My First Post |
43
- | Second Post | 3/26/2009 | My Second Post |
44
- | Third Post | 3/27/2009 | My Third Post |
45
- When I run monad
42
+ | First Post | 2009-03-25 | My First Post |
43
+ | Second Post | 2009-03-26 | My Second Post |
44
+ | Third Post | 2009-03-27 | My Third Post |
45
+ When I run jekyll
46
46
  Then the _site directory should exist
47
47
  And I should see "Third Post: /2009/03/27/third-post.html" in "_site/index.html"
48
48
 
@@ -51,10 +51,10 @@ Feature: Site data
51
51
  And I have an "index.html" page that contains "{% for post in site.posts %} {{ post.title }} {% endfor %}"
52
52
  And I have the following posts:
53
53
  | title | date | content |
54
- | First Post | 3/25/2009 | My First Post |
55
- | Second Post | 3/26/2009 | My Second Post |
56
- | Third Post | 3/27/2009 | My Third Post |
57
- When I run monad
54
+ | First Post | 2009-03-25 | My First Post |
55
+ | Second Post | 2009-03-26 | My Second Post |
56
+ | Third Post | 2009-03-27 | My Third Post |
57
+ When I run jekyll
58
58
  Then the _site directory should exist
59
59
  And I should see "Third Post Second Post First Post" in "_site/index.html"
60
60
 
@@ -63,9 +63,9 @@ Feature: Site data
63
63
  And I have an "index.html" page that contains "{% for post in site.categories.code %} {{ post.title }} {% endfor %}"
64
64
  And I have the following posts:
65
65
  | title | date | category | content |
66
- | Awesome Hack | 3/26/2009 | code | puts 'Hello World' |
67
- | Delicious Beer | 3/26/2009 | food | 1) Yuengling |
68
- When I run monad
66
+ | Awesome Hack | 2009-03-26 | code | puts 'Hello World' |
67
+ | Delicious Beer | 2009-03-26 | food | 1) Yuengling |
68
+ When I run jekyll
69
69
  Then the _site directory should exist
70
70
  And I should see "Awesome Hack" in "_site/index.html"
71
71
 
@@ -74,8 +74,8 @@ Feature: Site data
74
74
  And I have an "index.html" page that contains "{% for post in site.tags.beer %} {{ post.content }} {% endfor %}"
75
75
  And I have the following posts:
76
76
  | title | date | tag | content |
77
- | Delicious Beer | 3/26/2009 | beer | 1) Yuengling |
78
- When I run monad
77
+ | Delicious Beer | 2009-03-26 | beer | 1) Yuengling |
78
+ When I run jekyll
79
79
  Then the _site directory should exist
80
80
  And I should see "Yuengling" in "_site/index.html"
81
81
 
@@ -84,18 +84,24 @@ Feature: Site data
84
84
  And I have an "index.html" page that contains "{% for post in site.posts %}{{ post.title }}:{{ post.previous.title}},{{ post.next.title}} {% endfor %}"
85
85
  And I have the following posts:
86
86
  | title | date | content |
87
- | first | 2/26/2009 | first |
88
- | A | 3/26/2009 | A |
89
- | B | 3/26/2009 | B |
90
- | C | 3/26/2009 | C |
91
- | last | 4/26/2009 | last |
92
- When I run monad
87
+ | first | 2009-02-26 | first |
88
+ | A | 2009-03-26 | A |
89
+ | B | 2009-03-26 | B |
90
+ | C | 2009-03-26 | C |
91
+ | last | 2009-04-26 | last |
92
+ When I run jekyll
93
93
  Then the _site directory should exist
94
94
  And I should see "last:C, C:B,last B:A,C A:first,B first:,A" in "_site/index.html"
95
95
 
96
96
  Scenario: Use configuration date in site payload
97
97
  Given I have an "index.html" page that contains "{{ site.url }}"
98
98
  And I have a configuration file with "url" set to "http://mysite.com"
99
- When I run monad
99
+ When I run jekyll
100
100
  Then the _site directory should exist
101
101
  And I should see "http://mysite.com" in "_site/index.html"
102
+
103
+ Scenario: Access Jekyll version via jekyll.version
104
+ Given I have an "index.html" page that contains "{{ jekyll.version }}"
105
+ When I run jekyll
106
+ Then the _site directory should exist
107
+ And I should see "\d+\.\d+\.\d+" in "_site/index.html"
@@ -4,16 +4,17 @@ Before do
4
4
  Dir.chdir(TEST_DIR)
5
5
  end
6
6
 
7
- After do
8
- Dir.chdir(File.expand_path("..", TEST_DIR))
9
- FileUtils.rm_rf(TEST_DIR)
10
- end
7
+ World(Test::Unit::Assertions)
11
8
 
12
9
  Given /^I have a blank site in "(.*)"$/ do |path|
13
- FileUtils.mkdir(path)
10
+ FileUtils.mkdir_p(path)
11
+ end
12
+
13
+ Given /^I do not have a "(.*)" directory$/ do |path|
14
+ File.directory?("#{TEST_DIR}/#{path}")
14
15
  end
15
16
 
16
- # Like "I have a foo file" but gives a yaml front matter so monad actually processes it
17
+ # Like "I have a foo file" but gives a yaml front matter so jekyll actually processes it
17
18
  Given /^I have an? "(.*)" page(?: with (.*) "(.*)")? that contains "(.*)"$/ do |file, key, value, text|
18
19
  File.open(file, 'w') do |f|
19
20
  f.write <<EOF
@@ -31,20 +32,24 @@ Given /^I have an? "(.*)" file that contains "(.*)"$/ do |file, text|
31
32
  end
32
33
  end
33
34
 
34
- Given /^I have an? "(.*)" file with content:$/ do |file, text|
35
- File.open(file, 'w') do |f|
36
- f.write(text)
35
+ Given /^I have an? (.*) (layout|theme) that contains "(.*)"$/ do |name, type, text|
36
+ folder = if type == 'layout'
37
+ '_layouts'
38
+ else
39
+ '_theme'
37
40
  end
38
- end
39
-
40
- Given /^I have a (.*) layout that contains "(.*)"$/ do |layout, text|
41
- File.open(File.join('_layouts', layout + '.html'), 'w') do |f|
41
+ destination_file = File.join(folder, name + '.html')
42
+ destination_path = File.dirname(destination_file)
43
+ unless File.exist?(destination_path)
44
+ FileUtils.mkdir_p(destination_path)
45
+ end
46
+ File.open(destination_file, 'w') do |f|
42
47
  f.write(text)
43
48
  end
44
49
  end
45
50
 
46
- Given /^I have a (.*) theme that contains "(.*)"$/ do |layout, text|
47
- File.open(File.join('_theme', layout + '.html'), 'w') do |f|
51
+ Given /^I have an? "(.*)" file with content:$/ do |file, text|
52
+ File.open(file, 'w') do |f|
48
53
  f.write(text)
49
54
  end
50
55
  end
@@ -53,44 +58,33 @@ Given /^I have an? (.*) directory$/ do |dir|
53
58
  FileUtils.mkdir_p(dir)
54
59
  end
55
60
 
56
- Given /^I have the following (draft|post)s?(?: (.*) "(.*)")?:$/ do |status, direction, folder, table|
61
+ Given /^I have the following (draft|post)s?(?: (in|under) "([^"]+)")?:$/ do |status, direction, folder, table|
57
62
  table.hashes.each do |post|
58
- title = post['title'].downcase.gsub(/[^\w]/, " ").strip.gsub(/\s+/, '-')
59
-
60
- if direction && direction == "in"
61
- before = folder || '.'
62
- elsif direction && direction == "under"
63
- after = folder || '.'
64
- end
65
-
63
+ title = slug(post['title'])
66
64
  ext = post['type'] || 'textile'
65
+ before, after = location(folder, direction)
67
66
 
68
67
  if "draft" == status
69
- path = File.join(before || '.', '_drafts', after || '.', "#{title}.#{ext}")
70
- else
71
- format = if has_time_component?(post['date'])
72
- '%Y-%m-%d %H:%M %z'
73
- else
74
- '%m/%d/%Y' # why even
75
- end
76
- parsed_date = DateTime.strptime(post['date'], format)
77
- post['date'] = parsed_date.to_s
78
- date = parsed_date.strftime('%Y-%m-%d')
79
- path = File.join(before || '.', '_posts', after || '.', "#{date}-#{title}.#{ext}")
68
+ folder_post = '_drafts'
69
+ filename = "#{title}.#{ext}"
70
+ elsif "post" == status
71
+ parsed_date = Time.xmlschema(post['date']) rescue Time.parse(post['date'])
72
+ folder_post = '_posts'
73
+ filename = "#{parsed_date.strftime('%Y-%m-%d')}-#{title}.#{ext}"
80
74
  end
81
75
 
76
+ path = File.join(before, folder_post, after, filename)
77
+
82
78
  matter_hash = {}
83
- %w(title layout tag tags category categories published author path).each do |key|
79
+ %w(title layout tag tags category categories published author path date permalink).each do |key|
84
80
  matter_hash[key] = post[key] if post[key]
85
81
  end
86
- if "post" == status
87
- matter_hash["date"] = post["date"] if post["date"]
88
- end
89
82
  matter = matter_hash.map { |k, v| "#{k}: #{v}\n" }.join.chomp
90
83
 
91
- content = post['content']
92
- if post['input'] && post['filter']
93
- content = "{{ #{post['input']} | #{post['filter']} }}"
84
+ content = if post['input'] && post['filter']
85
+ "{{ #{post['input']} | #{post['filter']} }}"
86
+ else
87
+ post['content']
94
88
  end
95
89
 
96
90
  File.open(path, 'w') do |f|
@@ -128,16 +122,20 @@ Given /^I have a configuration file with "([^\"]*)" set to:$/ do |key, table|
128
122
  end
129
123
 
130
124
 
131
- When /^I run monad$/ do
132
- run_monad
125
+ When /^I run jekyll$/ do
126
+ run_jekyll
133
127
  end
134
128
 
135
- When /^I run monad with drafts$/ do
136
- run_monad(:drafts => true)
129
+ When /^I run jekyll with drafts$/ do
130
+ run_jekyll(:drafts => true)
137
131
  end
138
132
 
139
- When /^I debug monad$/ do
140
- run_monad(:debug => true)
133
+ When /^I call jekyll new with test_blank --blank$/ do
134
+ call_jekyll_new(:path => "test_blank", :blank => true)
135
+ end
136
+
137
+ When /^I debug jekyll$/ do
138
+ run_jekyll(:debug => true)
141
139
  end
142
140
 
143
141
  When /^I change "(.*)" to contain "(.*)"$/ do |file, text|
@@ -146,24 +144,40 @@ When /^I change "(.*)" to contain "(.*)"$/ do |file, text|
146
144
  end
147
145
  end
148
146
 
149
- Then /^the (.*) directory should exist$/ do |dir|
147
+ When /^I delete the file "(.*)"$/ do |file|
148
+ File.delete(file)
149
+ end
150
+
151
+ Then /^the (.*) directory should +exist$/ do |dir|
150
152
  assert File.directory?(dir), "The directory \"#{dir}\" does not exist"
151
153
  end
152
154
 
155
+ Then /^the (.*) directory should not exist$/ do |dir|
156
+ assert !File.directory?(dir), "The directory \"#{dir}\" exists"
157
+ end
158
+
153
159
  Then /^I should see "(.*)" in "(.*)"$/ do |text, file|
154
160
  assert Regexp.new(text).match(File.open(file).readlines.join)
155
161
  end
156
162
 
163
+ Then /^I should see exactly "(.*)" in "(.*)"$/ do |text, file|
164
+ assert_equal text, File.open(file).readlines.join.strip
165
+ end
166
+
167
+ Then /^I should not see "(.*)" in "(.*)"$/ do |text, file|
168
+ assert_no_match Regexp.new(text), File.read(file)
169
+ end
170
+
157
171
  Then /^I should see escaped "(.*)" in "(.*)"$/ do |text, file|
158
172
  assert Regexp.new(Regexp.escape(text)).match(File.open(file).readlines.join)
159
173
  end
160
174
 
161
- Then /^the "(.*)" file should exist$/ do |file|
162
- assert File.file?(file)
175
+ Then /^the "(.*)" file should +exist$/ do |file|
176
+ assert File.file?(file), "The file \"#{file}\" does not exist"
163
177
  end
164
178
 
165
179
  Then /^the "(.*)" file should not exist$/ do |file|
166
- assert !File.exists?(file)
180
+ assert !File.exists?(file), "The file \"#{file}\" exists"
167
181
  end
168
182
 
169
183
  Then /^I should see today's time in "(.*)"$/ do |file|