nanoc 3.2.4 → 3.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (230) hide show
  1. data/.gemtest +0 -0
  2. data/ChangeLog +3 -0
  3. data/Gemfile +32 -0
  4. data/LICENSE +19 -0
  5. data/NEWS.md +470 -0
  6. data/README.md +114 -0
  7. data/Rakefile +14 -0
  8. data/bin/nanoc +7 -27
  9. data/bin/nanoc3 +3 -0
  10. data/doc/yardoc_templates/default/layout/html/footer.erb +10 -0
  11. data/lib/nanoc.rb +41 -0
  12. data/lib/nanoc/base.rb +49 -0
  13. data/lib/nanoc/base/compilation/checksum_store.rb +57 -0
  14. data/lib/nanoc/base/compilation/compiled_content_cache.rb +62 -0
  15. data/lib/nanoc/base/compilation/compiler.rb +458 -0
  16. data/lib/nanoc/base/compilation/compiler_dsl.rb +214 -0
  17. data/lib/nanoc/base/compilation/dependency_tracker.rb +200 -0
  18. data/lib/nanoc/base/compilation/filter.rb +165 -0
  19. data/lib/nanoc/base/compilation/item_rep_proxy.rb +103 -0
  20. data/lib/nanoc/base/compilation/item_rep_recorder_proxy.rb +102 -0
  21. data/lib/nanoc/base/compilation/outdatedness_checker.rb +223 -0
  22. data/lib/nanoc/base/compilation/outdatedness_reasons.rb +46 -0
  23. data/lib/nanoc/base/compilation/rule.rb +73 -0
  24. data/lib/nanoc/base/compilation/rule_context.rb +84 -0
  25. data/lib/nanoc/base/compilation/rule_memory_calculator.rb +40 -0
  26. data/lib/nanoc/base/compilation/rule_memory_store.rb +53 -0
  27. data/lib/nanoc/base/compilation/rules_collection.rb +243 -0
  28. data/lib/nanoc/base/context.rb +47 -0
  29. data/lib/nanoc/base/core_ext.rb +6 -0
  30. data/lib/nanoc/base/core_ext/array.rb +62 -0
  31. data/lib/nanoc/base/core_ext/hash.rb +63 -0
  32. data/lib/nanoc/base/core_ext/pathname.rb +26 -0
  33. data/lib/nanoc/base/core_ext/string.rb +46 -0
  34. data/lib/nanoc/base/directed_graph.rb +275 -0
  35. data/lib/nanoc/base/errors.rb +211 -0
  36. data/lib/nanoc/base/memoization.rb +67 -0
  37. data/lib/nanoc/base/notification_center.rb +84 -0
  38. data/lib/nanoc/base/ordered_hash.rb +200 -0
  39. data/lib/nanoc/base/plugin_registry.rb +181 -0
  40. data/lib/nanoc/base/result_data/item_rep.rb +492 -0
  41. data/lib/nanoc/base/source_data/code_snippet.rb +58 -0
  42. data/lib/nanoc/base/source_data/configuration.rb +24 -0
  43. data/lib/nanoc/base/source_data/data_source.rb +234 -0
  44. data/lib/nanoc/base/source_data/item.rb +301 -0
  45. data/lib/nanoc/base/source_data/layout.rb +130 -0
  46. data/lib/nanoc/base/source_data/site.rb +361 -0
  47. data/lib/nanoc/base/store.rb +135 -0
  48. data/lib/nanoc/cli.rb +137 -0
  49. data/lib/nanoc/cli/command_runner.rb +104 -0
  50. data/lib/nanoc/cli/commands/autocompile.rb +58 -0
  51. data/lib/nanoc/cli/commands/compile.rb +297 -0
  52. data/lib/nanoc/cli/commands/create_item.rb +60 -0
  53. data/lib/nanoc/cli/commands/create_layout.rb +73 -0
  54. data/lib/nanoc/cli/commands/create_site.rb +411 -0
  55. data/lib/nanoc/cli/commands/debug.rb +117 -0
  56. data/lib/nanoc/cli/commands/deploy.rb +79 -0
  57. data/lib/nanoc/cli/commands/info.rb +98 -0
  58. data/lib/nanoc/cli/commands/nanoc.rb +38 -0
  59. data/lib/nanoc/cli/commands/prune.rb +50 -0
  60. data/lib/nanoc/cli/commands/update.rb +70 -0
  61. data/lib/nanoc/cli/commands/view.rb +82 -0
  62. data/lib/nanoc/cli/commands/watch.rb +124 -0
  63. data/lib/nanoc/cli/error_handler.rb +199 -0
  64. data/lib/nanoc/cli/logger.rb +92 -0
  65. data/lib/nanoc/data_sources.rb +29 -0
  66. data/lib/nanoc/data_sources/deprecated/delicious.rb +42 -0
  67. data/lib/nanoc/data_sources/deprecated/last_fm.rb +87 -0
  68. data/lib/nanoc/data_sources/deprecated/twitter.rb +38 -0
  69. data/lib/nanoc/data_sources/filesystem.rb +299 -0
  70. data/lib/nanoc/data_sources/filesystem_unified.rb +121 -0
  71. data/lib/nanoc/data_sources/filesystem_verbose.rb +91 -0
  72. data/lib/nanoc/extra.rb +24 -0
  73. data/lib/nanoc/extra/auto_compiler.rb +103 -0
  74. data/lib/nanoc/extra/chick.rb +125 -0
  75. data/lib/nanoc/extra/core_ext.rb +6 -0
  76. data/lib/nanoc/extra/core_ext/enumerable.rb +33 -0
  77. data/lib/nanoc/extra/core_ext/pathname.rb +30 -0
  78. data/lib/nanoc/extra/core_ext/time.rb +19 -0
  79. data/lib/nanoc/extra/deployer.rb +47 -0
  80. data/lib/nanoc/extra/deployers.rb +15 -0
  81. data/lib/nanoc/extra/deployers/fog.rb +98 -0
  82. data/lib/nanoc/extra/deployers/rsync.rb +70 -0
  83. data/lib/nanoc/extra/file_proxy.rb +40 -0
  84. data/lib/nanoc/extra/pruner.rb +86 -0
  85. data/lib/nanoc/extra/validators.rb +12 -0
  86. data/lib/nanoc/extra/validators/links.rb +268 -0
  87. data/lib/nanoc/extra/validators/w3c.rb +95 -0
  88. data/lib/nanoc/extra/vcs.rb +66 -0
  89. data/lib/nanoc/extra/vcses.rb +17 -0
  90. data/lib/nanoc/extra/vcses/bazaar.rb +25 -0
  91. data/lib/nanoc/extra/vcses/dummy.rb +24 -0
  92. data/lib/nanoc/extra/vcses/git.rb +25 -0
  93. data/lib/nanoc/extra/vcses/mercurial.rb +25 -0
  94. data/lib/nanoc/extra/vcses/subversion.rb +25 -0
  95. data/lib/nanoc/filters.rb +59 -0
  96. data/lib/nanoc/filters/asciidoc.rb +38 -0
  97. data/lib/nanoc/filters/bluecloth.rb +19 -0
  98. data/lib/nanoc/filters/coderay.rb +21 -0
  99. data/lib/nanoc/filters/coffeescript.rb +20 -0
  100. data/lib/nanoc/filters/colorize_syntax.rb +298 -0
  101. data/lib/nanoc/filters/erb.rb +38 -0
  102. data/lib/nanoc/filters/erubis.rb +34 -0
  103. data/lib/nanoc/filters/haml.rb +27 -0
  104. data/lib/nanoc/filters/kramdown.rb +20 -0
  105. data/lib/nanoc/filters/less.rb +53 -0
  106. data/lib/nanoc/filters/markaby.rb +20 -0
  107. data/lib/nanoc/filters/maruku.rb +20 -0
  108. data/lib/nanoc/filters/mustache.rb +24 -0
  109. data/lib/nanoc/filters/rainpress.rb +19 -0
  110. data/lib/nanoc/filters/rdiscount.rb +22 -0
  111. data/lib/nanoc/filters/rdoc.rb +33 -0
  112. data/lib/nanoc/filters/redcarpet.rb +62 -0
  113. data/lib/nanoc/filters/redcloth.rb +47 -0
  114. data/lib/nanoc/filters/relativize_paths.rb +94 -0
  115. data/lib/nanoc/filters/rubypants.rb +20 -0
  116. data/lib/nanoc/filters/sass.rb +74 -0
  117. data/lib/nanoc/filters/slim.rb +25 -0
  118. data/lib/nanoc/filters/typogruby.rb +23 -0
  119. data/lib/nanoc/filters/uglify_js.rb +42 -0
  120. data/lib/nanoc/filters/xsl.rb +46 -0
  121. data/lib/nanoc/filters/yui_compressor.rb +23 -0
  122. data/lib/nanoc/helpers.rb +16 -0
  123. data/lib/nanoc/helpers/blogging.rb +319 -0
  124. data/lib/nanoc/helpers/breadcrumbs.rb +40 -0
  125. data/lib/nanoc/helpers/capturing.rb +138 -0
  126. data/lib/nanoc/helpers/filtering.rb +50 -0
  127. data/lib/nanoc/helpers/html_escape.rb +55 -0
  128. data/lib/nanoc/helpers/link_to.rb +151 -0
  129. data/lib/nanoc/helpers/rendering.rb +140 -0
  130. data/lib/nanoc/helpers/tagging.rb +71 -0
  131. data/lib/nanoc/helpers/text.rb +44 -0
  132. data/lib/nanoc/helpers/xml_sitemap.rb +76 -0
  133. data/lib/nanoc/tasks.rb +10 -0
  134. data/lib/nanoc/tasks/clean.rake +16 -0
  135. data/lib/nanoc/tasks/clean.rb +29 -0
  136. data/lib/nanoc/tasks/deploy/rsync.rake +16 -0
  137. data/lib/nanoc/tasks/validate.rake +92 -0
  138. data/nanoc.gemspec +49 -0
  139. data/tasks/doc.rake +16 -0
  140. data/tasks/test.rake +46 -0
  141. data/test/base/core_ext/array_spec.rb +73 -0
  142. data/test/base/core_ext/hash_spec.rb +98 -0
  143. data/test/base/core_ext/pathname_spec.rb +27 -0
  144. data/test/base/core_ext/string_spec.rb +37 -0
  145. data/test/base/test_checksum_store.rb +35 -0
  146. data/test/base/test_code_snippet.rb +31 -0
  147. data/test/base/test_compiler.rb +403 -0
  148. data/test/base/test_compiler_dsl.rb +161 -0
  149. data/test/base/test_context.rb +31 -0
  150. data/test/base/test_data_source.rb +46 -0
  151. data/test/base/test_dependency_tracker.rb +262 -0
  152. data/test/base/test_directed_graph.rb +288 -0
  153. data/test/base/test_filter.rb +83 -0
  154. data/test/base/test_item.rb +179 -0
  155. data/test/base/test_item_rep.rb +579 -0
  156. data/test/base/test_layout.rb +59 -0
  157. data/test/base/test_memoization.rb +90 -0
  158. data/test/base/test_notification_center.rb +34 -0
  159. data/test/base/test_outdatedness_checker.rb +394 -0
  160. data/test/base/test_plugin.rb +30 -0
  161. data/test/base/test_rule.rb +19 -0
  162. data/test/base/test_rule_context.rb +65 -0
  163. data/test/base/test_site.rb +190 -0
  164. data/test/cli/commands/test_compile.rb +33 -0
  165. data/test/cli/commands/test_create_item.rb +14 -0
  166. data/test/cli/commands/test_create_layout.rb +28 -0
  167. data/test/cli/commands/test_create_site.rb +24 -0
  168. data/test/cli/commands/test_deploy.rb +74 -0
  169. data/test/cli/commands/test_help.rb +12 -0
  170. data/test/cli/commands/test_info.rb +11 -0
  171. data/test/cli/commands/test_prune.rb +98 -0
  172. data/test/cli/commands/test_update.rb +10 -0
  173. data/test/cli/test_cli.rb +102 -0
  174. data/test/cli/test_error_handler.rb +29 -0
  175. data/test/cli/test_logger.rb +10 -0
  176. data/test/data_sources/test_filesystem.rb +433 -0
  177. data/test/data_sources/test_filesystem_unified.rb +536 -0
  178. data/test/data_sources/test_filesystem_verbose.rb +357 -0
  179. data/test/extra/core_ext/test_enumerable.rb +30 -0
  180. data/test/extra/core_ext/test_pathname.rb +17 -0
  181. data/test/extra/core_ext/test_time.rb +15 -0
  182. data/test/extra/deployers/test_fog.rb +67 -0
  183. data/test/extra/deployers/test_rsync.rb +100 -0
  184. data/test/extra/test_auto_compiler.rb +417 -0
  185. data/test/extra/test_file_proxy.rb +19 -0
  186. data/test/extra/test_vcs.rb +22 -0
  187. data/test/extra/validators/test_links.rb +62 -0
  188. data/test/extra/validators/test_w3c.rb +47 -0
  189. data/test/filters/test_asciidoc.rb +22 -0
  190. data/test/filters/test_bluecloth.rb +18 -0
  191. data/test/filters/test_coderay.rb +44 -0
  192. data/test/filters/test_coffeescript.rb +18 -0
  193. data/test/filters/test_colorize_syntax.rb +379 -0
  194. data/test/filters/test_erb.rb +105 -0
  195. data/test/filters/test_erubis.rb +78 -0
  196. data/test/filters/test_haml.rb +96 -0
  197. data/test/filters/test_kramdown.rb +18 -0
  198. data/test/filters/test_less.rb +113 -0
  199. data/test/filters/test_markaby.rb +24 -0
  200. data/test/filters/test_maruku.rb +18 -0
  201. data/test/filters/test_mustache.rb +25 -0
  202. data/test/filters/test_rainpress.rb +29 -0
  203. data/test/filters/test_rdiscount.rb +31 -0
  204. data/test/filters/test_rdoc.rb +18 -0
  205. data/test/filters/test_redcarpet.rb +73 -0
  206. data/test/filters/test_redcloth.rb +33 -0
  207. data/test/filters/test_relativize_paths.rb +533 -0
  208. data/test/filters/test_rubypants.rb +18 -0
  209. data/test/filters/test_sass.rb +229 -0
  210. data/test/filters/test_slim.rb +35 -0
  211. data/test/filters/test_typogruby.rb +21 -0
  212. data/test/filters/test_uglify_js.rb +30 -0
  213. data/test/filters/test_xsl.rb +105 -0
  214. data/test/filters/test_yui_compressor.rb +44 -0
  215. data/test/gem_loader.rb +11 -0
  216. data/test/helper.rb +207 -0
  217. data/test/helpers/test_blogging.rb +754 -0
  218. data/test/helpers/test_breadcrumbs.rb +81 -0
  219. data/test/helpers/test_capturing.rb +41 -0
  220. data/test/helpers/test_filtering.rb +106 -0
  221. data/test/helpers/test_html_escape.rb +32 -0
  222. data/test/helpers/test_link_to.rb +249 -0
  223. data/test/helpers/test_rendering.rb +89 -0
  224. data/test/helpers/test_tagging.rb +87 -0
  225. data/test/helpers/test_text.rb +24 -0
  226. data/test/helpers/test_xml_sitemap.rb +103 -0
  227. data/test/tasks/test_clean.rb +67 -0
  228. metadata +327 -15
  229. data/bin/nanoc-select +0 -86
  230. data/lib/nanoc-select.rb +0 -11
@@ -0,0 +1,89 @@
1
+ # encoding: utf-8
2
+
3
+ class Nanoc::Helpers::RenderingTest < MiniTest::Unit::TestCase
4
+
5
+ include Nanoc::TestHelpers
6
+
7
+ include Nanoc::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(Nanoc::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(Nanoc::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(Nanoc::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
@@ -0,0 +1,87 @@
1
+ # encoding: utf-8
2
+
3
+ class Nanoc::Helpers::TaggingTest < MiniTest::Unit::TestCase
4
+
5
+ include Nanoc::TestHelpers
6
+
7
+ include Nanoc::Helpers::Tagging
8
+
9
+ def test_tags_for_without_tags
10
+ # Create item
11
+ item = Nanoc::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 = Nanoc::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 = Nanoc::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 = Nanoc::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
+ Nanoc::Item.new('item 1', { :tags => [ :foo ] }, '/item1/'),
59
+ Nanoc::Item.new('item 2', { :tags => [ :bar ] }, '/item2/'),
60
+ Nanoc::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
@@ -0,0 +1,24 @@
1
+ # encoding: utf-8
2
+
3
+ class Nanoc::Helpers::TextTest < MiniTest::Unit::TestCase
4
+
5
+ include Nanoc::TestHelpers
6
+
7
+ include Nanoc::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
@@ -0,0 +1,103 @@
1
+ # encoding: utf-8
2
+
3
+ class Nanoc::Helpers::XMLSitemapTest < MiniTest::Unit::TestCase
4
+
5
+ include Nanoc::TestHelpers
6
+
7
+ include Nanoc::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
@@ -0,0 +1,67 @@
1
+ # encoding: utf-8
2
+
3
+ class Nanoc::Tasks::CleanTest < MiniTest::Unit::TestCase
4
+
5
+ include Nanoc::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 = ::Nanoc::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 = ::Nanoc::Tasks::Clean.new(site)
61
+
62
+ # Run
63
+ clean.run
64
+ end
65
+ end
66
+
67
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nanoc
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.4
4
+ version: 3.3.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,35 +9,347 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-01-09 00:00:00.000000000 Z
12
+ date: 2012-02-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
- name: nanoc3
16
- requirement: &70168865822260 !ruby/object:Gem::Requirement
15
+ name: cri
16
+ requirement: &70219118237300 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
- - - ! '>='
19
+ - - ~>
20
20
  - !ruby/object:Gem::Version
21
- version: 3.2.4
21
+ version: '2.1'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70168865822260
25
- description: a web publishing system written in Ruby for building small to medium-sized
26
- websites.
24
+ version_requirements: *70219118237300
25
+ - !ruby/object:Gem::Dependency
26
+ name: minitest
27
+ requirement: &70219118236520 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :development
34
+ prerelease: false
35
+ version_requirements: *70219118236520
36
+ - !ruby/object:Gem::Dependency
37
+ name: mocha
38
+ requirement: &70219118235600 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ type: :development
45
+ prerelease: false
46
+ version_requirements: *70219118235600
47
+ - !ruby/object:Gem::Dependency
48
+ name: rake
49
+ requirement: &70219118234900 !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ type: :development
56
+ prerelease: false
57
+ version_requirements: *70219118234900
58
+ - !ruby/object:Gem::Dependency
59
+ name: rdiscount
60
+ requirement: &70219118250340 !ruby/object:Gem::Requirement
61
+ none: false
62
+ requirements:
63
+ - - ! '>='
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
66
+ type: :development
67
+ prerelease: false
68
+ version_requirements: *70219118250340
69
+ - !ruby/object:Gem::Dependency
70
+ name: yard
71
+ requirement: &70219118249240 !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ! '>='
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: *70219118249240
80
+ description: nanoc is a simple but very flexible static site generator written in
81
+ Ruby. It operates on local files, and therefore does not run on the server. nanoc
82
+ “compiles” the local source files into HTML (usually), by evaluating eRuby, Markdown,
83
+ etc.
27
84
  email: denis.defreyne@stoneship.org
28
85
  executables:
29
86
  - nanoc
30
- - nanoc-select
87
+ - nanoc3
31
88
  extensions: []
32
- extra_rdoc_files: []
89
+ extra_rdoc_files:
90
+ - ChangeLog
91
+ - LICENSE
92
+ - README.md
93
+ - NEWS.md
33
94
  files:
95
+ - ChangeLog
96
+ - Gemfile
97
+ - LICENSE
98
+ - NEWS.md
99
+ - Rakefile
100
+ - README.md
101
+ - doc/yardoc_templates/default/layout/html/footer.erb
34
102
  - bin/nanoc
35
- - bin/nanoc-select
36
- - lib/nanoc-select.rb
103
+ - bin/nanoc3
104
+ - lib/nanoc/base/compilation/checksum_store.rb
105
+ - lib/nanoc/base/compilation/compiled_content_cache.rb
106
+ - lib/nanoc/base/compilation/compiler.rb
107
+ - lib/nanoc/base/compilation/compiler_dsl.rb
108
+ - lib/nanoc/base/compilation/dependency_tracker.rb
109
+ - lib/nanoc/base/compilation/filter.rb
110
+ - lib/nanoc/base/compilation/item_rep_proxy.rb
111
+ - lib/nanoc/base/compilation/item_rep_recorder_proxy.rb
112
+ - lib/nanoc/base/compilation/outdatedness_checker.rb
113
+ - lib/nanoc/base/compilation/outdatedness_reasons.rb
114
+ - lib/nanoc/base/compilation/rule.rb
115
+ - lib/nanoc/base/compilation/rule_context.rb
116
+ - lib/nanoc/base/compilation/rule_memory_calculator.rb
117
+ - lib/nanoc/base/compilation/rule_memory_store.rb
118
+ - lib/nanoc/base/compilation/rules_collection.rb
119
+ - lib/nanoc/base/context.rb
120
+ - lib/nanoc/base/core_ext/array.rb
121
+ - lib/nanoc/base/core_ext/hash.rb
122
+ - lib/nanoc/base/core_ext/pathname.rb
123
+ - lib/nanoc/base/core_ext/string.rb
124
+ - lib/nanoc/base/core_ext.rb
125
+ - lib/nanoc/base/directed_graph.rb
126
+ - lib/nanoc/base/errors.rb
127
+ - lib/nanoc/base/memoization.rb
128
+ - lib/nanoc/base/notification_center.rb
129
+ - lib/nanoc/base/ordered_hash.rb
130
+ - lib/nanoc/base/plugin_registry.rb
131
+ - lib/nanoc/base/result_data/item_rep.rb
132
+ - lib/nanoc/base/source_data/code_snippet.rb
133
+ - lib/nanoc/base/source_data/configuration.rb
134
+ - lib/nanoc/base/source_data/data_source.rb
135
+ - lib/nanoc/base/source_data/item.rb
136
+ - lib/nanoc/base/source_data/layout.rb
137
+ - lib/nanoc/base/source_data/site.rb
138
+ - lib/nanoc/base/store.rb
139
+ - lib/nanoc/base.rb
140
+ - lib/nanoc/cli/command_runner.rb
141
+ - lib/nanoc/cli/commands/autocompile.rb
142
+ - lib/nanoc/cli/commands/compile.rb
143
+ - lib/nanoc/cli/commands/create_item.rb
144
+ - lib/nanoc/cli/commands/create_layout.rb
145
+ - lib/nanoc/cli/commands/create_site.rb
146
+ - lib/nanoc/cli/commands/debug.rb
147
+ - lib/nanoc/cli/commands/deploy.rb
148
+ - lib/nanoc/cli/commands/info.rb
149
+ - lib/nanoc/cli/commands/nanoc.rb
150
+ - lib/nanoc/cli/commands/prune.rb
151
+ - lib/nanoc/cli/commands/update.rb
152
+ - lib/nanoc/cli/commands/view.rb
153
+ - lib/nanoc/cli/commands/watch.rb
154
+ - lib/nanoc/cli/error_handler.rb
155
+ - lib/nanoc/cli/logger.rb
156
+ - lib/nanoc/cli.rb
157
+ - lib/nanoc/data_sources/deprecated/delicious.rb
158
+ - lib/nanoc/data_sources/deprecated/last_fm.rb
159
+ - lib/nanoc/data_sources/deprecated/twitter.rb
160
+ - lib/nanoc/data_sources/filesystem.rb
161
+ - lib/nanoc/data_sources/filesystem_unified.rb
162
+ - lib/nanoc/data_sources/filesystem_verbose.rb
163
+ - lib/nanoc/data_sources.rb
164
+ - lib/nanoc/extra/auto_compiler.rb
165
+ - lib/nanoc/extra/chick.rb
166
+ - lib/nanoc/extra/core_ext/enumerable.rb
167
+ - lib/nanoc/extra/core_ext/pathname.rb
168
+ - lib/nanoc/extra/core_ext/time.rb
169
+ - lib/nanoc/extra/core_ext.rb
170
+ - lib/nanoc/extra/deployer.rb
171
+ - lib/nanoc/extra/deployers/fog.rb
172
+ - lib/nanoc/extra/deployers/rsync.rb
173
+ - lib/nanoc/extra/deployers.rb
174
+ - lib/nanoc/extra/file_proxy.rb
175
+ - lib/nanoc/extra/pruner.rb
176
+ - lib/nanoc/extra/validators/links.rb
177
+ - lib/nanoc/extra/validators/w3c.rb
178
+ - lib/nanoc/extra/validators.rb
179
+ - lib/nanoc/extra/vcs.rb
180
+ - lib/nanoc/extra/vcses/bazaar.rb
181
+ - lib/nanoc/extra/vcses/dummy.rb
182
+ - lib/nanoc/extra/vcses/git.rb
183
+ - lib/nanoc/extra/vcses/mercurial.rb
184
+ - lib/nanoc/extra/vcses/subversion.rb
185
+ - lib/nanoc/extra/vcses.rb
186
+ - lib/nanoc/extra.rb
187
+ - lib/nanoc/filters/asciidoc.rb
188
+ - lib/nanoc/filters/bluecloth.rb
189
+ - lib/nanoc/filters/coderay.rb
190
+ - lib/nanoc/filters/coffeescript.rb
191
+ - lib/nanoc/filters/colorize_syntax.rb
192
+ - lib/nanoc/filters/erb.rb
193
+ - lib/nanoc/filters/erubis.rb
194
+ - lib/nanoc/filters/haml.rb
195
+ - lib/nanoc/filters/kramdown.rb
196
+ - lib/nanoc/filters/less.rb
197
+ - lib/nanoc/filters/markaby.rb
198
+ - lib/nanoc/filters/maruku.rb
199
+ - lib/nanoc/filters/mustache.rb
200
+ - lib/nanoc/filters/rainpress.rb
201
+ - lib/nanoc/filters/rdiscount.rb
202
+ - lib/nanoc/filters/rdoc.rb
203
+ - lib/nanoc/filters/redcarpet.rb
204
+ - lib/nanoc/filters/redcloth.rb
205
+ - lib/nanoc/filters/relativize_paths.rb
206
+ - lib/nanoc/filters/rubypants.rb
207
+ - lib/nanoc/filters/sass.rb
208
+ - lib/nanoc/filters/slim.rb
209
+ - lib/nanoc/filters/typogruby.rb
210
+ - lib/nanoc/filters/uglify_js.rb
211
+ - lib/nanoc/filters/xsl.rb
212
+ - lib/nanoc/filters/yui_compressor.rb
213
+ - lib/nanoc/filters.rb
214
+ - lib/nanoc/helpers/blogging.rb
215
+ - lib/nanoc/helpers/breadcrumbs.rb
216
+ - lib/nanoc/helpers/capturing.rb
217
+ - lib/nanoc/helpers/filtering.rb
218
+ - lib/nanoc/helpers/html_escape.rb
219
+ - lib/nanoc/helpers/link_to.rb
220
+ - lib/nanoc/helpers/rendering.rb
221
+ - lib/nanoc/helpers/tagging.rb
222
+ - lib/nanoc/helpers/text.rb
223
+ - lib/nanoc/helpers/xml_sitemap.rb
224
+ - lib/nanoc/helpers.rb
225
+ - lib/nanoc/tasks/clean.rake
226
+ - lib/nanoc/tasks/clean.rb
227
+ - lib/nanoc/tasks/deploy/rsync.rake
228
+ - lib/nanoc/tasks/validate.rake
229
+ - lib/nanoc/tasks.rb
230
+ - lib/nanoc.rb
231
+ - tasks/doc.rake
232
+ - tasks/test.rake
233
+ - test/base/core_ext/array_spec.rb
234
+ - test/base/core_ext/hash_spec.rb
235
+ - test/base/core_ext/pathname_spec.rb
236
+ - test/base/core_ext/string_spec.rb
237
+ - test/base/test_checksum_store.rb
238
+ - test/base/test_code_snippet.rb
239
+ - test/base/test_compiler.rb
240
+ - test/base/test_compiler_dsl.rb
241
+ - test/base/test_context.rb
242
+ - test/base/test_data_source.rb
243
+ - test/base/test_dependency_tracker.rb
244
+ - test/base/test_directed_graph.rb
245
+ - test/base/test_filter.rb
246
+ - test/base/test_item.rb
247
+ - test/base/test_item_rep.rb
248
+ - test/base/test_layout.rb
249
+ - test/base/test_memoization.rb
250
+ - test/base/test_notification_center.rb
251
+ - test/base/test_outdatedness_checker.rb
252
+ - test/base/test_plugin.rb
253
+ - test/base/test_rule.rb
254
+ - test/base/test_rule_context.rb
255
+ - test/base/test_site.rb
256
+ - test/cli/commands/test_compile.rb
257
+ - test/cli/commands/test_create_item.rb
258
+ - test/cli/commands/test_create_layout.rb
259
+ - test/cli/commands/test_create_site.rb
260
+ - test/cli/commands/test_deploy.rb
261
+ - test/cli/commands/test_help.rb
262
+ - test/cli/commands/test_info.rb
263
+ - test/cli/commands/test_prune.rb
264
+ - test/cli/commands/test_update.rb
265
+ - test/cli/test_cli.rb
266
+ - test/cli/test_error_handler.rb
267
+ - test/cli/test_logger.rb
268
+ - test/data_sources/test_filesystem.rb
269
+ - test/data_sources/test_filesystem_unified.rb
270
+ - test/data_sources/test_filesystem_verbose.rb
271
+ - test/extra/core_ext/test_enumerable.rb
272
+ - test/extra/core_ext/test_pathname.rb
273
+ - test/extra/core_ext/test_time.rb
274
+ - test/extra/deployers/test_fog.rb
275
+ - test/extra/deployers/test_rsync.rb
276
+ - test/extra/test_auto_compiler.rb
277
+ - test/extra/test_file_proxy.rb
278
+ - test/extra/test_vcs.rb
279
+ - test/extra/validators/test_links.rb
280
+ - test/extra/validators/test_w3c.rb
281
+ - test/filters/test_asciidoc.rb
282
+ - test/filters/test_bluecloth.rb
283
+ - test/filters/test_coderay.rb
284
+ - test/filters/test_coffeescript.rb
285
+ - test/filters/test_colorize_syntax.rb
286
+ - test/filters/test_erb.rb
287
+ - test/filters/test_erubis.rb
288
+ - test/filters/test_haml.rb
289
+ - test/filters/test_kramdown.rb
290
+ - test/filters/test_less.rb
291
+ - test/filters/test_markaby.rb
292
+ - test/filters/test_maruku.rb
293
+ - test/filters/test_mustache.rb
294
+ - test/filters/test_rainpress.rb
295
+ - test/filters/test_rdiscount.rb
296
+ - test/filters/test_rdoc.rb
297
+ - test/filters/test_redcarpet.rb
298
+ - test/filters/test_redcloth.rb
299
+ - test/filters/test_relativize_paths.rb
300
+ - test/filters/test_rubypants.rb
301
+ - test/filters/test_sass.rb
302
+ - test/filters/test_slim.rb
303
+ - test/filters/test_typogruby.rb
304
+ - test/filters/test_uglify_js.rb
305
+ - test/filters/test_xsl.rb
306
+ - test/filters/test_yui_compressor.rb
307
+ - test/gem_loader.rb
308
+ - test/helper.rb
309
+ - test/helpers/test_blogging.rb
310
+ - test/helpers/test_breadcrumbs.rb
311
+ - test/helpers/test_capturing.rb
312
+ - test/helpers/test_filtering.rb
313
+ - test/helpers/test_html_escape.rb
314
+ - test/helpers/test_link_to.rb
315
+ - test/helpers/test_rendering.rb
316
+ - test/helpers/test_tagging.rb
317
+ - test/helpers/test_text.rb
318
+ - test/helpers/test_xml_sitemap.rb
319
+ - test/tasks/test_clean.rb
320
+ - nanoc.gemspec
321
+ - .gemtest
37
322
  homepage: http://nanoc.stoneship.org/
38
323
  licenses: []
39
- post_install_message:
40
- rdoc_options: []
324
+ post_install_message: ! '------------------------------------------------------------------------------
325
+
326
+ Thanks for installing nanoc 3.3! Here are some resources to help you get
327
+
328
+ started:
329
+
330
+
331
+ * The web site at <http://nanoc.stoneship.org/>
332
+
333
+ * The tutorial at <http://nanoc.stoneship.org/docs/3-getting-started/>
334
+
335
+ * The manual at <http://nanoc.stoneship.org/docs/4-basic-concepts/>
336
+
337
+
338
+ If you have questions, issues or simply want to share ideas, join the
339
+
340
+ discussion at <http://groups.google.com/group/nanoc> or stop by in the IRC
341
+
342
+ channel on irc.freenode.net, channel #nanoc. See you there!
343
+
344
+
345
+ Enjoy!
346
+
347
+ ------------------------------------------------------------------------------
348
+
349
+ '
350
+ rdoc_options:
351
+ - --main
352
+ - README.md
41
353
  require_paths:
42
354
  - lib
43
355
  required_ruby_version: !ruby/object:Gem::Requirement