nanoc3 3.2.4 → 3.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (211) hide show
  1. metadata +14 -313
  2. data/.gemtest +0 -0
  3. data/ChangeLog +0 -3
  4. data/Gemfile +0 -29
  5. data/LICENSE +0 -19
  6. data/NEWS.md +0 -449
  7. data/README.md +0 -108
  8. data/Rakefile +0 -14
  9. data/bin/nanoc3 +0 -12
  10. data/doc/yardoc_templates/default/layout/html/footer.erb +0 -10
  11. data/lib/nanoc3.rb +0 -28
  12. data/lib/nanoc3/base.rb +0 -49
  13. data/lib/nanoc3/base/compilation/checksum_store.rb +0 -57
  14. data/lib/nanoc3/base/compilation/compiled_content_cache.rb +0 -62
  15. data/lib/nanoc3/base/compilation/compiler.rb +0 -455
  16. data/lib/nanoc3/base/compilation/compiler_dsl.rb +0 -214
  17. data/lib/nanoc3/base/compilation/dependency_tracker.rb +0 -196
  18. data/lib/nanoc3/base/compilation/filter.rb +0 -165
  19. data/lib/nanoc3/base/compilation/item_rep_proxy.rb +0 -102
  20. data/lib/nanoc3/base/compilation/item_rep_recorder_proxy.rb +0 -88
  21. data/lib/nanoc3/base/compilation/outdatedness_checker.rb +0 -223
  22. data/lib/nanoc3/base/compilation/outdatedness_reasons.rb +0 -46
  23. data/lib/nanoc3/base/compilation/rule.rb +0 -73
  24. data/lib/nanoc3/base/compilation/rule_context.rb +0 -84
  25. data/lib/nanoc3/base/compilation/rule_memory_calculator.rb +0 -40
  26. data/lib/nanoc3/base/compilation/rule_memory_store.rb +0 -53
  27. data/lib/nanoc3/base/compilation/rules_collection.rb +0 -231
  28. data/lib/nanoc3/base/context.rb +0 -47
  29. data/lib/nanoc3/base/core_ext.rb +0 -6
  30. data/lib/nanoc3/base/core_ext/array.rb +0 -62
  31. data/lib/nanoc3/base/core_ext/hash.rb +0 -63
  32. data/lib/nanoc3/base/core_ext/pathname.rb +0 -26
  33. data/lib/nanoc3/base/core_ext/string.rb +0 -46
  34. data/lib/nanoc3/base/directed_graph.rb +0 -275
  35. data/lib/nanoc3/base/errors.rb +0 -174
  36. data/lib/nanoc3/base/memoization.rb +0 -67
  37. data/lib/nanoc3/base/notification_center.rb +0 -84
  38. data/lib/nanoc3/base/ordered_hash.rb +0 -200
  39. data/lib/nanoc3/base/plugin_registry.rb +0 -165
  40. data/lib/nanoc3/base/result_data/item_rep.rb +0 -488
  41. data/lib/nanoc3/base/source_data/code_snippet.rb +0 -58
  42. data/lib/nanoc3/base/source_data/configuration.rb +0 -24
  43. data/lib/nanoc3/base/source_data/data_source.rb +0 -234
  44. data/lib/nanoc3/base/source_data/item.rb +0 -301
  45. data/lib/nanoc3/base/source_data/layout.rb +0 -130
  46. data/lib/nanoc3/base/source_data/site.rb +0 -361
  47. data/lib/nanoc3/base/store.rb +0 -135
  48. data/lib/nanoc3/cli.rb +0 -133
  49. data/lib/nanoc3/cli/command.rb +0 -139
  50. data/lib/nanoc3/cli/commands/autocompile.rb +0 -60
  51. data/lib/nanoc3/cli/commands/compile.rb +0 -280
  52. data/lib/nanoc3/cli/commands/create_item.rb +0 -62
  53. data/lib/nanoc3/cli/commands/create_layout.rb +0 -75
  54. data/lib/nanoc3/cli/commands/create_site.rb +0 -410
  55. data/lib/nanoc3/cli/commands/debug.rb +0 -119
  56. data/lib/nanoc3/cli/commands/info.rb +0 -98
  57. data/lib/nanoc3/cli/commands/nanoc.rb +0 -37
  58. data/lib/nanoc3/cli/commands/update.rb +0 -72
  59. data/lib/nanoc3/cli/commands/view.rb +0 -84
  60. data/lib/nanoc3/cli/commands/watch.rb +0 -125
  61. data/lib/nanoc3/cli/error_handler.rb +0 -193
  62. data/lib/nanoc3/cli/logger.rb +0 -91
  63. data/lib/nanoc3/data_sources.rb +0 -29
  64. data/lib/nanoc3/data_sources/deprecated/delicious.rb +0 -42
  65. data/lib/nanoc3/data_sources/deprecated/last_fm.rb +0 -87
  66. data/lib/nanoc3/data_sources/deprecated/twitter.rb +0 -38
  67. data/lib/nanoc3/data_sources/filesystem.rb +0 -299
  68. data/lib/nanoc3/data_sources/filesystem_unified.rb +0 -116
  69. data/lib/nanoc3/data_sources/filesystem_verbose.rb +0 -86
  70. data/lib/nanoc3/extra.rb +0 -22
  71. data/lib/nanoc3/extra/auto_compiler.rb +0 -103
  72. data/lib/nanoc3/extra/chick.rb +0 -125
  73. data/lib/nanoc3/extra/core_ext.rb +0 -4
  74. data/lib/nanoc3/extra/core_ext/enumerable.rb +0 -33
  75. data/lib/nanoc3/extra/core_ext/time.rb +0 -19
  76. data/lib/nanoc3/extra/deployers.rb +0 -11
  77. data/lib/nanoc3/extra/deployers/rsync.rb +0 -114
  78. data/lib/nanoc3/extra/file_proxy.rb +0 -40
  79. data/lib/nanoc3/extra/validators.rb +0 -12
  80. data/lib/nanoc3/extra/validators/links.rb +0 -264
  81. data/lib/nanoc3/extra/validators/w3c.rb +0 -95
  82. data/lib/nanoc3/extra/vcs.rb +0 -66
  83. data/lib/nanoc3/extra/vcses.rb +0 -17
  84. data/lib/nanoc3/extra/vcses/bazaar.rb +0 -25
  85. data/lib/nanoc3/extra/vcses/dummy.rb +0 -24
  86. data/lib/nanoc3/extra/vcses/git.rb +0 -25
  87. data/lib/nanoc3/extra/vcses/mercurial.rb +0 -25
  88. data/lib/nanoc3/extra/vcses/subversion.rb +0 -25
  89. data/lib/nanoc3/filters.rb +0 -53
  90. data/lib/nanoc3/filters/asciidoc.rb +0 -38
  91. data/lib/nanoc3/filters/bluecloth.rb +0 -19
  92. data/lib/nanoc3/filters/coderay.rb +0 -21
  93. data/lib/nanoc3/filters/colorize_syntax.rb +0 -261
  94. data/lib/nanoc3/filters/erb.rb +0 -35
  95. data/lib/nanoc3/filters/erubis.rb +0 -27
  96. data/lib/nanoc3/filters/haml.rb +0 -27
  97. data/lib/nanoc3/filters/kramdown.rb +0 -20
  98. data/lib/nanoc3/filters/less.rb +0 -53
  99. data/lib/nanoc3/filters/markaby.rb +0 -20
  100. data/lib/nanoc3/filters/maruku.rb +0 -20
  101. data/lib/nanoc3/filters/mustache.rb +0 -24
  102. data/lib/nanoc3/filters/rainpress.rb +0 -19
  103. data/lib/nanoc3/filters/rdiscount.rb +0 -22
  104. data/lib/nanoc3/filters/rdoc.rb +0 -33
  105. data/lib/nanoc3/filters/redcarpet.rb +0 -27
  106. data/lib/nanoc3/filters/redcloth.rb +0 -47
  107. data/lib/nanoc3/filters/relativize_paths.rb +0 -45
  108. data/lib/nanoc3/filters/rubypants.rb +0 -20
  109. data/lib/nanoc3/filters/sass.rb +0 -66
  110. data/lib/nanoc3/filters/slim.rb +0 -25
  111. data/lib/nanoc3/filters/typogruby.rb +0 -23
  112. data/lib/nanoc3/filters/uglify_js.rb +0 -42
  113. data/lib/nanoc3/helpers.rb +0 -16
  114. data/lib/nanoc3/helpers/blogging.rb +0 -319
  115. data/lib/nanoc3/helpers/breadcrumbs.rb +0 -40
  116. data/lib/nanoc3/helpers/capturing.rb +0 -138
  117. data/lib/nanoc3/helpers/filtering.rb +0 -50
  118. data/lib/nanoc3/helpers/html_escape.rb +0 -55
  119. data/lib/nanoc3/helpers/link_to.rb +0 -151
  120. data/lib/nanoc3/helpers/rendering.rb +0 -140
  121. data/lib/nanoc3/helpers/tagging.rb +0 -71
  122. data/lib/nanoc3/helpers/text.rb +0 -44
  123. data/lib/nanoc3/helpers/xml_sitemap.rb +0 -76
  124. data/lib/nanoc3/tasks.rb +0 -10
  125. data/lib/nanoc3/tasks/clean.rake +0 -16
  126. data/lib/nanoc3/tasks/clean.rb +0 -29
  127. data/lib/nanoc3/tasks/deploy/rsync.rake +0 -14
  128. data/lib/nanoc3/tasks/validate.rake +0 -92
  129. data/nanoc3.gemspec +0 -49
  130. data/tasks/doc.rake +0 -16
  131. data/tasks/test.rake +0 -44
  132. data/test/base/core_ext/array_spec.rb +0 -73
  133. data/test/base/core_ext/hash_spec.rb +0 -98
  134. data/test/base/core_ext/pathname_spec.rb +0 -27
  135. data/test/base/core_ext/string_spec.rb +0 -37
  136. data/test/base/test_checksum_store.rb +0 -35
  137. data/test/base/test_code_snippet.rb +0 -31
  138. data/test/base/test_compiler.rb +0 -316
  139. data/test/base/test_compiler_dsl.rb +0 -161
  140. data/test/base/test_context.rb +0 -31
  141. data/test/base/test_data_source.rb +0 -46
  142. data/test/base/test_dependency_tracker.rb +0 -262
  143. data/test/base/test_directed_graph.rb +0 -283
  144. data/test/base/test_filter.rb +0 -83
  145. data/test/base/test_item.rb +0 -179
  146. data/test/base/test_item_rep.rb +0 -553
  147. data/test/base/test_layout.rb +0 -59
  148. data/test/base/test_memoization.rb +0 -90
  149. data/test/base/test_notification_center.rb +0 -34
  150. data/test/base/test_outdatedness_checker.rb +0 -394
  151. data/test/base/test_plugin.rb +0 -30
  152. data/test/base/test_rule.rb +0 -19
  153. data/test/base/test_rule_context.rb +0 -65
  154. data/test/base/test_site.rb +0 -190
  155. data/test/cli/commands/test_compile.rb +0 -33
  156. data/test/cli/commands/test_create_item.rb +0 -14
  157. data/test/cli/commands/test_create_layout.rb +0 -28
  158. data/test/cli/commands/test_create_site.rb +0 -24
  159. data/test/cli/commands/test_help.rb +0 -12
  160. data/test/cli/commands/test_info.rb +0 -11
  161. data/test/cli/commands/test_update.rb +0 -10
  162. data/test/cli/test_cli.rb +0 -102
  163. data/test/cli/test_error_handler.rb +0 -29
  164. data/test/cli/test_logger.rb +0 -10
  165. data/test/data_sources/test_filesystem.rb +0 -433
  166. data/test/data_sources/test_filesystem_unified.rb +0 -536
  167. data/test/data_sources/test_filesystem_verbose.rb +0 -357
  168. data/test/extra/core_ext/test_enumerable.rb +0 -30
  169. data/test/extra/core_ext/test_time.rb +0 -15
  170. data/test/extra/deployers/test_rsync.rb +0 -232
  171. data/test/extra/test_auto_compiler.rb +0 -417
  172. data/test/extra/test_file_proxy.rb +0 -19
  173. data/test/extra/test_vcs.rb +0 -22
  174. data/test/extra/validators/test_links.rb +0 -51
  175. data/test/extra/validators/test_w3c.rb +0 -47
  176. data/test/filters/test_asciidoc.rb +0 -22
  177. data/test/filters/test_bluecloth.rb +0 -18
  178. data/test/filters/test_coderay.rb +0 -44
  179. data/test/filters/test_colorize_syntax.rb +0 -283
  180. data/test/filters/test_erb.rb +0 -99
  181. data/test/filters/test_erubis.rb +0 -70
  182. data/test/filters/test_haml.rb +0 -96
  183. data/test/filters/test_kramdown.rb +0 -18
  184. data/test/filters/test_less.rb +0 -113
  185. data/test/filters/test_markaby.rb +0 -24
  186. data/test/filters/test_maruku.rb +0 -18
  187. data/test/filters/test_mustache.rb +0 -25
  188. data/test/filters/test_rainpress.rb +0 -29
  189. data/test/filters/test_rdiscount.rb +0 -31
  190. data/test/filters/test_rdoc.rb +0 -18
  191. data/test/filters/test_redcarpet.rb +0 -63
  192. data/test/filters/test_redcloth.rb +0 -33
  193. data/test/filters/test_relativize_paths.rb +0 -332
  194. data/test/filters/test_rubypants.rb +0 -18
  195. data/test/filters/test_sass.rb +0 -229
  196. data/test/filters/test_slim.rb +0 -35
  197. data/test/filters/test_typogruby.rb +0 -21
  198. data/test/filters/test_uglify_js.rb +0 -30
  199. data/test/gem_loader.rb +0 -11
  200. data/test/helper.rb +0 -179
  201. data/test/helpers/test_blogging.rb +0 -754
  202. data/test/helpers/test_breadcrumbs.rb +0 -81
  203. data/test/helpers/test_capturing.rb +0 -41
  204. data/test/helpers/test_filtering.rb +0 -106
  205. data/test/helpers/test_html_escape.rb +0 -32
  206. data/test/helpers/test_link_to.rb +0 -249
  207. data/test/helpers/test_rendering.rb +0 -89
  208. data/test/helpers/test_tagging.rb +0 -87
  209. data/test/helpers/test_text.rb +0 -24
  210. data/test/helpers/test_xml_sitemap.rb +0 -103
  211. data/test/tasks/test_clean.rb +0 -67
@@ -1,89 +0,0 @@
1
- # encoding: utf-8
2
-
3
- class Nanoc3::Helpers::RenderingTest < MiniTest::Unit::TestCase
4
-
5
- include Nanoc3::TestHelpers
6
-
7
- include Nanoc3::Helpers::Rendering
8
-
9
- def test_render
10
- with_site do |site|
11
- @site = site
12
-
13
- File.open('Rules', 'w') do |io|
14
- io.write("layout '/foo/', :erb\n")
15
- end
16
-
17
- File.open('layouts/foo.xyz', 'w') do |io|
18
- io.write 'This is the <%= @layout.identifier %> layout.'
19
- end
20
-
21
- assert_equal('This is the /foo/ layout.', render('/foo/'))
22
- end
23
- end
24
-
25
- def test_render_with_unknown_layout
26
- with_site do |site|
27
- @site = site
28
-
29
- assert_raises(Nanoc3::Errors::UnknownLayout) do
30
- render '/dsfghjkl/'
31
- end
32
- end
33
- end
34
-
35
- def test_render_without_filter
36
- with_site do |site|
37
- @site = site
38
-
39
- File.open('Rules', 'w') do |io|
40
- io.write("layout '/foo/', nil\n")
41
- end
42
-
43
- File.open('layouts/foo.xyz', 'w')
44
-
45
- assert_raises(Nanoc3::Errors::CannotDetermineFilter) do
46
- render '/foo/'
47
- end
48
- end
49
- end
50
-
51
- def test_render_with_unknown_filter
52
- with_site do |site|
53
- @site = site
54
-
55
- File.open('Rules', 'w') do |io|
56
- io.write("layout '/foo/', :asdf\n")
57
- end
58
-
59
- File.open('layouts/foo.xyz', 'w')
60
-
61
- assert_raises(Nanoc3::Errors::UnknownFilter) do
62
- render '/foo/'
63
- end
64
- end
65
- end
66
-
67
- def test_render_with_block
68
- with_site do |site|
69
- @site = site
70
-
71
- File.open('Rules', 'w') do |io|
72
- io.write("layout '/foo/', :erb\n")
73
- end
74
-
75
- File.open('layouts/foo.xyz', 'w') do |io|
76
- io.write '[partial-before]<%= yield %>[partial-after]'
77
- end
78
-
79
- _erbout = '[erbout-before]'
80
- result = render '/foo/' do
81
- _erbout << "This is some extra content"
82
- end
83
-
84
- assert_equal('[erbout-before][partial-before]This is some extra content[partial-after]', _erbout)
85
- assert_equal '', result
86
- end
87
- end
88
-
89
- end
@@ -1,87 +0,0 @@
1
- # encoding: utf-8
2
-
3
- class Nanoc3::Helpers::TaggingTest < MiniTest::Unit::TestCase
4
-
5
- include Nanoc3::TestHelpers
6
-
7
- include Nanoc3::Helpers::Tagging
8
-
9
- def test_tags_for_without_tags
10
- # Create item
11
- item = Nanoc3::Item.new('content', {}, '/path/')
12
-
13
- # Check
14
- assert_equal(
15
- '(none)',
16
- tags_for(item)
17
- )
18
- end
19
-
20
- def test_tags_for_with_custom_base_url
21
- # Create item
22
- item = Nanoc3::Item.new('content', { :tags => [ 'foo', 'bar' ]}, '/path/')
23
-
24
- # Check
25
- assert_equal(
26
- "#{link_for_tag('foo', 'http://stoneship.org/tag/')}, " +
27
- "#{link_for_tag('bar', 'http://stoneship.org/tag/')}",
28
- tags_for(item, :base_url => 'http://stoneship.org/tag/')
29
- )
30
- end
31
-
32
- def test_tags_for_with_custom_none_text
33
- # Create item
34
- item = Nanoc3::Item.new('content', { :tags => [ ]}, '/path/')
35
-
36
- # Check
37
- assert_equal(
38
- 'no tags for you, fool',
39
- tags_for(item, :none_text => 'no tags for you, fool')
40
- )
41
- end
42
-
43
- def test_tags_for_with_custom_separator
44
- # Create item
45
- item = Nanoc3::Item.new('content', { :tags => [ 'foo', 'bar' ]}, '/path/')
46
-
47
- # Check
48
- assert_equal(
49
- "#{link_for_tag('foo', 'http://technorati.com/tag/')} ++ " +
50
- "#{link_for_tag('bar', 'http://technorati.com/tag/')}",
51
- tags_for(item, :separator => ' ++ ')
52
- )
53
- end
54
-
55
- def test_items_with_tag
56
- # Create items
57
- @items = [
58
- Nanoc3::Item.new('item 1', { :tags => [ :foo ] }, '/item1/'),
59
- Nanoc3::Item.new('item 2', { :tags => [ :bar ] }, '/item2/'),
60
- Nanoc3::Item.new('item 3', { :tags => [ :foo, :bar ] }, '/item3/')
61
- ]
62
-
63
- # Find items
64
- items_with_foo_tag = items_with_tag(:foo)
65
-
66
- # Check
67
- assert_equal(
68
- [ @items[0], @items[2] ],
69
- items_with_foo_tag
70
- )
71
- end
72
-
73
- def test_link_for_tag
74
- assert_equal(
75
- %[<a href="http://stoneship.org/tags/foobar" rel="tag">foobar</a>],
76
- link_for_tag('foobar', 'http://stoneship.org/tags/')
77
- )
78
- end
79
-
80
- def test_link_for_tag_escape
81
- assert_equal(
82
- %[<a href="http://stoneship.org/tags&amp;stuff/foo&amp;bar" rel="tag">foo&amp;bar</a>],
83
- link_for_tag('foo&bar', 'http://stoneship.org/tags&stuff/')
84
- )
85
- end
86
-
87
- end
@@ -1,24 +0,0 @@
1
- # encoding: utf-8
2
-
3
- class Nanoc3::Helpers::TextTest < MiniTest::Unit::TestCase
4
-
5
- include Nanoc3::TestHelpers
6
-
7
- include Nanoc3::Helpers::Text
8
-
9
- def test_excerpt_length
10
- assert_equal('...', excerptize('Foo bar baz quux meow woof', :length => 3))
11
- assert_equal('Foo ...', excerptize('Foo bar baz quux meow woof', :length => 7))
12
- assert_equal('Foo bar baz quux meow woof', excerptize('Foo bar baz quux meow woof', :length => 26))
13
- assert_equal('Foo bar baz quux meow woof', excerptize('Foo bar baz quux meow woof', :length => 8623785))
14
- end
15
-
16
- def test_excerpt_omission
17
- assert_equal('Foo [continued]', excerptize('Foo bar baz quux meow woof', :length => 15, :omission => '[continued]'))
18
- end
19
-
20
- def test_strip_html
21
- # TODO implement
22
- end
23
-
24
- end
@@ -1,103 +0,0 @@
1
- # encoding: utf-8
2
-
3
- class Nanoc3::Helpers::XMLSitemapTest < MiniTest::Unit::TestCase
4
-
5
- include Nanoc3::TestHelpers
6
-
7
- include Nanoc3::Helpers::XMLSitemap
8
-
9
- def test_xml_sitemap
10
- if_have 'builder' do
11
- # Create items
12
- @items = [ mock, mock, mock, mock ]
13
-
14
- # Create item 0
15
- @items[0].expects(:[]).with(:is_hidden).returns(false)
16
- @items[0].expects(:mtime).times(2).returns(nil)
17
- @items[0].expects(:[]).times(2).with(:changefreq).returns(nil)
18
- @items[0].expects(:[]).times(2).with(:priority).returns(nil)
19
- item_reps = [ mock, mock ]
20
- item_reps[0].expects(:path).returns('/kkk/')
21
- item_reps[0].expects(:raw_path).returns('output/kkk/index.html')
22
- item_reps[1].expects(:path).returns('/lll/')
23
- item_reps[1].expects(:raw_path).returns('output/lll/index.html')
24
- @items[0].expects(:reps).returns(item_reps)
25
-
26
- # Create item 1
27
- @items[1].expects(:[]).with(:is_hidden).returns(true)
28
-
29
- # Create item 2
30
- @items[2].expects(:[]).with(:is_hidden).returns(false)
31
- @items[2].expects(:mtime).times(4).returns(Time.parse('12/07/2004'))
32
- @items[2].expects(:[]).with(:changefreq).times(4).returns('daily')
33
- @items[2].expects(:[]).with(:priority).times(4).returns(0.5)
34
- item_reps = [ mock, mock ]
35
- item_reps[0].expects(:path).returns('/aaa/')
36
- item_reps[0].expects(:raw_path).returns('output/aaa/index.html')
37
- item_reps[1].expects(:path).returns('/bbb/')
38
- item_reps[1].expects(:raw_path).returns('output/bbb/index.html')
39
- @items[2].expects(:reps).returns(item_reps)
40
-
41
- # Create item 3
42
- @items[3].expects(:[]).with(:is_hidden).returns(false)
43
- item_rep = mock
44
- item_rep.expects(:raw_path).returns(nil)
45
- @items[3].expects(:reps).returns([ item_rep ])
46
-
47
- # Create sitemap item
48
- @item = mock
49
-
50
- # Create site
51
- config = mock
52
- config.expects(:[]).with(:base_url).at_least_once.returns('http://example.com')
53
- @site = mock
54
- @site.expects(:config).at_least_once.returns(config)
55
-
56
- # Check
57
- xml_sitemap
58
- end
59
- ensure
60
- @items = nil
61
- @item = nil
62
- @site = nil
63
- end
64
-
65
- def test_sitemap_with_items_as_param
66
- if_have 'builder' do
67
- # Create items
68
- @items = [ mock, mock, mock ]
69
-
70
- # Create item 0
71
- @items[0].expects(:[]).never
72
-
73
- # Create item 1
74
- @items[1].expects(:[]).never
75
-
76
- # Create item 2
77
- @items[2].expects(:mtime).times(2).returns(nil)
78
- @items[2].expects(:[]).times(2).with(:changefreq).returns(nil)
79
- @items[2].expects(:[]).times(2).with(:priority).returns(nil)
80
- item_reps = [ mock, mock ]
81
- item_reps[0].expects(:path).returns('/kkk/')
82
- item_reps[0].expects(:raw_path).returns('output/kkk/index.html')
83
- item_reps[1].expects(:path).returns('/lll/')
84
- item_reps[1].expects(:raw_path).returns('output/lll/index.html')
85
- @items[2].expects(:reps).returns(item_reps)
86
-
87
- # Create sitemap item
88
- @item = mock
89
-
90
- # Create site
91
- config = mock
92
- config.expects(:[]).with(:base_url).at_least_once.returns('http://example.com')
93
- @site = mock
94
- @site.expects(:config).at_least_once.returns(config)
95
-
96
- # Check
97
- xml_sitemap(
98
- :items => [@items[2]]
99
- )
100
- end
101
- end
102
-
103
- end
@@ -1,67 +0,0 @@
1
- # encoding: utf-8
2
-
3
- class Nanoc3::Tasks::CleanTest < MiniTest::Unit::TestCase
4
-
5
- include Nanoc3::TestHelpers
6
-
7
- def test_simple
8
- if_have 'w3c_validators' do
9
- # Stub items
10
- items = [ mock, mock ]
11
- reps = [ [ mock, mock ], [ mock, mock ] ]
12
- items[0].expects(:reps).returns(reps[0])
13
- items[1].expects(:reps).returns(reps[1])
14
-
15
- # Create sample files
16
- [ 0, 1 ].each do |item_id|
17
- [ 0, 1 ].each do |rep_id|
18
- filename = "item-#{item_id}-rep-#{rep_id}.txt"
19
- reps[item_id][rep_id].expects(:raw_path).returns(filename)
20
- File.open(filename, 'w') { |io| io.write('hello') }
21
- assert File.file?(filename)
22
- end
23
- end
24
-
25
- # Stub site
26
- site = mock
27
- site.expects(:items).returns(items)
28
-
29
- # Create clean task
30
- clean = ::Nanoc3::Tasks::Clean.new(site)
31
-
32
- # Run
33
- clean.run
34
-
35
- # Check
36
- [ 0, 1 ].each do |item_id|
37
- [ 0, 1 ].each do |rep_id|
38
- filename = "item-#{item_id}-rep-#{rep_id}.txt"
39
- assert !File.file?(filename)
40
- end
41
- end
42
- end
43
- end
44
-
45
- def test_with_nil_raw_path
46
- if_have 'w3c_validators' do
47
- # Stub items
48
- item = mock
49
- rep = mock
50
- item.expects(:reps).returns([ rep ])
51
-
52
- # Create sample file
53
- rep.expects(:raw_path).returns(nil)
54
-
55
- # Stub site
56
- site = mock
57
- site.expects(:items).returns([ item ])
58
-
59
- # Create clean task
60
- clean = ::Nanoc3::Tasks::Clean.new(site)
61
-
62
- # Run
63
- clean.run
64
- end
65
- end
66
-
67
- end