smartgen 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog.md +14 -0
- data/Gemfile.lock +2 -2
- data/README.md +7 -0
- data/lib/smartgen/configuration.rb +1 -49
- data/lib/smartgen/engines.rb +1 -0
- data/lib/smartgen/engines/base.rb +3 -3
- data/lib/smartgen/engines/erb.rb +15 -0
- data/lib/smartgen/engines/markdown.rb +1 -1
- data/lib/smartgen/engines/textile.rb +1 -1
- data/lib/smartgen/generator.rb +29 -17
- data/lib/smartgen/markup_file.rb +6 -2
- data/lib/smartgen/object_hash.rb +15 -5
- data/lib/smartgen/rake_task.rb +21 -5
- data/lib/smartgen/renderers/erb.rb +1 -4
- data/lib/smartgen/resource.rb +1 -9
- data/lib/smartgen/version.rb +1 -1
- data/spec/fixtures/expectations/common/another_index.html +13 -0
- data/spec/fixtures/expectations/common/index.html +8 -0
- data/spec/fixtures/expectations/common/other_index.html +13 -0
- data/spec/fixtures/expectations/erb/index.html +15 -0
- data/spec/fixtures/expectations/erb/with_layout/index.html +19 -0
- data/spec/fixtures/expectations/indexer/index_with_indexer.html +16 -0
- data/spec/fixtures/expectations/indexer/index_with_indexer_and_numbered_index.html +16 -0
- data/spec/fixtures/expectations/with_layout/index.html +12 -0
- data/spec/fixtures/expectations/with_layout/index_with_metadata.html +43 -0
- data/spec/fixtures/expectations/with_layout/index_with_specific_metadata.html +44 -0
- data/spec/fixtures/src/assets/images/image.gif +0 -0
- data/spec/fixtures/src/assets/javascripts/somelib.js +2 -0
- data/spec/fixtures/src/assets/stylesheets/style.css +2 -0
- data/spec/fixtures/src/common/another_index.md +12 -0
- data/spec/fixtures/src/common/index.textile +10 -0
- data/spec/fixtures/src/common/other_index.markdown +12 -0
- data/spec/fixtures/src/common/somefile +10 -0
- data/spec/fixtures/src/erb/index.html.erb +7 -0
- data/spec/fixtures/src/erb/with_layout/index.html.erb +7 -0
- data/spec/fixtures/src/erb/with_layout/layout.html.erb +5 -0
- data/spec/fixtures/src/indexer/index_with_indexer.textile +26 -0
- data/spec/fixtures/src/indexer/index_with_indexer_and_numbered_index.textile +26 -0
- data/spec/fixtures/src/layout.html.erb +5 -0
- data/spec/fixtures/src/layout_with_metadata.html.erb +22 -0
- data/spec/fixtures/src/layout_with_specific_metadata.html.erb +23 -0
- data/spec/fixtures/src/metadata.yml +43 -0
- data/spec/fixtures/src/with_layout/index.textile +10 -0
- data/spec/fixtures/src/with_layout/index_with_specific_metadata.textile +10 -0
- data/spec/lib/smartgen/configuration_spec.rb +5 -0
- data/spec/lib/smartgen/engines/base_spec.rb +73 -0
- data/spec/lib/smartgen/engines/erb_spec.rb +37 -0
- data/spec/lib/smartgen/engines/markdown_spec.rb +23 -0
- data/spec/lib/smartgen/engines/textile_spec.rb +19 -0
- data/spec/lib/smartgen/generator_spec.rb +272 -0
- data/spec/lib/smartgen/indexer_spec.rb +122 -0
- data/spec/lib/smartgen/markup_file_spec.rb +168 -0
- data/spec/lib/smartgen/object_hash_spec.rb +91 -0
- data/spec/lib/smartgen/renderers/erb_spec.rb +32 -0
- data/spec/lib/smartgen/resource_spec.rb +73 -0
- data/spec/lib/smartgen/watcher_spec.rb +71 -0
- data/spec/lib/smartgen_spec.rb +18 -0
- data/spec/sandbox/.gitkeep +0 -0
- data/spec/spec_helper.rb +37 -0
- metadata +99 -13
@@ -0,0 +1,16 @@
|
|
1
|
+
<h1 id="here-is-some-header">Here is some header</h1>
|
2
|
+
<p>And here is a paragraph</p>
|
3
|
+
<ul>
|
4
|
+
<li>some bullet lists with <strong>style</strong></li>
|
5
|
+
<li>some bullet lists with <em>style</em></li>
|
6
|
+
</ul>
|
7
|
+
<h2 id="another-header">Another header</h2>
|
8
|
+
<p>With some text</p>
|
9
|
+
<h3 id="another-minor-header">Another minor header</h3>
|
10
|
+
<p>With some other text</p>
|
11
|
+
<h4 id="yet-another-smaller-header">Yet another smaller header</h4>
|
12
|
+
<p>Again some text</p>
|
13
|
+
<h3 id="a-minor-header">A minor header</h3>
|
14
|
+
<p>Something</p>
|
15
|
+
<h2 id="a-header">A header</h2>
|
16
|
+
<p>With something</p>
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<h1 id="here-is-some-header">1 Here is some header</h1>
|
2
|
+
<p>And here is a paragraph</p>
|
3
|
+
<ul>
|
4
|
+
<li>some bullet lists with <strong>style</strong></li>
|
5
|
+
<li>some bullet lists with <em>style</em></li>
|
6
|
+
</ul>
|
7
|
+
<h2 id="another-header">1.1 Another header</h2>
|
8
|
+
<p>With some text</p>
|
9
|
+
<h3 id="another-minor-header">1.1.1 Another minor header</h3>
|
10
|
+
<p>With some other text</p>
|
11
|
+
<h4 id="yet-another-smaller-header">1.1.1.1 Yet another smaller header</h4>
|
12
|
+
<p>Again some text</p>
|
13
|
+
<h3 id="a-minor-header">1.1.2 A minor header</h3>
|
14
|
+
<p>Something</p>
|
15
|
+
<h2 id="a-header">1.2 A header</h2>
|
16
|
+
<p>With something</p>
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<html>
|
2
|
+
<body>
|
3
|
+
<h1>Here is some header</h1>
|
4
|
+
<p>And here is a paragraph</p>
|
5
|
+
<ul>
|
6
|
+
<li>some bullet lists with <strong>style</strong></li>
|
7
|
+
<li>some bullet lists with <em>style</em></li>
|
8
|
+
</ul>
|
9
|
+
<h2>Another header</h2>
|
10
|
+
<p>With some text</p>
|
11
|
+
</body>
|
12
|
+
</html>
|
@@ -0,0 +1,43 @@
|
|
1
|
+
<html>
|
2
|
+
<head>
|
3
|
+
<title>Common title</title>
|
4
|
+
</head>
|
5
|
+
<body>
|
6
|
+
<section id="menu">
|
7
|
+
<dl>
|
8
|
+
|
9
|
+
<dt>Common pages</dt>
|
10
|
+
|
11
|
+
<dd><a href="http://link.com" title="Some description of page">Some page</a></dd>
|
12
|
+
|
13
|
+
<dd><a href="http://index.com" title="Description for index page">Index Page</a></dd>
|
14
|
+
|
15
|
+
<dd><a href="http://other_link.com" title="Some description of other page">Some other page</a></dd>
|
16
|
+
|
17
|
+
<dd><a href="http://another_link.com" title="Some description of another page">Another page</a></dd>
|
18
|
+
|
19
|
+
<hr/>
|
20
|
+
|
21
|
+
<dt>Sample pages</dt>
|
22
|
+
|
23
|
+
<dd><a href="http://sample.com" title="Some description of sample page">Sample page</a></dd>
|
24
|
+
|
25
|
+
<dd><a href="http://sample_link.com" title="Some description of some sample page">Some sample page</a></dd>
|
26
|
+
|
27
|
+
|
28
|
+
|
29
|
+
</dl>
|
30
|
+
</section>
|
31
|
+
|
32
|
+
<section id="contents">
|
33
|
+
<h1>Here is some header</h1>
|
34
|
+
<p>And here is a paragraph</p>
|
35
|
+
<ul>
|
36
|
+
<li>some bullet lists with <strong>style</strong></li>
|
37
|
+
<li>some bullet lists with <em>style</em></li>
|
38
|
+
</ul>
|
39
|
+
<h2>Another header</h2>
|
40
|
+
<p>With some text</p>
|
41
|
+
</section>
|
42
|
+
</body>
|
43
|
+
</html>
|
@@ -0,0 +1,44 @@
|
|
1
|
+
<html>
|
2
|
+
<head>
|
3
|
+
<title>Index Page :: Common title</title>
|
4
|
+
<meta name="description" content="Description for index page"/>
|
5
|
+
</head>
|
6
|
+
<body>
|
7
|
+
<section id="menu">
|
8
|
+
<dl>
|
9
|
+
|
10
|
+
<dt>Common pages</dt>
|
11
|
+
|
12
|
+
<dd><a href="http://link.com" title="Some description of page">Some page</a></dd>
|
13
|
+
|
14
|
+
<dd><a href="http://index.com" title="Description for index page">Index Page</a></dd>
|
15
|
+
|
16
|
+
<dd><a href="http://other_link.com" title="Some description of other page">Some other page</a></dd>
|
17
|
+
|
18
|
+
<dd><a href="http://another_link.com" title="Some description of another page">Another page</a></dd>
|
19
|
+
|
20
|
+
<hr/>
|
21
|
+
|
22
|
+
<dt>Sample pages</dt>
|
23
|
+
|
24
|
+
<dd><a href="http://sample.com" title="Some description of sample page">Sample page</a></dd>
|
25
|
+
|
26
|
+
<dd><a href="http://sample_link.com" title="Some description of some sample page">Some sample page</a></dd>
|
27
|
+
|
28
|
+
|
29
|
+
|
30
|
+
</dl>
|
31
|
+
</section>
|
32
|
+
|
33
|
+
<section id="contents">
|
34
|
+
<h1>Here is some header</h1>
|
35
|
+
<p>And here is a paragraph</p>
|
36
|
+
<ul>
|
37
|
+
<li>some bullet lists with <strong>style</strong></li>
|
38
|
+
<li>some bullet lists with <em>style</em></li>
|
39
|
+
</ul>
|
40
|
+
<h2>Another header</h2>
|
41
|
+
<p>With some text</p>
|
42
|
+
</section>
|
43
|
+
</body>
|
44
|
+
</html>
|
Binary file
|
@@ -0,0 +1,26 @@
|
|
1
|
+
h1. Here is some header
|
2
|
+
|
3
|
+
And here is a paragraph
|
4
|
+
|
5
|
+
* some bullet lists with *style*
|
6
|
+
* some bullet lists with _style_
|
7
|
+
|
8
|
+
h2. Another header
|
9
|
+
|
10
|
+
With some text
|
11
|
+
|
12
|
+
h3. Another minor header
|
13
|
+
|
14
|
+
With some other text
|
15
|
+
|
16
|
+
h4. Yet another smaller header
|
17
|
+
|
18
|
+
Again some text
|
19
|
+
|
20
|
+
h3. A minor header
|
21
|
+
|
22
|
+
Something
|
23
|
+
|
24
|
+
h2. A header
|
25
|
+
|
26
|
+
With something
|
@@ -0,0 +1,26 @@
|
|
1
|
+
h1. Here is some header
|
2
|
+
|
3
|
+
And here is a paragraph
|
4
|
+
|
5
|
+
* some bullet lists with *style*
|
6
|
+
* some bullet lists with _style_
|
7
|
+
|
8
|
+
h2. Another header
|
9
|
+
|
10
|
+
With some text
|
11
|
+
|
12
|
+
h3. Another minor header
|
13
|
+
|
14
|
+
With some other text
|
15
|
+
|
16
|
+
h4. Yet another smaller header
|
17
|
+
|
18
|
+
Again some text
|
19
|
+
|
20
|
+
h3. A minor header
|
21
|
+
|
22
|
+
Something
|
23
|
+
|
24
|
+
h2. A header
|
25
|
+
|
26
|
+
With something
|
@@ -0,0 +1,22 @@
|
|
1
|
+
<html>
|
2
|
+
<head>
|
3
|
+
<title><%= metadata.title %></title>
|
4
|
+
</head>
|
5
|
+
<body>
|
6
|
+
<section id="menu">
|
7
|
+
<dl>
|
8
|
+
<% metadata.menu.each do |entry| %>
|
9
|
+
<dt><%= entry.category %></dt>
|
10
|
+
<% entry.pages.each do |page| %>
|
11
|
+
<dd><a href="<%= page.link %>" title="<%= page.description %>"><%= page.title %></a></dd>
|
12
|
+
<% end %>
|
13
|
+
<% unless metadata.menu.last == entry %><hr/><% end %>
|
14
|
+
<% end %>
|
15
|
+
</dl>
|
16
|
+
</section>
|
17
|
+
|
18
|
+
<section id="contents">
|
19
|
+
<%= markup_file.contents %>
|
20
|
+
</section>
|
21
|
+
</body>
|
22
|
+
</html>
|
@@ -0,0 +1,23 @@
|
|
1
|
+
<html>
|
2
|
+
<head>
|
3
|
+
<title><%= metadata.current_page.title %> :: <%= metadata.title %></title>
|
4
|
+
<meta name="description" content="<%= metadata.current_page.description %>"/>
|
5
|
+
</head>
|
6
|
+
<body>
|
7
|
+
<section id="menu">
|
8
|
+
<dl>
|
9
|
+
<% metadata.menu.each do |entry| %>
|
10
|
+
<dt><%= entry.category %></dt>
|
11
|
+
<% entry.pages.each do |page| %>
|
12
|
+
<dd><a href="<%= page.link %>" title="<%= page.description %>"><%= page.title %></a></dd>
|
13
|
+
<% end %>
|
14
|
+
<% unless metadata.menu.last == entry %><hr/><% end %>
|
15
|
+
<% end %>
|
16
|
+
</dl>
|
17
|
+
</section>
|
18
|
+
|
19
|
+
<section id="contents">
|
20
|
+
<%= markup_file.contents %>
|
21
|
+
</section>
|
22
|
+
</body>
|
23
|
+
</html>
|
@@ -0,0 +1,43 @@
|
|
1
|
+
title: Common title
|
2
|
+
pages:
|
3
|
+
- &index
|
4
|
+
file: index_with_specific_metadata
|
5
|
+
title: Index Page
|
6
|
+
description: Description for index page
|
7
|
+
link: http://index.com
|
8
|
+
menu:
|
9
|
+
- {
|
10
|
+
category: Common pages,
|
11
|
+
pages:
|
12
|
+
[{
|
13
|
+
title: Some page,
|
14
|
+
description: Some description of page,
|
15
|
+
link: http://link.com
|
16
|
+
},
|
17
|
+
*index,
|
18
|
+
{
|
19
|
+
title: Some other page,
|
20
|
+
description: Some description of other page,
|
21
|
+
link: http://other_link.com
|
22
|
+
},
|
23
|
+
{
|
24
|
+
title: Another page,
|
25
|
+
description: Some description of another page,
|
26
|
+
link: http://another_link.com
|
27
|
+
}]
|
28
|
+
}
|
29
|
+
- {
|
30
|
+
category: Sample pages,
|
31
|
+
pages:
|
32
|
+
[{
|
33
|
+
title: Sample page,
|
34
|
+
description: Some description of sample page,
|
35
|
+
link: http://sample.com
|
36
|
+
},
|
37
|
+
{
|
38
|
+
title: Some sample page,
|
39
|
+
description: Some description of some sample page,
|
40
|
+
link: http://sample_link.com
|
41
|
+
}]
|
42
|
+
}
|
43
|
+
|