middleman-tansu 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +14 -0
- data/.travis.yml +13 -0
- data/Gemfile +6 -0
- data/LICENSE.txt +22 -0
- data/README.md +31 -0
- data/Rakefile +2 -0
- data/features/auto_index.feature +155 -0
- data/features/helpers.feature +138 -0
- data/features/step_definitions/helpers_steps.rb +11 -0
- data/features/support/env.rb +4 -0
- data/features/tansu_cli.feature +80 -0
- data/features/template_cli.feature +27 -0
- data/fixtures/.gitkeep +0 -0
- data/fixtures/breadcrumbs-app/config.rb +1 -0
- data/fixtures/breadcrumbs-app/source/dir/page.md +0 -0
- data/fixtures/breadcrumbs-app/source/images/.gitkeep +0 -0
- data/fixtures/breadcrumbs-app/source/javascripts/.gitkeep +0 -0
- data/fixtures/breadcrumbs-app/source/layouts/layout.erb +13 -0
- data/fixtures/breadcrumbs-app/source/stylesheets/all.css +0 -0
- data/fixtures/breadcrumbs-app/source/templates/index.html.erb +1 -0
- data/fixtures/breadcrumbs-params-app/config.rb +1 -0
- data/fixtures/breadcrumbs-params-app/source/dir/page.md +0 -0
- data/fixtures/breadcrumbs-params-app/source/images/.gitkeep +0 -0
- data/fixtures/breadcrumbs-params-app/source/javascripts/.gitkeep +0 -0
- data/fixtures/breadcrumbs-params-app/source/layouts/layout.erb +13 -0
- data/fixtures/breadcrumbs-params-app/source/stylesheets/all.css +0 -0
- data/fixtures/breadcrumbs-params-app/source/templates/index.html.erb +1 -0
- data/fixtures/children-pages-app/config.rb +2 -0
- data/fixtures/children-pages-app/source/dir1/no-title-page.md +4 -0
- data/fixtures/children-pages-app/source/dir1/page1.md +5 -0
- data/fixtures/children-pages-app/source/dir1/page2.md +5 -0
- data/fixtures/children-pages-app/source/dir1/page3.md +5 -0
- data/fixtures/children-pages-app/source/dir1/sub_dir1/page1.md +5 -0
- data/fixtures/children-pages-app/source/dir1/sub_dir2/.gitkeep +0 -0
- data/fixtures/children-pages-app/source/dir2/.gitkeep +0 -0
- data/fixtures/children-pages-app/source/images/.gitkeep +0 -0
- data/fixtures/children-pages-app/source/javascripts/.gitkeep +0 -0
- data/fixtures/children-pages-app/source/layouts/layout.erb +13 -0
- data/fixtures/children-pages-app/source/page1.md +5 -0
- data/fixtures/children-pages-app/source/stylesheets/all.css +0 -0
- data/fixtures/children-pages-app/source/templates/index.html.erb +1 -0
- data/fixtures/children-pages-with-category-app/config.rb +2 -0
- data/fixtures/children-pages-with-category-app/source/dir1/no-title-page.md +5 -0
- data/fixtures/children-pages-with-category-app/source/dir1/page1.md +6 -0
- data/fixtures/children-pages-with-category-app/source/dir1/page2.md +6 -0
- data/fixtures/children-pages-with-category-app/source/dir1/page3.md +6 -0
- data/fixtures/children-pages-with-category-app/source/dir1/sub_dir1/page1.md +5 -0
- data/fixtures/children-pages-with-category-app/source/dir1/sub_dir2/.gitkeep +0 -0
- data/fixtures/children-pages-with-category-app/source/dir2/.gitkeep +0 -0
- data/fixtures/children-pages-with-category-app/source/images/.gitkeep +0 -0
- data/fixtures/children-pages-with-category-app/source/javascripts/.gitkeep +0 -0
- data/fixtures/children-pages-with-category-app/source/layouts/layout.erb +13 -0
- data/fixtures/children-pages-with-category-app/source/page1.md +5 -0
- data/fixtures/children-pages-with-category-app/source/stylesheets/all.css +0 -0
- data/fixtures/children-pages-with-category-app/source/templates/index.html.erb +1 -0
- data/fixtures/drawer-app-with-markdown/config.rb +1 -0
- data/fixtures/drawer-app-with-markdown/source/empty_dir/sub_empty_dir/.gitkeep +0 -0
- data/fixtures/drawer-app-with-markdown/source/empty_dir/sub_empty_dir/sample.html.md +1 -0
- data/fixtures/drawer-app-with-markdown/source/images/.gitkeep +0 -0
- data/fixtures/drawer-app-with-markdown/source/javascripts/.gitkeep +0 -0
- data/fixtures/drawer-app-with-markdown/source/layouts/layout.erb +9 -0
- data/fixtures/drawer-app-with-markdown/source/not_empty_dir/index.html.md +1 -0
- data/fixtures/drawer-app-with-markdown/source/stylesheets/all.css +0 -0
- data/fixtures/drawer-app-with-markdown/source/templates/index.html.md +1 -0
- data/fixtures/drawer-app/config.rb +1 -0
- data/fixtures/drawer-app/source/empty_dir/sub_empty_dir/.gitkeep +0 -0
- data/fixtures/drawer-app/source/empty_dir/sub_empty_dir/sample.html.md +1 -0
- data/fixtures/drawer-app/source/images/.gitkeep +0 -0
- data/fixtures/drawer-app/source/javascripts/.gitkeep +0 -0
- data/fixtures/drawer-app/source/layouts/layout.erb +9 -0
- data/fixtures/drawer-app/source/not_empty_dir/index.html.erb +2 -0
- data/fixtures/drawer-app/source/stylesheets/all.css +0 -0
- data/fixtures/drawer-app/source/templates/index.html.erb +1 -0
- data/fixtures/empty-app/source/.gitkeep +0 -0
- data/fixtures/path-list-app/config.rb +1 -0
- data/fixtures/path-list-app/source/images/.gitkeep +0 -0
- data/fixtures/path-list-app/source/javascripts/.gitkeep +0 -0
- data/fixtures/path-list-app/source/layouts/layout.erb +9 -0
- data/fixtures/path-list-app/source/page/list/.gitkeep +0 -0
- data/fixtures/path-list-app/source/stylesheets/all.css +0 -0
- data/fixtures/path-list-app/source/templates/index.html.erb +15 -0
- data/lib/middleman-tansu.rb +12 -0
- data/lib/middleman-tansu/command.rb +126 -0
- data/lib/middleman-tansu/drawer.rb +50 -0
- data/lib/middleman-tansu/extension.rb +34 -0
- data/lib/middleman-tansu/helpers.rb +96 -0
- data/lib/middleman-tansu/template.rb +42 -0
- data/lib/middleman-tansu/template/shared/Gemfile.tt +22 -0
- data/lib/middleman-tansu/template/shared/config.tt +84 -0
- data/lib/middleman-tansu/template/source/layouts/layout.slim +54 -0
- data/lib/middleman-tansu/template/source/sample.html.md +75 -0
- data/lib/middleman-tansu/template/source/stylesheets/all.css.sass +82 -0
- data/lib/middleman-tansu/template/source/stylesheets/github-markdown.css +696 -0
- data/lib/middleman-tansu/template/source/templates/index.html.slim +6 -0
- data/lib/middleman-tansu/version.rb +5 -0
- data/lib/middleman_extension.rb +1 -0
- data/middleman-tansu.gemspec +32 -0
- metadata +259 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: f7fce26f327edb02a1c7a083ac2e729f523bf568
|
4
|
+
data.tar.gz: b82c686c623b93acc9760f15dac63c420e78390b
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 0e500f102f58d8b7c496c59dce75264a61db0128604c2ea420abad08d0132d67825192ae1fc41e401dc71192876eac4e0506730543cc533772724dcf84a540aa
|
7
|
+
data.tar.gz: 0667f238089acb02a97ac1587c767225c0db7e02f5e79822c4e744eee47e16f1e5b2e346ce4f40890adf61fdb104a5789446ef50410e0325d0032b8dad3eed1f
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2015 Yuya Terajima
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# Middleman::Tansu
|
2
|
+
|
3
|
+
TODO: Write a gem description
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'middleman-tansu'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install middleman-tansu
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
TODO: Write usage instructions here
|
24
|
+
|
25
|
+
## Contributing
|
26
|
+
|
27
|
+
1. Fork it ( https://github.com/[my-github-username]/middleman-tansu/fork )
|
28
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
29
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
30
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
31
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,155 @@
|
|
1
|
+
Feature: Auto index page
|
2
|
+
|
3
|
+
Scenario: Create index file in directories that have "index.html.erb"
|
4
|
+
Given a fixture app "drawer-app"
|
5
|
+
When I run `middleman build`
|
6
|
+
Then the exit status should be 0
|
7
|
+
And the following files should exist:
|
8
|
+
| build/index.html |
|
9
|
+
| build/empty_dir/index.html |
|
10
|
+
| build/empty_dir/sub_empty_dir/index.html |
|
11
|
+
| build/empty_dir/sub_empty_dir/sample.html |
|
12
|
+
| build/not_empty_dir/index.html |
|
13
|
+
And the file "build/index.html" should contain "Proxy Template"
|
14
|
+
And the file "build/empty_dir/index.html" should contain "Proxy Template"
|
15
|
+
And the file "build/empty_dir/sub_empty_dir/index.html" should contain "Proxy Template"
|
16
|
+
And the file "build/empty_dir/sub_empty_dir/sample.html" should contain "Sample"
|
17
|
+
And the file "build/not_empty_dir/index.html" should contain "Not Empty"
|
18
|
+
|
19
|
+
Scenario: Create index file in directories that have "index.html.md"
|
20
|
+
Given a fixture app "drawer-app-with-markdown"
|
21
|
+
When I run `middleman build`
|
22
|
+
Then the exit status should be 0
|
23
|
+
And the following files should exist:
|
24
|
+
| build/index.html |
|
25
|
+
| build/empty_dir/index.html |
|
26
|
+
| build/empty_dir/sub_empty_dir/index.html |
|
27
|
+
| build/empty_dir/sub_empty_dir/sample.html |
|
28
|
+
| build/not_empty_dir/index.html |
|
29
|
+
And the file "build/index.html" should contain "Proxy Template"
|
30
|
+
And the file "build/empty_dir/index.html" should contain "Proxy Template"
|
31
|
+
And the file "build/empty_dir/sub_empty_dir/index.html" should contain "Proxy Template"
|
32
|
+
And the file "build/empty_dir/sub_empty_dir/sample.html" should contain "Sample"
|
33
|
+
And the file "build/not_empty_dir/index.html" should contain "Not Empty"
|
34
|
+
|
35
|
+
Scenario: Create index file in directories that have "index.html" without "build/index.html"
|
36
|
+
Given a fixture app "drawer-app"
|
37
|
+
And a file named "source/index.html.erb" with:
|
38
|
+
"""
|
39
|
+
<h1>Root Index</h1>
|
40
|
+
"""
|
41
|
+
When I run `middleman build`
|
42
|
+
Then the exit status should be 0
|
43
|
+
And a file named "build/index.html" should exist
|
44
|
+
And the file "build/index.html" should contain "Root Index"
|
45
|
+
|
46
|
+
Scenario: Don't create index file in default exclude directories
|
47
|
+
Given a fixture app "drawer-app"
|
48
|
+
When I run `middleman build`
|
49
|
+
Then the exit status should be 0
|
50
|
+
And the following files should not exist:
|
51
|
+
| build/images/index.html |
|
52
|
+
| build/stylesheets/index.html |
|
53
|
+
| build/javascripts/index.html |
|
54
|
+
| build/layouts/index.html |
|
55
|
+
| build/templates/index.html |
|
56
|
+
|
57
|
+
Scenario: Don't create a file in exclude_path option
|
58
|
+
Given a fixture app "drawer-app"
|
59
|
+
And a file named "config.rb" with:
|
60
|
+
"""
|
61
|
+
activate :tansu, :exclude_path => %w(exclude not_exclude/exclude)
|
62
|
+
"""
|
63
|
+
And a directory named "source/exclude"
|
64
|
+
And a directory named "source/not_exclude/exclude"
|
65
|
+
When I run `middleman build`
|
66
|
+
Then the exit status should be 0
|
67
|
+
And the following files should exist:
|
68
|
+
| build/index.html |
|
69
|
+
| build/empty_dir/index.html |
|
70
|
+
| build/empty_dir/sub_empty_dir/index.html |
|
71
|
+
| build/empty_dir/sub_empty_dir/sample.html |
|
72
|
+
| build/not_empty_dir/index.html |
|
73
|
+
| build/not_exclude/index.html |
|
74
|
+
And the following files should not exist:
|
75
|
+
| build/exclude/index.html |
|
76
|
+
| build/not_exclude/exclude/index.html |
|
77
|
+
|
78
|
+
Scenario: Use :index_template_name option
|
79
|
+
Given a fixture app "drawer-app"
|
80
|
+
And a file named "config.rb" with:
|
81
|
+
"""
|
82
|
+
activate :tansu, :index_template_name => "template.html"
|
83
|
+
"""
|
84
|
+
And a file named "source/templates/template.html.erb" with:
|
85
|
+
"""
|
86
|
+
<h1>template.html.erb</h1>
|
87
|
+
"""
|
88
|
+
When I run `middleman build`
|
89
|
+
Then the exit status should be 0
|
90
|
+
And the following files should exist:
|
91
|
+
| build/index.html |
|
92
|
+
| build/empty_dir/index.html |
|
93
|
+
| build/empty_dir/sub_empty_dir/index.html |
|
94
|
+
| build/empty_dir/sub_empty_dir/sample.html |
|
95
|
+
| build/not_empty_dir/index.html |
|
96
|
+
And the file "build/index.html" should contain "template.html.erb"
|
97
|
+
And the file "build/empty_dir/index.html" should contain "template.html.erb"
|
98
|
+
And the file "build/empty_dir/sub_empty_dir/index.html" should contain "template.html.erb"
|
99
|
+
And the file "build/empty_dir/sub_empty_dir/sample.html" should contain "Sample"
|
100
|
+
And the file "build/not_empty_dir/index.html" should contain "Not Empty"
|
101
|
+
|
102
|
+
Scenario: Use :templates_dir option
|
103
|
+
Given a fixture app "drawer-app"
|
104
|
+
And a file named "config.rb" with:
|
105
|
+
"""
|
106
|
+
activate :tansu, :templates_dir => "alt_templates"
|
107
|
+
"""
|
108
|
+
And a directory named "source/alt_templates"
|
109
|
+
And a file named "source/alt_templates/index.html.erb" with:
|
110
|
+
"""
|
111
|
+
<h1>Alt Template</h1>
|
112
|
+
"""
|
113
|
+
And a file named "source/templates/index.html.erb" with:
|
114
|
+
"""
|
115
|
+
<h1>Old Template</h1>
|
116
|
+
"""
|
117
|
+
When I run `middleman build`
|
118
|
+
Then the exit status should be 0
|
119
|
+
And the following files should exist:
|
120
|
+
| build/index.html |
|
121
|
+
| build/empty_dir/index.html |
|
122
|
+
| build/empty_dir/sub_empty_dir/index.html |
|
123
|
+
| build/empty_dir/sub_empty_dir/sample.html |
|
124
|
+
| build/not_empty_dir/index.html |
|
125
|
+
| build/templates/index.html |
|
126
|
+
And the file "build/index.html" should contain "Alt Template"
|
127
|
+
And the file "build/empty_dir/index.html" should contain "Alt Template"
|
128
|
+
And the file "build/empty_dir/sub_empty_dir/index.html" should contain "Alt Template"
|
129
|
+
And the file "build/empty_dir/sub_empty_dir/sample.html" should contain "Sample"
|
130
|
+
And the file "build/not_empty_dir/index.html" should contain "Not Empty"
|
131
|
+
And the file "build/templates/index.html" should contain "Old Template"
|
132
|
+
|
133
|
+
Scenario: Use :default_document option
|
134
|
+
Given a fixture app "drawer-app"
|
135
|
+
And a file named "config.rb" with:
|
136
|
+
"""
|
137
|
+
activate :tansu, :default_document => "default.html"
|
138
|
+
"""
|
139
|
+
When I run `middleman build`
|
140
|
+
Then the exit status should be 0
|
141
|
+
And the following files should exist:
|
142
|
+
| build/default.html |
|
143
|
+
| build/empty_dir/default.html |
|
144
|
+
| build/empty_dir/sub_empty_dir/default.html |
|
145
|
+
| build/empty_dir/sub_empty_dir/sample.html |
|
146
|
+
| build/not_empty_dir/index.html |
|
147
|
+
And the following files should not exist:
|
148
|
+
| build/index.html |
|
149
|
+
| build/empty_dir/index.html |
|
150
|
+
| build/empty_dir/sub_empty_dir/index.html |
|
151
|
+
And the file "build/default.html" should contain "Proxy Template"
|
152
|
+
And the file "build/empty_dir/default.html" should contain "Proxy Template"
|
153
|
+
And the file "build/empty_dir/sub_empty_dir/default.html" should contain "Proxy Template"
|
154
|
+
And the file "build/empty_dir/sub_empty_dir/sample.html" should contain "Sample"
|
155
|
+
And the file "build/not_empty_dir/default.html" should contain "Proxy Template"
|
@@ -0,0 +1,138 @@
|
|
1
|
+
Feature: Helpers
|
2
|
+
|
3
|
+
Scenario: `path_list` helper
|
4
|
+
Given a fixture app "path-list-app"
|
5
|
+
When I run `middleman build --verbose`
|
6
|
+
Then the exit status should be 0
|
7
|
+
And the helper result "build/index.html" should contain '<p>No Path List</p>'
|
8
|
+
And the helper result "build/page/list/index.html" should contain:
|
9
|
+
"""
|
10
|
+
<li>page:/page/</li>
|
11
|
+
<li>list:/page/list/</li>
|
12
|
+
"""
|
13
|
+
|
14
|
+
Scenario: `breadcrumbs` helper
|
15
|
+
Given a fixture app "breadcrumbs-app"
|
16
|
+
When I run `middleman build --verbose`
|
17
|
+
Then the exit status should be 0
|
18
|
+
|
19
|
+
# /index.html
|
20
|
+
And the helper result "build/index.html" should contain '<ul class="breadcrumbs">'
|
21
|
+
And the helper result "build/index.html" should contain '<li class="root"><a href="/">Top</a></li>'
|
22
|
+
|
23
|
+
# /dir/page.html
|
24
|
+
And the helper result "build/dir/page.html" should contain:
|
25
|
+
"""
|
26
|
+
<li class="root"><a href="/">Top</a></li>
|
27
|
+
<li><a href="/dir/">dir</a></li>
|
28
|
+
<li class="current">page</li>
|
29
|
+
"""
|
30
|
+
|
31
|
+
Scenario: `breadcrumbs` helper with params
|
32
|
+
Given a fixture app "breadcrumbs-params-app"
|
33
|
+
When I run `middleman build --verbose`
|
34
|
+
Then the exit status should be 0
|
35
|
+
|
36
|
+
# /index.html
|
37
|
+
And the helper result "build/index.html" should contain '<ul class="bread-links">'
|
38
|
+
And the helper result "build/index.html" should contain '<li class="root"><a href="/">Home</a></li>'
|
39
|
+
|
40
|
+
Scenario: `children_pages` helper
|
41
|
+
Given a fixture app "children-pages-app"
|
42
|
+
And a file named "source/templates/index.html.erb" with:
|
43
|
+
"""
|
44
|
+
<ul>
|
45
|
+
<% children_pages.each do |page| %>
|
46
|
+
<li><%= link_to(page_name(page), page_url(page)) %></li>
|
47
|
+
<% end %>
|
48
|
+
</ul>
|
49
|
+
"""
|
50
|
+
When I run `middleman build --verbose`
|
51
|
+
Then the exit status should be 0
|
52
|
+
And the helper result "build/index.html" should contain:
|
53
|
+
"""
|
54
|
+
<li><a href="/dir1/">dir1</a></li>
|
55
|
+
<li><a href="/dir2/">dir2</a></li>
|
56
|
+
<li><a href="/page1.html">Page1 Title</a></li>
|
57
|
+
"""
|
58
|
+
And the helper result "build/dir1/index.html" should contain:
|
59
|
+
"""
|
60
|
+
<li><a href="/dir1/sub_dir1/">dir1/sub_dir1</a></li>
|
61
|
+
<li><a href="/dir1/sub_dir2/">dir1/sub_dir2</a></li>
|
62
|
+
<li><a href="/dir1/page1.html">dir1/Page1 Title</a></li>
|
63
|
+
<li><a href="/dir1/page2.html">dir1/Page2 Title</a></li>
|
64
|
+
<li><a href="/dir1/page3.html">dir1/Page3 Title</a></li>
|
65
|
+
<li><a href="/dir1/no-title-page.html">dir1/no-title-page</a></li>
|
66
|
+
"""
|
67
|
+
|
68
|
+
Scenario: `children_pages` helper with "order_by = :desc" option
|
69
|
+
Given a fixture app "children-pages-app"
|
70
|
+
And a file named "source/templates/index.html.erb" with:
|
71
|
+
"""
|
72
|
+
<ul>
|
73
|
+
<% children_pages(:date, :desc).each do |page| %>
|
74
|
+
<li><%= link_to(page_name(page), page_url(page)) %></li>
|
75
|
+
<% end %>
|
76
|
+
</ul>
|
77
|
+
"""
|
78
|
+
When I run `middleman build --verbose`
|
79
|
+
Then the exit status should be 0
|
80
|
+
And the helper result "build/index.html" should contain:
|
81
|
+
"""
|
82
|
+
<li><a href="/dir2/">dir2</a></li>
|
83
|
+
<li><a href="/dir1/">dir1</a></li>
|
84
|
+
<li><a href="/page1.html">Page1 Title</a></li>
|
85
|
+
"""
|
86
|
+
And the helper result "build/dir1/index.html" should contain:
|
87
|
+
"""
|
88
|
+
<li><a href="/dir1/sub_dir2/">dir1/sub_dir2</a></li>
|
89
|
+
<li><a href="/dir1/sub_dir1/">dir1/sub_dir1</a></li>
|
90
|
+
<li><a href="/dir1/no-title-page.html">dir1/no-title-page</a></li>
|
91
|
+
<li><a href="/dir1/page3.html">dir1/Page3 Title</a></li>
|
92
|
+
<li><a href="/dir1/page2.html">dir1/Page2 Title</a></li>
|
93
|
+
<li><a href="/dir1/page1.html">dir1/Page1 Title</a></li>
|
94
|
+
"""
|
95
|
+
|
96
|
+
Scenario: `children_pages` helper with "key = :category" option
|
97
|
+
Given a fixture app "children-pages-with-category-app"
|
98
|
+
And a file named "source/templates/index.html.erb" with:
|
99
|
+
"""
|
100
|
+
<ul>
|
101
|
+
<% children_pages(:category).each do |page| %>
|
102
|
+
<li><%= link_to(page_name(page), page_url(page)) %></li>
|
103
|
+
<% end %>
|
104
|
+
</ul>
|
105
|
+
"""
|
106
|
+
When I run `middleman build --verbose`
|
107
|
+
Then the exit status should be 0
|
108
|
+
And the helper result "build/dir1/index.html" should contain:
|
109
|
+
"""
|
110
|
+
<li><a href="/dir1/sub_dir1/">dir1/sub_dir1</a></li>
|
111
|
+
<li><a href="/dir1/sub_dir2/">dir1/sub_dir2</a></li>
|
112
|
+
<li><a href="/dir1/page1.html">dir1/Page1 Title</a></li>
|
113
|
+
<li><a href="/dir1/page2.html">dir1/Page2 Title</a></li>
|
114
|
+
<li><a href="/dir1/page3.html">dir1/Page3 Title</a></li>
|
115
|
+
<li><a href="/dir1/no-title-page.html">dir1/no-title-page</a></li>
|
116
|
+
"""
|
117
|
+
|
118
|
+
Scenario: `children_pages` helper with "key = :category" and "order_by = :desc" option
|
119
|
+
Given a fixture app "children-pages-with-category-app"
|
120
|
+
And a file named "source/templates/index.html.erb" with:
|
121
|
+
"""
|
122
|
+
<ul>
|
123
|
+
<% children_pages(:category, :desc).each do |page| %>
|
124
|
+
<li><%= link_to(page_name(page), page_url(page)) %></li>
|
125
|
+
<% end %>
|
126
|
+
</ul>
|
127
|
+
"""
|
128
|
+
When I run `middleman build --verbose`
|
129
|
+
Then the exit status should be 0
|
130
|
+
And the helper result "build/dir1/index.html" should contain:
|
131
|
+
"""
|
132
|
+
<li><a href="/dir1/sub_dir2/">dir1/sub_dir2</a></li>
|
133
|
+
<li><a href="/dir1/sub_dir1/">dir1/sub_dir1</a></li>
|
134
|
+
<li><a href="/dir1/no-title-page.html">dir1/no-title-page</a></li>
|
135
|
+
<li><a href="/dir1/page3.html">dir1/Page3 Title</a></li>
|
136
|
+
<li><a href="/dir1/page2.html">dir1/Page2 Title</a></li>
|
137
|
+
<li><a href="/dir1/page1.html">dir1/Page1 Title</a></li>
|
138
|
+
"""
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require 'aruba/api'
|
2
|
+
require 'aruba/cucumber/hooks'
|
3
|
+
require 'aruba/reporting'
|
4
|
+
|
5
|
+
Then /^the helper result "(.*?)" should (not )?contain '(.*?)'$/ do |file, expect_match, partial_content|
|
6
|
+
check_file_content(file, Regexp.compile(Regexp.escape(partial_content)), !expect_match)
|
7
|
+
end
|
8
|
+
|
9
|
+
Then /^the helper result "(.*?)" should (not )?contain:$/ do |file, expect_match, partial_content|
|
10
|
+
check_file_content(file, Regexp.compile(Regexp.escape(partial_content)), !expect_match)
|
11
|
+
end
|
@@ -0,0 +1,80 @@
|
|
1
|
+
Feature: Tansu Command
|
2
|
+
|
3
|
+
Scenario: `middleman tansu` create a markdown file with frontmatter
|
4
|
+
Given a fixture app "empty-app"
|
5
|
+
When I run `middleman tansu foo`
|
6
|
+
Then the exit status should be 0
|
7
|
+
And a file named "source/foo.html.md" should exist
|
8
|
+
And the file "source/foo.html.md" should contain "title: foo"
|
9
|
+
And the file "source/foo.html.md" should not contain "title: foo.html.md"
|
10
|
+
And the file "source/foo.html.md" should contain "author:"
|
11
|
+
And the file "source/foo.html.md" should contain "date:"
|
12
|
+
|
13
|
+
Scenario: `middleman tansu` create a markdown file that has subdirectory
|
14
|
+
Given a fixture app "empty-app"
|
15
|
+
When I run `middleman tansu foo/bar/baz`
|
16
|
+
Then the exit status should be 0
|
17
|
+
And a file named "source/foo/bar/baz.html.md" should exist
|
18
|
+
And the file "source/foo/bar/baz.html.md" should contain "title: baz"
|
19
|
+
And the file "source/foo/bar/baz.html.md" should not contain "title: foo/bar/baz"
|
20
|
+
And the file "source/foo/bar/baz.html.md" should contain "author:"
|
21
|
+
And the file "source/foo/bar/baz.html.md" should contain "date:"
|
22
|
+
|
23
|
+
Scenario: `middleman tansu -f slim` create a slim file
|
24
|
+
Given a fixture app "empty-app"
|
25
|
+
When I run `middleman tansu -f slim foo`
|
26
|
+
Then the exit status should be 0
|
27
|
+
And a file named "source/foo.html.slim" should exist
|
28
|
+
And the file "source/foo.html.slim" should contain "title: foo"
|
29
|
+
And the file "source/foo.html.slim" should contain "author:"
|
30
|
+
And the file "source/foo.html.slim" should contain "date:"
|
31
|
+
|
32
|
+
Scenario: `middleman tansu -d 2014-01-22` create file with date frontmatter
|
33
|
+
Given a fixture app "empty-app"
|
34
|
+
When I run `middleman tansu -d 2014-01-04 foo`
|
35
|
+
Then the exit status should be 0
|
36
|
+
And a file named "source/foo.html.md" should exist
|
37
|
+
And the file "source/foo.html.md" should contain "title: foo"
|
38
|
+
And the file "source/foo.html.md" should contain "author:"
|
39
|
+
And the file "source/foo.html.md" should contain "date: 2014-01-04 00:00:00 UTC"
|
40
|
+
|
41
|
+
Scenario: `middleman tansu -a "John Doe"` create file with author frontmatter
|
42
|
+
Given a fixture app "empty-app"
|
43
|
+
When I run `middleman tansu -a "John Doe" foo`
|
44
|
+
Then the exit status should be 0
|
45
|
+
And a file named "source/foo.html.md" should exist
|
46
|
+
And the file "source/foo.html.md" should contain "title: foo"
|
47
|
+
And the file "source/foo.html.md" should contain "author: John Doe"
|
48
|
+
And the file "source/foo.html.md" should contain "date:"
|
49
|
+
|
50
|
+
Scenario: `middleman tansu --frontmatter "category: sample"` create file with category frontmatter
|
51
|
+
Given a fixture app "empty-app"
|
52
|
+
When I run `middleman tansu --frontmatter "category: sample" foo`
|
53
|
+
Then the exit status should be 0
|
54
|
+
And a file named "source/foo.html.md" should exist
|
55
|
+
And the file "source/foo.html.md" should contain "title: foo"
|
56
|
+
And the file "source/foo.html.md" should contain "author:"
|
57
|
+
And the file "source/foo.html.md" should contain "date:"
|
58
|
+
And the file "source/foo.html.md" should contain "category: sample"
|
59
|
+
|
60
|
+
Scenario: `middleman tansu --frontmatter "category: sample, tags: markdown"` create file with category frontmatter
|
61
|
+
Given a fixture app "empty-app"
|
62
|
+
When I run `middleman tansu --frontmatter "category: sample, tags: markdown" foo`
|
63
|
+
Then the exit status should be 0
|
64
|
+
And a file named "source/foo.html.md" should exist
|
65
|
+
And the file "source/foo.html.md" should contain "title: foo"
|
66
|
+
And the file "source/foo.html.md" should contain "author:"
|
67
|
+
And the file "source/foo.html.md" should contain "date:"
|
68
|
+
And the file "source/foo.html.md" should contain "category: sample"
|
69
|
+
And the file "source/foo.html.md" should contain "tags: markdown"
|
70
|
+
|
71
|
+
Scenario: `middleman tansu --frontmatter "category:sample,tags:markdown"` create file with category frontmatter
|
72
|
+
Given a fixture app "empty-app"
|
73
|
+
When I run `middleman tansu --frontmatter "category: sample, tags: markdown" foo`
|
74
|
+
Then the exit status should be 0
|
75
|
+
And a file named "source/foo.html.md" should exist
|
76
|
+
And the file "source/foo.html.md" should contain "title: foo"
|
77
|
+
And the file "source/foo.html.md" should contain "author:"
|
78
|
+
And the file "source/foo.html.md" should contain "date:"
|
79
|
+
And the file "source/foo.html.md" should contain "category: sample"
|
80
|
+
And the file "source/foo.html.md" should contain "tags: markdown"
|