smartgen 0.4.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. data/ChangeLog.md +14 -0
  2. data/Gemfile.lock +2 -2
  3. data/README.md +7 -0
  4. data/lib/smartgen/configuration.rb +1 -49
  5. data/lib/smartgen/engines.rb +1 -0
  6. data/lib/smartgen/engines/base.rb +3 -3
  7. data/lib/smartgen/engines/erb.rb +15 -0
  8. data/lib/smartgen/engines/markdown.rb +1 -1
  9. data/lib/smartgen/engines/textile.rb +1 -1
  10. data/lib/smartgen/generator.rb +29 -17
  11. data/lib/smartgen/markup_file.rb +6 -2
  12. data/lib/smartgen/object_hash.rb +15 -5
  13. data/lib/smartgen/rake_task.rb +21 -5
  14. data/lib/smartgen/renderers/erb.rb +1 -4
  15. data/lib/smartgen/resource.rb +1 -9
  16. data/lib/smartgen/version.rb +1 -1
  17. data/spec/fixtures/expectations/common/another_index.html +13 -0
  18. data/spec/fixtures/expectations/common/index.html +8 -0
  19. data/spec/fixtures/expectations/common/other_index.html +13 -0
  20. data/spec/fixtures/expectations/erb/index.html +15 -0
  21. data/spec/fixtures/expectations/erb/with_layout/index.html +19 -0
  22. data/spec/fixtures/expectations/indexer/index_with_indexer.html +16 -0
  23. data/spec/fixtures/expectations/indexer/index_with_indexer_and_numbered_index.html +16 -0
  24. data/spec/fixtures/expectations/with_layout/index.html +12 -0
  25. data/spec/fixtures/expectations/with_layout/index_with_metadata.html +43 -0
  26. data/spec/fixtures/expectations/with_layout/index_with_specific_metadata.html +44 -0
  27. data/spec/fixtures/src/assets/images/image.gif +0 -0
  28. data/spec/fixtures/src/assets/javascripts/somelib.js +2 -0
  29. data/spec/fixtures/src/assets/stylesheets/style.css +2 -0
  30. data/spec/fixtures/src/common/another_index.md +12 -0
  31. data/spec/fixtures/src/common/index.textile +10 -0
  32. data/spec/fixtures/src/common/other_index.markdown +12 -0
  33. data/spec/fixtures/src/common/somefile +10 -0
  34. data/spec/fixtures/src/erb/index.html.erb +7 -0
  35. data/spec/fixtures/src/erb/with_layout/index.html.erb +7 -0
  36. data/spec/fixtures/src/erb/with_layout/layout.html.erb +5 -0
  37. data/spec/fixtures/src/indexer/index_with_indexer.textile +26 -0
  38. data/spec/fixtures/src/indexer/index_with_indexer_and_numbered_index.textile +26 -0
  39. data/spec/fixtures/src/layout.html.erb +5 -0
  40. data/spec/fixtures/src/layout_with_metadata.html.erb +22 -0
  41. data/spec/fixtures/src/layout_with_specific_metadata.html.erb +23 -0
  42. data/spec/fixtures/src/metadata.yml +43 -0
  43. data/spec/fixtures/src/with_layout/index.textile +10 -0
  44. data/spec/fixtures/src/with_layout/index_with_specific_metadata.textile +10 -0
  45. data/spec/lib/smartgen/configuration_spec.rb +5 -0
  46. data/spec/lib/smartgen/engines/base_spec.rb +73 -0
  47. data/spec/lib/smartgen/engines/erb_spec.rb +37 -0
  48. data/spec/lib/smartgen/engines/markdown_spec.rb +23 -0
  49. data/spec/lib/smartgen/engines/textile_spec.rb +19 -0
  50. data/spec/lib/smartgen/generator_spec.rb +272 -0
  51. data/spec/lib/smartgen/indexer_spec.rb +122 -0
  52. data/spec/lib/smartgen/markup_file_spec.rb +168 -0
  53. data/spec/lib/smartgen/object_hash_spec.rb +91 -0
  54. data/spec/lib/smartgen/renderers/erb_spec.rb +32 -0
  55. data/spec/lib/smartgen/resource_spec.rb +73 -0
  56. data/spec/lib/smartgen/watcher_spec.rb +71 -0
  57. data/spec/lib/smartgen_spec.rb +18 -0
  58. data/spec/sandbox/.gitkeep +0 -0
  59. data/spec/spec_helper.rb +37 -0
  60. metadata +99 -13
@@ -0,0 +1,15 @@
1
+ <h1>Aqui vai um titulo</h1>
2
+
3
+ <ul>
4
+
5
+ <li>1</li>
6
+
7
+ <li>2</li>
8
+
9
+ <li>3</li>
10
+
11
+ <li>4</li>
12
+
13
+ <li>5</li>
14
+
15
+ </ul>
@@ -0,0 +1,19 @@
1
+ <html>
2
+ <body>
3
+ <h1>Aqui vai um titulo</h1>
4
+
5
+ <ul>
6
+
7
+ <li>1</li>
8
+
9
+ <li>2</li>
10
+
11
+ <li>3</li>
12
+
13
+ <li>4</li>
14
+
15
+ <li>5</li>
16
+
17
+ </ul>
18
+ </body>
19
+ </html>
@@ -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>
@@ -0,0 +1,2 @@
1
+ // Some javascript file
2
+ var x = 0;
@@ -0,0 +1,2 @@
1
+ #some-id { color: #fff; }
2
+ .some-class { color: #000; }
@@ -0,0 +1,12 @@
1
+ Here is some header
2
+ ===================
3
+
4
+ And here is a paragraph
5
+
6
+ * some bullet lists with **style**
7
+ * some bullet lists with _style_
8
+
9
+ Another header
10
+ --------------
11
+
12
+ With some text
@@ -0,0 +1,10 @@
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
@@ -0,0 +1,12 @@
1
+ Here is some header
2
+ ===================
3
+
4
+ And here is a paragraph
5
+
6
+ * some bullet lists with **style**
7
+ * some bullet lists with _style_
8
+
9
+ Another header
10
+ --------------
11
+
12
+ With some text
@@ -0,0 +1,10 @@
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
@@ -0,0 +1,7 @@
1
+ <h1>Aqui vai um titulo</h1>
2
+
3
+ <ul>
4
+ <% 1.upto(5) do |i| %>
5
+ <li><%= i %></li>
6
+ <% end %>
7
+ </ul>
@@ -0,0 +1,7 @@
1
+ <h1>Aqui vai um titulo</h1>
2
+
3
+ <ul>
4
+ <% 1.upto(5) do |i| %>
5
+ <li><%= i %></li>
6
+ <% end %>
7
+ </ul>
@@ -0,0 +1,5 @@
1
+ <html>
2
+ <body>
3
+ <%= markup_file.contents %>
4
+ </body>
5
+ </html>
@@ -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,5 @@
1
+ <html>
2
+ <body>
3
+ <%= markup_file.contents %>
4
+ </body>
5
+ </html>
@@ -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
+
@@ -0,0 +1,10 @@
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
@@ -0,0 +1,10 @@
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