nanoc 3.7.4 → 3.7.5

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 (284) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +19 -18
  3. data/LICENSE +1 -1
  4. data/NEWS.md +14 -0
  5. data/Rakefile +1 -1
  6. data/doc/yardoc_handlers/identifier.rb +1 -5
  7. data/lib/nanoc.rb +1 -3
  8. data/lib/nanoc/base.rb +1 -4
  9. data/lib/nanoc/base/checksummer.rb +10 -12
  10. data/lib/nanoc/base/compilation/checksum_store.rb +0 -4
  11. data/lib/nanoc/base/compilation/compiled_content_cache.rb +0 -4
  12. data/lib/nanoc/base/compilation/compiler.rb +27 -31
  13. data/lib/nanoc/base/compilation/compiler_dsl.rb +3 -7
  14. data/lib/nanoc/base/compilation/dependency_tracker.rb +2 -6
  15. data/lib/nanoc/base/compilation/filter.rb +1 -7
  16. data/lib/nanoc/base/compilation/item_rep_proxy.rb +0 -4
  17. data/lib/nanoc/base/compilation/item_rep_recorder_proxy.rb +0 -4
  18. data/lib/nanoc/base/compilation/outdatedness_checker.rb +0 -4
  19. data/lib/nanoc/base/compilation/outdatedness_reasons.rb +0 -6
  20. data/lib/nanoc/base/compilation/rule.rb +1 -5
  21. data/lib/nanoc/base/compilation/rule_context.rb +7 -11
  22. data/lib/nanoc/base/compilation/rule_memory_calculator.rb +0 -4
  23. data/lib/nanoc/base/compilation/rule_memory_store.rb +0 -4
  24. data/lib/nanoc/base/compilation/rules_collection.rb +5 -9
  25. data/lib/nanoc/base/context.rb +0 -3
  26. data/lib/nanoc/base/core_ext.rb +0 -1
  27. data/lib/nanoc/base/core_ext/array.rb +0 -2
  28. data/lib/nanoc/base/core_ext/hash.rb +0 -2
  29. data/lib/nanoc/base/core_ext/pathname.rb +0 -2
  30. data/lib/nanoc/base/core_ext/string.rb +0 -2
  31. data/lib/nanoc/base/directed_graph.rb +0 -4
  32. data/lib/nanoc/base/errors.rb +1 -39
  33. data/lib/nanoc/base/memoization.rb +0 -4
  34. data/lib/nanoc/base/notification_center.rb +1 -7
  35. data/lib/nanoc/base/plugin_registry.rb +4 -10
  36. data/lib/nanoc/base/result_data/item_rep.rb +8 -16
  37. data/lib/nanoc/base/source_data/code_snippet.rb +1 -5
  38. data/lib/nanoc/base/source_data/configuration.rb +0 -4
  39. data/lib/nanoc/base/source_data/data_source.rb +2 -5
  40. data/lib/nanoc/base/source_data/item.rb +3 -7
  41. data/lib/nanoc/base/source_data/item_array.rb +1 -5
  42. data/lib/nanoc/base/source_data/layout.rb +2 -6
  43. data/lib/nanoc/base/source_data/site.rb +20 -23
  44. data/lib/nanoc/base/store.rb +1 -5
  45. data/lib/nanoc/base/temp_filename_factory.rb +0 -4
  46. data/lib/nanoc/cli.rb +3 -5
  47. data/lib/nanoc/cli/ansi_string_colorizer.rb +6 -10
  48. data/lib/nanoc/cli/cleaning_stream.rb +2 -6
  49. data/lib/nanoc/cli/command_runner.rb +1 -5
  50. data/lib/nanoc/cli/commands/autocompile.rb +2 -6
  51. data/lib/nanoc/cli/commands/check.rb +0 -4
  52. data/lib/nanoc/cli/commands/compile.rb +12 -27
  53. data/lib/nanoc/cli/commands/create-item.rb +1 -5
  54. data/lib/nanoc/cli/commands/create-layout.rb +0 -4
  55. data/lib/nanoc/cli/commands/create-site.rb +2 -8
  56. data/lib/nanoc/cli/commands/deploy.rb +3 -7
  57. data/lib/nanoc/cli/commands/prune.rb +2 -6
  58. data/lib/nanoc/cli/commands/shell.rb +4 -8
  59. data/lib/nanoc/cli/commands/show-data.rb +3 -7
  60. data/lib/nanoc/cli/commands/show-plugins.rb +3 -7
  61. data/lib/nanoc/cli/commands/show-rules.rb +11 -15
  62. data/lib/nanoc/cli/commands/sync.rb +0 -4
  63. data/lib/nanoc/cli/commands/update.rb +1 -7
  64. data/lib/nanoc/cli/commands/validate-css.rb +0 -4
  65. data/lib/nanoc/cli/commands/validate-html.rb +0 -4
  66. data/lib/nanoc/cli/commands/validate-links.rb +0 -4
  67. data/lib/nanoc/cli/commands/view.rb +3 -7
  68. data/lib/nanoc/cli/commands/watch.rb +4 -10
  69. data/lib/nanoc/cli/error_handler.rb +9 -13
  70. data/lib/nanoc/cli/logger.rb +8 -12
  71. data/lib/nanoc/cli/stream_cleaners.rb +0 -4
  72. data/lib/nanoc/cli/stream_cleaners/abstract.rb +1 -5
  73. data/lib/nanoc/cli/stream_cleaners/ansi_colors.rb +0 -4
  74. data/lib/nanoc/cli/stream_cleaners/utf8.rb +1 -5
  75. data/lib/nanoc/data_sources.rb +2 -4
  76. data/lib/nanoc/data_sources/deprecated/delicious.rb +6 -10
  77. data/lib/nanoc/data_sources/deprecated/last_fm.rb +7 -11
  78. data/lib/nanoc/data_sources/deprecated/twitter.rb +2 -6
  79. data/lib/nanoc/data_sources/filesystem.rb +10 -13
  80. data/lib/nanoc/data_sources/filesystem_unified.rb +0 -4
  81. data/lib/nanoc/data_sources/filesystem_verbose.rb +0 -4
  82. data/lib/nanoc/data_sources/static.rb +4 -8
  83. data/lib/nanoc/extra.rb +2 -4
  84. data/lib/nanoc/extra/auto_compiler.rb +2 -6
  85. data/lib/nanoc/extra/checking.rb +0 -4
  86. data/lib/nanoc/extra/checking/check.rb +0 -4
  87. data/lib/nanoc/extra/checking/checks.rb +0 -2
  88. data/lib/nanoc/extra/checking/checks/css.rb +6 -6
  89. data/lib/nanoc/extra/checking/checks/external_links.rb +3 -11
  90. data/lib/nanoc/extra/checking/checks/html.rb +6 -6
  91. data/lib/nanoc/extra/checking/checks/internal_links.rb +3 -7
  92. data/lib/nanoc/extra/checking/checks/stale.rb +3 -7
  93. data/lib/nanoc/extra/checking/dsl.rb +0 -4
  94. data/lib/nanoc/extra/checking/issue.rb +0 -4
  95. data/lib/nanoc/extra/checking/runner.rb +4 -7
  96. data/lib/nanoc/extra/chick.rb +7 -17
  97. data/lib/nanoc/extra/core_ext.rb +0 -1
  98. data/lib/nanoc/extra/core_ext/pathname.rb +0 -4
  99. data/lib/nanoc/extra/core_ext/time.rb +0 -2
  100. data/lib/nanoc/extra/deployer.rb +0 -4
  101. data/lib/nanoc/extra/deployers.rb +0 -4
  102. data/lib/nanoc/extra/deployers/fog.rb +7 -11
  103. data/lib/nanoc/extra/deployers/rsync.rb +1 -5
  104. data/lib/nanoc/extra/file_proxy.rb +1 -5
  105. data/lib/nanoc/extra/filesystem_tools.rb +37 -12
  106. data/lib/nanoc/extra/jruby_nokogiri_warner.rb +0 -4
  107. data/lib/nanoc/extra/link_collector.rb +3 -7
  108. data/lib/nanoc/extra/piper.rb +0 -6
  109. data/lib/nanoc/extra/pruner.rb +1 -7
  110. data/lib/nanoc/extra/validators.rb +0 -4
  111. data/lib/nanoc/extra/validators/links.rb +0 -4
  112. data/lib/nanoc/extra/validators/w3c.rb +0 -4
  113. data/lib/nanoc/extra/vcs.rb +3 -7
  114. data/lib/nanoc/extra/vcses.rb +0 -2
  115. data/lib/nanoc/extra/vcses/bazaar.rb +0 -4
  116. data/lib/nanoc/extra/vcses/dummy.rb +0 -4
  117. data/lib/nanoc/extra/vcses/git.rb +0 -4
  118. data/lib/nanoc/extra/vcses/mercurial.rb +0 -4
  119. data/lib/nanoc/extra/vcses/subversion.rb +0 -4
  120. data/lib/nanoc/filters.rb +0 -2
  121. data/lib/nanoc/filters/asciidoc.rb +1 -5
  122. data/lib/nanoc/filters/bluecloth.rb +0 -2
  123. data/lib/nanoc/filters/coderay.rb +0 -2
  124. data/lib/nanoc/filters/coffeescript.rb +0 -4
  125. data/lib/nanoc/filters/colorize_syntax.rb +17 -15
  126. data/lib/nanoc/filters/erb.rb +1 -3
  127. data/lib/nanoc/filters/erubis.rb +2 -4
  128. data/lib/nanoc/filters/haml.rb +2 -4
  129. data/lib/nanoc/filters/handlebars.rb +0 -4
  130. data/lib/nanoc/filters/kramdown.rb +7 -4
  131. data/lib/nanoc/filters/less.rb +1 -3
  132. data/lib/nanoc/filters/markaby.rb +0 -2
  133. data/lib/nanoc/filters/maruku.rb +0 -2
  134. data/lib/nanoc/filters/mustache.rb +1 -5
  135. data/lib/nanoc/filters/pandoc.rb +0 -2
  136. data/lib/nanoc/filters/rainpress.rb +0 -2
  137. data/lib/nanoc/filters/rdiscount.rb +0 -2
  138. data/lib/nanoc/filters/rdoc.rb +0 -2
  139. data/lib/nanoc/filters/redcarpet.rb +0 -4
  140. data/lib/nanoc/filters/redcloth.rb +0 -2
  141. data/lib/nanoc/filters/relativize_paths.rb +2 -4
  142. data/lib/nanoc/filters/rubypants.rb +0 -2
  143. data/lib/nanoc/filters/sass.rb +2 -4
  144. data/lib/nanoc/filters/sass/sass_filesystem_importer.rb +0 -2
  145. data/lib/nanoc/filters/slim.rb +2 -6
  146. data/lib/nanoc/filters/typogruby.rb +0 -4
  147. data/lib/nanoc/filters/uglify_js.rb +0 -2
  148. data/lib/nanoc/filters/xsl.rb +1 -5
  149. data/lib/nanoc/filters/yui_compressor.rb +0 -4
  150. data/lib/nanoc/helpers.rb +0 -2
  151. data/lib/nanoc/helpers/blogging.rb +12 -20
  152. data/lib/nanoc/helpers/breadcrumbs.rb +0 -4
  153. data/lib/nanoc/helpers/capturing.rb +2 -10
  154. data/lib/nanoc/helpers/filtering.rb +0 -4
  155. data/lib/nanoc/helpers/html_escape.rb +3 -7
  156. data/lib/nanoc/helpers/link_to.rb +0 -4
  157. data/lib/nanoc/helpers/rendering.rb +8 -12
  158. data/lib/nanoc/helpers/tagging.rb +0 -4
  159. data/lib/nanoc/helpers/text.rb +1 -5
  160. data/lib/nanoc/helpers/xml_sitemap.rb +3 -7
  161. data/lib/nanoc/tasks/clean.rb +1 -7
  162. data/lib/nanoc/tasks/deploy/rsync.rake +0 -2
  163. data/lib/nanoc/tasks/validate.rake +0 -4
  164. data/lib/nanoc/version.rb +1 -3
  165. data/nanoc.gemspec +12 -9
  166. data/tasks/rubocop.rake +1 -1
  167. data/tasks/test.rake +6 -7
  168. data/test/base/checksummer_spec.rb +28 -44
  169. data/test/base/core_ext/array_spec.rb +1 -9
  170. data/test/base/core_ext/hash_spec.rb +7 -19
  171. data/test/base/core_ext/pathname_spec.rb +2 -4
  172. data/test/base/core_ext/string_spec.rb +0 -4
  173. data/test/base/temp_filename_factory_spec.rb +0 -8
  174. data/test/base/test_checksum_store.rb +0 -2
  175. data/test/base/test_code_snippet.rb +0 -2
  176. data/test/base/test_compiler.rb +15 -17
  177. data/test/base/test_compiler_dsl.rb +7 -9
  178. data/test/base/test_context.rb +2 -4
  179. data/test/base/test_data_source.rb +0 -2
  180. data/test/base/test_dependency_tracker.rb +0 -2
  181. data/test/base/test_directed_graph.rb +2 -4
  182. data/test/base/test_filter.rb +5 -7
  183. data/test/base/test_item.rb +17 -13
  184. data/test/base/test_item_array.rb +2 -4
  185. data/test/base/test_item_rep.rb +79 -73
  186. data/test/base/test_layout.rb +3 -5
  187. data/test/base/test_memoization.rb +13 -21
  188. data/test/base/test_notification_center.rb +0 -2
  189. data/test/base/test_outdatedness_checker.rb +34 -36
  190. data/test/base/test_plugin.rb +0 -2
  191. data/test/base/test_rule.rb +3 -5
  192. data/test/base/test_rule_context.rb +4 -6
  193. data/test/base/test_site.rb +9 -17
  194. data/test/base/test_store.rb +2 -6
  195. data/test/cli/commands/test_check.rb +1 -3
  196. data/test/cli/commands/test_compile.rb +24 -15
  197. data/test/cli/commands/test_create_item.rb +1 -3
  198. data/test/cli/commands/test_create_layout.rb +0 -2
  199. data/test/cli/commands/test_create_site.rb +0 -3
  200. data/test/cli/commands/test_deploy.rb +9 -11
  201. data/test/cli/commands/test_help.rb +0 -2
  202. data/test/cli/commands/test_info.rb +0 -2
  203. data/test/cli/commands/test_prune.rb +6 -8
  204. data/test/cli/commands/test_sync.rb +0 -2
  205. data/test/cli/commands/test_update.rb +0 -2
  206. data/test/cli/commands/test_watch.rb +4 -6
  207. data/test/cli/test_cleaning_stream.rb +4 -6
  208. data/test/cli/test_cli.rb +9 -5
  209. data/test/cli/test_error_handler.rb +9 -7
  210. data/test/cli/test_logger.rb +0 -2
  211. data/test/data_sources/test_filesystem.rb +8 -10
  212. data/test/data_sources/test_filesystem_unified.rb +35 -34
  213. data/test/data_sources/test_filesystem_verbose.rb +31 -33
  214. data/test/data_sources/test_static.rb +20 -21
  215. data/test/extra/checking/checks/test_css.rb +23 -2
  216. data/test/extra/checking/checks/test_external_links.rb +2 -4
  217. data/test/extra/checking/checks/test_html.rb +4 -3
  218. data/test/extra/checking/checks/test_internal_links.rb +1 -3
  219. data/test/extra/checking/checks/test_stale.rb +4 -6
  220. data/test/extra/checking/test_check.rb +0 -2
  221. data/test/extra/checking/test_dsl.rb +1 -3
  222. data/test/extra/checking/test_runner.rb +0 -2
  223. data/test/extra/core_ext/test_pathname.rb +0 -3
  224. data/test/extra/core_ext/test_time.rb +0 -2
  225. data/test/extra/deployers/test_fog.rb +13 -15
  226. data/test/extra/deployers/test_rsync.rb +4 -6
  227. data/test/extra/test_auto_compiler.rb +47 -25
  228. data/test/extra/test_file_proxy.rb +1 -3
  229. data/test/extra/test_filesystem_tools.rb +47 -7
  230. data/test/extra/test_link_collector.rb +0 -2
  231. data/test/extra/test_piper.rb +3 -5
  232. data/test/extra/test_vcs.rb +0 -2
  233. data/test/extra/validators/test_links.rb +0 -1
  234. data/test/extra/validators/test_w3c.rb +2 -4
  235. data/test/filters/test_asciidoc.rb +0 -2
  236. data/test/filters/test_bluecloth.rb +0 -2
  237. data/test/filters/test_coderay.rb +2 -4
  238. data/test/filters/test_coffeescript.rb +0 -2
  239. data/test/filters/test_colorize_syntax.rb +16 -18
  240. data/test/filters/test_erb.rb +12 -14
  241. data/test/filters/test_erubis.rb +4 -6
  242. data/test/filters/test_haml.rb +7 -9
  243. data/test/filters/test_handlebars.rb +10 -12
  244. data/test/filters/test_kramdown.rb +13 -1
  245. data/test/filters/test_less.rb +9 -11
  246. data/test/filters/test_markaby.rb +0 -2
  247. data/test/filters/test_maruku.rb +0 -2
  248. data/test/filters/test_mustache.rb +4 -6
  249. data/test/filters/test_pandoc.rb +1 -3
  250. data/test/filters/test_rainpress.rb +1 -3
  251. data/test/filters/test_rdiscount.rb +1 -3
  252. data/test/filters/test_rdoc.rb +0 -2
  253. data/test/filters/test_redcarpet.rb +6 -8
  254. data/test/filters/test_redcloth.rb +1 -3
  255. data/test/filters/test_relativize_paths.rb +29 -34
  256. data/test/filters/test_rubypants.rb +0 -2
  257. data/test/filters/test_sass.rb +8 -10
  258. data/test/filters/test_slim.rb +2 -4
  259. data/test/filters/test_typogruby.rb +0 -3
  260. data/test/filters/test_uglify_js.rb +2 -4
  261. data/test/filters/test_xsl.rb +16 -18
  262. data/test/filters/test_yui_compressor.rb +3 -5
  263. data/test/fixtures/vcr_cassettes/css_run_parse_error.yml +65 -0
  264. data/test/gem_loader.rb +1 -1
  265. data/test/helper.rb +11 -15
  266. data/test/helpers/test_blogging.rb +61 -63
  267. data/test/helpers/test_breadcrumbs.rb +0 -2
  268. data/test/helpers/test_capturing.rb +4 -6
  269. data/test/helpers/test_filtering.rb +2 -4
  270. data/test/helpers/test_html_escape.rb +0 -2
  271. data/test/helpers/test_link_to.rb +5 -6
  272. data/test/helpers/test_rendering.rb +2 -4
  273. data/test/helpers/test_tagging.rb +9 -11
  274. data/test/helpers/test_text.rb +6 -8
  275. data/test/helpers/test_xml_sitemap.rb +11 -13
  276. data/test/tasks/test_clean.rb +0 -2
  277. data/test/test_gem.rb +1 -3
  278. metadata +15 -14
  279. data/Gemfile.lock +0 -252
  280. data/lib/nanoc/base/core_ext/date.rb +0 -29
  281. data/lib/nanoc/base/ordered_hash.rb +0 -228
  282. data/lib/nanoc/extra/core_ext/enumerable.rb +0 -33
  283. data/test/base/core_ext/date_spec.rb +0 -15
  284. data/test/extra/core_ext/test_enumerable.rb +0 -28
@@ -1,7 +1,6 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  class Nanoc::DependencyTrackerTest < Nanoc::TestCase
4
-
5
4
  def test_initialize
6
5
  # Mock items
7
6
  items = [mock, mock]
@@ -256,5 +255,4 @@ class Nanoc::DependencyTrackerTest < Nanoc::TestCase
256
255
  tracker.forget_dependencies_for(items[0])
257
256
  assert_empty tracker.objects_causing_outdatedness_of(items[0])
258
257
  end
259
-
260
258
  end
@@ -1,7 +1,6 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  class Nanoc::DirectedGraphTest < Nanoc::TestCase
4
-
5
4
  def test_direct_predecessors
6
5
  graph = Nanoc::DirectedGraph.new([1, 2, 3])
7
6
  graph.add_edge(1, 2)
@@ -63,7 +62,7 @@ class Nanoc::DirectedGraphTest < Nanoc::TestCase
63
62
 
64
63
  def test_add_edge
65
64
  graph = Nanoc::DirectedGraph.new([1, 2, 3])
66
-
65
+
67
66
  assert_equal [], graph.successors_of(1)
68
67
  assert_equal [], graph.predecessors_of(2)
69
68
 
@@ -84,7 +83,7 @@ class Nanoc::DirectedGraphTest < Nanoc::TestCase
84
83
 
85
84
  def test_delete_edge
86
85
  graph = Nanoc::DirectedGraph.new([1, 2, 3])
87
- graph.add_edge(1,2)
86
+ graph.add_edge(1, 2)
88
87
 
89
88
  assert_equal [2], graph.successors_of(1)
90
89
  assert_equal [1], graph.predecessors_of(2)
@@ -285,5 +284,4 @@ class Nanoc::DirectedGraphTest < Nanoc::TestCase
285
284
  YARD.parse(LIB_DIR + '/nanoc/base/directed_graph.rb')
286
285
  assert_examples_correct 'Nanoc::DirectedGraph'
287
286
  end
288
-
289
287
  end
@@ -1,7 +1,6 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  class Nanoc::FilterTest < Nanoc::TestCase
4
-
5
4
  def test_initialize
6
5
  # Create filter
7
6
  filter = Nanoc::Filter.new
@@ -12,7 +11,7 @@ class Nanoc::FilterTest < Nanoc::TestCase
12
11
 
13
12
  def test_assigns
14
13
  # Create filter
15
- filter = Nanoc::Filter.new({ :foo => 'bar' })
14
+ filter = Nanoc::Filter.new({ foo: 'bar' })
16
15
 
17
16
  # Check assigns
18
17
  assert_equal('bar', filter.assigns[:foo])
@@ -20,7 +19,7 @@ class Nanoc::FilterTest < Nanoc::TestCase
20
19
 
21
20
  def test_assigns_with_instance_variables
22
21
  # Create filter
23
- filter = Nanoc::Filter.new({ :foo => 'bar' })
22
+ filter = Nanoc::Filter.new({ foo: 'bar' })
24
23
 
25
24
  # Check assigns
26
25
  assert_equal('bar', filter.instance_eval { @foo })
@@ -28,7 +27,7 @@ class Nanoc::FilterTest < Nanoc::TestCase
28
27
 
29
28
  def test_assigns_with_instance_methods
30
29
  # Create filter
31
- filter = Nanoc::Filter.new({ :foo => 'bar' })
30
+ filter = Nanoc::Filter.new({ foo: 'bar' })
32
31
 
33
32
  # Check assigns
34
33
  assert_equal('bar', filter.instance_eval { foo })
@@ -52,7 +51,7 @@ class Nanoc::FilterTest < Nanoc::TestCase
52
51
  item_rep.expects(:name).returns(:quux)
53
52
 
54
53
  # Create filter
55
- filter = Nanoc::Filter.new({ :item => item, :item_rep => item_rep })
54
+ filter = Nanoc::Filter.new({ item: item, item_rep: item_rep })
56
55
 
57
56
  # Check filename
58
57
  assert_equal('item /foo/bar/baz/ (rep quux)', filter.filename)
@@ -64,7 +63,7 @@ class Nanoc::FilterTest < Nanoc::TestCase
64
63
  layout.expects(:identifier).returns('/wohba/')
65
64
 
66
65
  # Create filter
67
- filter = Nanoc::Filter.new({ :item => mock, :item_rep => mock, :layout => layout })
66
+ filter = Nanoc::Filter.new({ item: mock, item_rep: mock, layout: layout })
68
67
 
69
68
  # Check filename
70
69
  assert_equal('layout /wohba/', filter.filename)
@@ -77,5 +76,4 @@ class Nanoc::FilterTest < Nanoc::TestCase
77
76
  # Check filename
78
77
  assert_equal('?', filter.filename)
79
78
  end
80
-
81
79
  end
@@ -1,7 +1,6 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  class Nanoc::ItemTest < Nanoc::TestCase
4
-
5
4
  def test_initialize_with_attributes_with_string_keys
6
5
  item = Nanoc::Item.new('foo', { 'abc' => 'xyz' }, '/foo/')
7
6
 
@@ -27,7 +26,7 @@ class Nanoc::ItemTest < Nanoc::TestCase
27
26
  # Create item
28
27
  item = Nanoc::Item.new(
29
28
  'content',
30
- { :one => 'one in item' },
29
+ { one: 'one in item' },
31
30
  '/path/'
32
31
  )
33
32
 
@@ -49,7 +48,9 @@ class Nanoc::ItemTest < Nanoc::TestCase
49
48
  def test_compiled_content_with_default_rep_and_default_snapshot
50
49
  # Mock rep
51
50
  rep = Object.new
52
- def rep.name; :default; end
51
+ def rep.name
52
+ :default
53
+ end
53
54
  def rep.compiled_content(params)
54
55
  "content at #{params[:snapshot].inspect}"
55
56
  end
@@ -65,7 +66,9 @@ class Nanoc::ItemTest < Nanoc::TestCase
65
66
  def test_compiled_content_with_custom_rep_and_default_snapshot
66
67
  # Mock reps
67
68
  rep = Object.new
68
- def rep.name; :foo; end
69
+ def rep.name
70
+ :foo
71
+ end
69
72
  def rep.compiled_content(params)
70
73
  "content at #{params[:snapshot].inspect}"
71
74
  end
@@ -75,13 +78,15 @@ class Nanoc::ItemTest < Nanoc::TestCase
75
78
  item.expects(:reps).returns([rep])
76
79
 
77
80
  # Check
78
- assert_equal 'content at nil', item.compiled_content(:rep => :foo)
81
+ assert_equal 'content at nil', item.compiled_content(rep: :foo)
79
82
  end
80
83
 
81
84
  def test_compiled_content_with_default_rep_and_custom_snapshot
82
85
  # Mock reps
83
86
  rep = Object.new
84
- def rep.name; :default; end
87
+ def rep.name
88
+ :default
89
+ end
85
90
  def rep.compiled_content(params)
86
91
  "content at #{params[:snapshot].inspect}"
87
92
  end
@@ -91,7 +96,7 @@ class Nanoc::ItemTest < Nanoc::TestCase
91
96
  item.expects(:reps).returns([rep])
92
97
 
93
98
  # Check
94
- assert_equal 'content at :blah', item.compiled_content(:snapshot => :blah)
99
+ assert_equal 'content at :blah', item.compiled_content(snapshot: :blah)
95
100
  end
96
101
 
97
102
  def test_compiled_content_with_custom_nonexistant_rep
@@ -101,7 +106,7 @@ class Nanoc::ItemTest < Nanoc::TestCase
101
106
 
102
107
  # Check
103
108
  assert_raises(Nanoc::Errors::Generic) do
104
- item.compiled_content(:rep => :lkasdhflahgwfe)
109
+ item.compiled_content(rep: :lkasdhflahgwfe)
105
110
  end
106
111
  end
107
112
 
@@ -130,11 +135,11 @@ class Nanoc::ItemTest < Nanoc::TestCase
130
135
  item.expects(:reps).returns([rep])
131
136
 
132
137
  # Check
133
- assert_equal 'the correct path', item.path(:rep => :moo)
138
+ assert_equal 'the correct path', item.path(rep: :moo)
134
139
  end
135
140
 
136
141
  def test_freeze_should_disallow_changes
137
- item = Nanoc::Item.new('foo', { :a => { :b => 123 }}, '/foo/')
142
+ item = Nanoc::Item.new('foo', { a: { b: 123 } }, '/foo/')
138
143
  item.freeze
139
144
 
140
145
  assert_raises_frozen_error do
@@ -149,14 +154,13 @@ class Nanoc::ItemTest < Nanoc::TestCase
149
154
  def test_dump_and_load
150
155
  item = Nanoc::Item.new(
151
156
  'foobar',
152
- { :a => { :b => 123 }},
157
+ { a: { b: 123 } },
153
158
  '/foo/')
154
159
 
155
160
  item = Marshal.load(Marshal.dump(item))
156
161
 
157
162
  assert_equal '/foo/', item.identifier
158
163
  assert_equal 'foobar', item.raw_content
159
- assert_equal({ :a => { :b => 123 }}, item.attributes)
164
+ assert_equal({ a: { b: 123 } }, item.attributes)
160
165
  end
161
-
162
166
  end
@@ -1,7 +1,6 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  class Nanoc::ItemArrayTest < Nanoc::TestCase
4
-
5
4
  def setup
6
5
  super
7
6
 
@@ -229,7 +228,7 @@ class Nanoc::ItemArrayTest < Nanoc::TestCase
229
228
  assert_equal 'Item 1', @items['/new/1/'].raw_content
230
229
  end
231
230
 
232
- if Array.new.respond_to?(:keep_if)
231
+ if [].respond_to?(:keep_if)
233
232
  def test_keep_if
234
233
  assert_equal @two, @items[1]
235
234
  assert_equal @two, @items['/two/']
@@ -289,7 +288,7 @@ class Nanoc::ItemArrayTest < Nanoc::TestCase
289
288
  assert_equal mona, @items['/mona/']
290
289
  end
291
290
 
292
- if Array.new.respond_to?(:select!)
291
+ if [].respond_to?(:select!)
293
292
  def test_select_bang
294
293
  assert_equal @two, @items[1]
295
294
  assert_equal @two, @items['/two/']
@@ -330,5 +329,4 @@ class Nanoc::ItemArrayTest < Nanoc::TestCase
330
329
  assert_equal @two, @items[2]
331
330
  assert_equal @two, @items['/two/']
332
331
  end
333
-
334
332
  end
@@ -1,19 +1,18 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  class Nanoc::ItemRepTest < Nanoc::TestCase
4
-
5
4
  def test_created_modified_compiled
6
- # TODO implement
5
+ # TODO: implement
7
6
  end
8
7
 
9
8
  def test_compiled_content_with_only_last_available
10
9
  # Create rep
11
10
  item = Nanoc::Item.new(
12
11
  'blah blah blah', {}, '/',
13
- :binary => false, :mtime => Time.now-500
12
+ binary: false, mtime: Time.now - 500
14
13
  )
15
14
  rep = Nanoc::ItemRep.new(item, nil)
16
- rep.instance_eval { @content = { :last => 'last content' } }
15
+ rep.instance_eval { @content = { last: 'last content' } }
17
16
  rep.expects(:compiled?).returns(true)
18
17
 
19
18
  # Check
@@ -24,10 +23,10 @@ class Nanoc::ItemRepTest < Nanoc::TestCase
24
23
  # Create rep
25
24
  item = Nanoc::Item.new(
26
25
  'blah blah blah', {}, '/',
27
- :binary => false, :mtime => Time.now-500
26
+ binary: false, mtime: Time.now - 500
28
27
  )
29
28
  rep = Nanoc::ItemRep.new(item, nil)
30
- rep.instance_eval { @content = { :pre => 'pre content', :last => 'last content' } }
29
+ rep.instance_eval { @content = { pre: 'pre content', last: 'last content' } }
31
30
  rep.expects(:compiled?).returns(true)
32
31
 
33
32
  # Check
@@ -38,28 +37,28 @@ class Nanoc::ItemRepTest < Nanoc::TestCase
38
37
  # Create rep
39
38
  item = Nanoc::Item.new(
40
39
  'blah blah blah', {}, '/',
41
- :binary => false, :mtime => Time.now-500
40
+ binary: false, mtime: Time.now - 500
42
41
  )
43
42
  rep = Nanoc::ItemRep.new(item, nil)
44
- rep.instance_eval { @content = { :pre => 'pre content', :last => 'last content' } }
43
+ rep.instance_eval { @content = { pre: 'pre content', last: 'last content' } }
45
44
  rep.expects(:compiled?).returns(true)
46
45
 
47
46
  # Check
48
- assert_equal 'last content', rep.compiled_content(:snapshot => :last)
47
+ assert_equal 'last content', rep.compiled_content(snapshot: :last)
49
48
  end
50
49
 
51
50
  def test_compiled_content_with_invalid_snapshot
52
51
  # Create rep
53
52
  item = Nanoc::Item.new(
54
53
  'blah blah blah', {}, '/',
55
- :binary => false, :mtime => Time.now-500
54
+ binary: false, mtime: Time.now - 500
56
55
  )
57
56
  rep = Nanoc::ItemRep.new(item, nil)
58
- rep.instance_eval { @content = { :pre => 'pre content', :last => 'last content' } }
57
+ rep.instance_eval { @content = { pre: 'pre content', last: 'last content' } }
59
58
 
60
59
  # Check
61
60
  assert_raises Nanoc::Errors::NoSuchSnapshot do
62
- rep.compiled_content(:snapshot => :klsjflkasdfl)
61
+ rep.compiled_content(snapshot: :klsjflkasdfl)
63
62
  end
64
63
  end
65
64
 
@@ -67,7 +66,7 @@ class Nanoc::ItemRepTest < Nanoc::TestCase
67
66
  # Create rep
68
67
  item = Nanoc::Item.new(
69
68
  'blah blah', {}, '/',
70
- :binary => false
69
+ binary: false
71
70
  )
72
71
  rep = Nanoc::ItemRep.new(item, nil)
73
72
  rep.expects(:compiled?).returns(false)
@@ -88,7 +87,7 @@ class Nanoc::ItemRepTest < Nanoc::TestCase
88
87
  # Mock item
89
88
  item = Nanoc::Item.new(
90
89
  %(<%= '<%= "blah" %' + '>' %>), {}, '/',
91
- :binary => false
90
+ binary: false
92
91
  )
93
92
 
94
93
  # Create item rep
@@ -116,7 +115,7 @@ class Nanoc::ItemRepTest < Nanoc::TestCase
116
115
  # Mock item
117
116
  item = Nanoc::Item.new(
118
117
  'blah blah', {}, '/',
119
- :binary => false
118
+ binary: false
120
119
  )
121
120
 
122
121
  # Create item rep
@@ -142,7 +141,7 @@ class Nanoc::ItemRepTest < Nanoc::TestCase
142
141
  # Mock item
143
142
  item = Nanoc::Item.new(
144
143
  %(<%= '<%= "blah" %' + '>' %>), {}, '/foobar/',
145
- :binary => false
144
+ binary: false
146
145
  )
147
146
 
148
147
  # Create item rep
@@ -170,36 +169,36 @@ class Nanoc::ItemRepTest < Nanoc::TestCase
170
169
  # Mock item
171
170
  item = Nanoc::Item.new(
172
171
  'blah blah', {}, '/',
173
- :binary => false
172
+ binary: false
174
173
  )
175
174
 
176
175
  # Create rep
177
176
  item_rep = Nanoc::ItemRep.new(item, :foo)
178
177
  item_rep.instance_eval { @content[:last] = 'Lorem ipsum, etc.' }
179
- item_rep.raw_paths = { :moo => 'foo-moo.txt' }
178
+ item_rep.raw_paths = { moo: 'foo-moo.txt' }
180
179
 
181
180
  # Test non-final
182
- refute File.file?(item_rep.raw_path(:snapshot => :moo))
183
- item_rep.snapshot(:moo, :final => false)
184
- refute File.file?(item_rep.raw_path(:snapshot => :moo))
181
+ refute File.file?(item_rep.raw_path(snapshot: :moo))
182
+ item_rep.snapshot(:moo, final: false)
183
+ refute File.file?(item_rep.raw_path(snapshot: :moo))
185
184
 
186
185
  # Test final 1
187
- item_rep.snapshot(:moo, :final => true)
188
- assert File.file?(item_rep.raw_path(:snapshot => :moo))
189
- assert_equal 'Lorem ipsum, etc.', File.read(item_rep.raw_path(:snapshot => :moo))
190
- FileUtils.rm_f(item_rep.raw_path(:snapshot => :moo))
186
+ item_rep.snapshot(:moo, final: true)
187
+ assert File.file?(item_rep.raw_path(snapshot: :moo))
188
+ assert_equal 'Lorem ipsum, etc.', File.read(item_rep.raw_path(snapshot: :moo))
189
+ FileUtils.rm_f(item_rep.raw_path(snapshot: :moo))
191
190
 
192
191
  # Test final 2
193
192
  item_rep.snapshot(:moo)
194
- assert File.file?(item_rep.raw_path(:snapshot => :moo))
195
- assert_equal 'Lorem ipsum, etc.', File.read(item_rep.raw_path(:snapshot => :moo))
193
+ assert File.file?(item_rep.raw_path(snapshot: :moo))
194
+ assert_equal 'Lorem ipsum, etc.', File.read(item_rep.raw_path(snapshot: :moo))
196
195
  end
197
196
 
198
197
  def test_write_should_not_touch_identical_textual_files
199
198
  # Mock item
200
199
  item = Nanoc::Item.new(
201
200
  'blah blah', {}, '/',
202
- :binary => false
201
+ binary: false
203
202
  )
204
203
 
205
204
  # Create rep
@@ -210,7 +209,7 @@ class Nanoc::ItemRepTest < Nanoc::TestCase
210
209
 
211
210
  # Write once
212
211
  item_rep.write
213
- a_long_time_ago = Time.now-1_000_000
212
+ a_long_time_ago = Time.now - 1_000_000
214
213
  File.utime(a_long_time_ago, a_long_time_ago, item_rep.raw_path)
215
214
 
216
215
  # Write again
@@ -223,7 +222,7 @@ class Nanoc::ItemRepTest < Nanoc::TestCase
223
222
  # Mock item
224
223
  item = Nanoc::Item.new(
225
224
  'blah blah', {}, '/',
226
- :binary => false
225
+ binary: false
227
226
  )
228
227
 
229
228
  # Create rep
@@ -243,18 +242,20 @@ class Nanoc::ItemRepTest < Nanoc::TestCase
243
242
  # Mock item
244
243
  item = Nanoc::Item.new(
245
244
  'blah blah', {}, '/',
246
- :binary => false
245
+ binary: false
247
246
  )
248
247
 
249
248
  # Create rep
250
249
  rep = Nanoc::ItemRep.new(item, :foo)
251
- def rep.assigns; {}; end
250
+ def rep.assigns
251
+ {}
252
+ end
252
253
 
253
254
  # Create fake filter
254
- def rep.filter_named(name)
255
+ def rep.filter_named(_name)
255
256
  @filter ||= Class.new(::Nanoc::Filter) do
256
- type :text => :binary
257
- def run(content, params = {})
257
+ type text: :binary
258
+ def run(content, _params = {})
258
259
  File.open(output_filename, 'w') { |io| io.write(content) }
259
260
  end
260
261
  end
@@ -271,18 +272,20 @@ class Nanoc::ItemRepTest < Nanoc::TestCase
271
272
  # Mock item
272
273
  item = Nanoc::Item.new(
273
274
  'blah blah', {}, '/',
274
- :binary => false
275
+ binary: false
275
276
  )
276
277
 
277
278
  # Create rep
278
279
  rep = Nanoc::ItemRep.new(item, :foo)
279
- def rep.assigns; {}; end
280
+ def rep.assigns
281
+ {}
282
+ end
280
283
 
281
284
  # Create fake filter
282
- def rep.filter_named(name)
285
+ def rep.filter_named(_name)
283
286
  @filter ||= Class.new(::Nanoc::Filter) do
284
287
  type :binary
285
- def run(content, params = {})
288
+ def run(content, _params = {})
286
289
  File.open(output_filename, 'w') { |io| io.write(content) }
287
290
  end
288
291
  end
@@ -296,9 +299,9 @@ class Nanoc::ItemRepTest < Nanoc::TestCase
296
299
 
297
300
  def test_using_textual_filters_on_binary_reps_raises
298
301
  item = create_binary_item
299
- site = mock_and_stub(:items => [item],
300
- :layouts => [],
301
- :config => []
302
+ site = mock_and_stub(items: [item],
303
+ layouts: [],
304
+ config: []
302
305
  )
303
306
  item.stubs(:site).returns(site)
304
307
  rep = create_rep_for(item, :foo)
@@ -334,13 +337,13 @@ class Nanoc::ItemRepTest < Nanoc::TestCase
334
337
  # Create item and item rep
335
338
  item = create_binary_item
336
339
  rep = create_rep_for(item, :foo)
337
- rep.assigns = { :content => 'meh' }
340
+ rep.assigns = { content: 'meh' }
338
341
 
339
342
  # Create filter
340
343
  Class.new(::Nanoc::Filter) do
341
- type :binary => :text
344
+ type binary: :text
342
345
  identifier :binary_to_text
343
- def run(content, params = {})
346
+ def run(content, _params = {})
344
347
  content + ' textified'
345
348
  end
346
349
  end
@@ -353,9 +356,9 @@ class Nanoc::ItemRepTest < Nanoc::TestCase
353
356
 
354
357
  def test_converted_binary_rep_can_be_filtered_with_textual_filters
355
358
  item = create_binary_item
356
- site = mock_and_stub(:items => [item],
357
- :layouts => [],
358
- :config => []
359
+ site = mock_and_stub(items: [item],
360
+ layouts: [],
361
+ config: []
359
362
  )
360
363
  item.stubs(:site).returns(site)
361
364
  rep = create_rep_for(item, :foo)
@@ -364,10 +367,10 @@ class Nanoc::ItemRepTest < Nanoc::TestCase
364
367
 
365
368
  assert rep.binary?
366
369
 
367
- def rep.filter_named(name)
370
+ def rep.filter_named(_name)
368
371
  Class.new(::Nanoc::Filter) do
369
- type :binary => :text
370
- def run(content, params = {})
372
+ type binary: :text
373
+ def run(_content, _params = {})
371
374
  'Some textual content'
372
375
  end
373
376
  end
@@ -375,10 +378,10 @@ class Nanoc::ItemRepTest < Nanoc::TestCase
375
378
  rep.filter(:binary_to_text)
376
379
  assert !rep.binary?
377
380
 
378
- def rep.filter_named(name)
381
+ def rep.filter_named(_name)
379
382
  Class.new(::Nanoc::Filter) do
380
383
  type :text
381
- def run(content, params = {})
384
+ def run(_content, _params = {})
382
385
  'Some textual content'
383
386
  end
384
387
  end
@@ -390,9 +393,9 @@ class Nanoc::ItemRepTest < Nanoc::TestCase
390
393
  def test_converted_binary_rep_cannot_be_filtered_with_binary_filters
391
394
  item = create_binary_item
392
395
  site = mock_and_stub(
393
- :items => [item],
394
- :layouts => [],
395
- :config => []
396
+ items: [item],
397
+ layouts: [],
398
+ config: []
396
399
  )
397
400
  item.stubs(:site).returns(site)
398
401
  rep = create_rep_for(item, :foo)
@@ -400,10 +403,10 @@ class Nanoc::ItemRepTest < Nanoc::TestCase
400
403
  create_binary_filter
401
404
 
402
405
  assert rep.binary?
403
- def rep.filter_named(name)
406
+ def rep.filter_named(_name)
404
407
  @filter ||= Class.new(::Nanoc::Filter) do
405
- type :binary => :text
406
- def run(content, params = {})
408
+ type binary: :text
409
+ def run(_content, _params = {})
407
410
  'Some textual content'
408
411
  end
409
412
  end
@@ -415,7 +418,7 @@ class Nanoc::ItemRepTest < Nanoc::TestCase
415
418
 
416
419
  def test_new_content_should_be_frozen
417
420
  filter_class = Class.new(::Nanoc::Filter) do
418
- def run(content, params = {})
421
+ def run(content, _params = {})
419
422
  content.gsub!('foo', 'moo')
420
423
  content
421
424
  end
@@ -424,7 +427,9 @@ class Nanoc::ItemRepTest < Nanoc::TestCase
424
427
  item = Nanoc::Item.new('foo bar', {}, '/foo/')
425
428
  rep = Nanoc::ItemRep.new(item, :default)
426
429
  rep.instance_eval { @filter_class = filter_class }
427
- def rep.filter_named(name); @filter_class; end
430
+ def rep.filter_named(_name)
431
+ @filter_class
432
+ end
428
433
 
429
434
  assert_raises_frozen_error do
430
435
  rep.filter(:whatever)
@@ -433,7 +438,7 @@ class Nanoc::ItemRepTest < Nanoc::TestCase
433
438
 
434
439
  def test_filter_should_freeze_content
435
440
  filter_class = Class.new(::Nanoc::Filter) do
436
- def run(content, params = {})
441
+ def run(content, _params = {})
437
442
  content.gsub!('foo', 'moo')
438
443
  content
439
444
  end
@@ -442,7 +447,9 @@ class Nanoc::ItemRepTest < Nanoc::TestCase
442
447
  item = Nanoc::Item.new('foo bar', {}, '/foo/')
443
448
  rep = Nanoc::ItemRep.new(item, :default)
444
449
  rep.instance_eval { @filter_class = filter_class }
445
- def rep.filter_named(name); @filter_class; end
450
+ def rep.filter_named(_name)
451
+ @filter_class
452
+ end
446
453
 
447
454
  assert_raises_frozen_error do
448
455
  rep.filter(:erb)
@@ -491,7 +498,7 @@ class Nanoc::ItemRepTest < Nanoc::TestCase
491
498
  end
492
499
 
493
500
  def test_access_compiled_content_of_binary_item
494
- item = Nanoc::Item.new('content/somefile.dat', {}, '/somefile/', :binary => true)
501
+ item = Nanoc::Item.new('content/somefile.dat', {}, '/somefile/', binary: true)
495
502
  item_rep = Nanoc::ItemRep.new(item, :foo)
496
503
  assert_raises(Nanoc::Errors::CannotGetCompiledContentOfBinaryItem) do
497
504
  item_rep.compiled_content
@@ -504,7 +511,7 @@ class Nanoc::ItemRepTest < Nanoc::TestCase
504
511
  File.open('content/meow.dat', 'w') { |io| io.write('asdf') }
505
512
  item = Nanoc::Item.new(
506
513
  'content/meow.dat', {}, '/',
507
- :binary => true
514
+ binary: true
508
515
  )
509
516
 
510
517
  # Create rep
@@ -516,7 +523,7 @@ class Nanoc::ItemRepTest < Nanoc::TestCase
516
523
 
517
524
  # Write
518
525
  notified = false
519
- Nanoc::NotificationCenter.on(:rep_written, self) do |rep, raw_path, is_created, is_modified|
526
+ Nanoc::NotificationCenter.on(:rep_written, self) do |_rep, _raw_path, is_created, is_modified|
520
527
  notified = true
521
528
  assert is_created
522
529
  assert is_modified
@@ -532,7 +539,7 @@ class Nanoc::ItemRepTest < Nanoc::TestCase
532
539
  File.open('content/meow.dat', 'w') { |io| io.write('asdf') }
533
540
  item = Nanoc::Item.new(
534
541
  'content/meow.dat', {}, '/',
535
- :binary => true
542
+ binary: true
536
543
  )
537
544
 
538
545
  # Create rep
@@ -546,7 +553,7 @@ class Nanoc::ItemRepTest < Nanoc::TestCase
546
553
 
547
554
  # Write
548
555
  notified = false
549
- Nanoc::NotificationCenter.on(:rep_written, self) do |rep, raw_path, is_created, is_modified|
556
+ Nanoc::NotificationCenter.on(:rep_written, self) do |_rep, _raw_path, is_created, is_modified|
550
557
  notified = true
551
558
  refute is_created
552
559
  assert is_modified
@@ -561,14 +568,14 @@ class Nanoc::ItemRepTest < Nanoc::TestCase
561
568
  def create_binary_item
562
569
  Nanoc::Item.new(
563
570
  '/a/file/name.dat', {}, '/',
564
- :binary => true
571
+ binary: true
565
572
  )
566
573
  end
567
574
 
568
575
  def mock_and_stub(params)
569
576
  m = mock
570
577
  params.each do |method, return_value|
571
- m.stubs(method.to_sym).returns( return_value )
578
+ m.stubs(method.to_sym).returns(return_value)
572
579
  end
573
580
  m
574
581
  end
@@ -580,7 +587,7 @@ class Nanoc::ItemRepTest < Nanoc::TestCase
580
587
  def create_textual_filter
581
588
  f = create_filter(:text)
582
589
  f.class_eval do
583
- def run(content, params = {})
590
+ def run(_content, _params = {})
584
591
  ''
585
592
  end
586
593
  end
@@ -590,7 +597,7 @@ class Nanoc::ItemRepTest < Nanoc::TestCase
590
597
  def create_binary_filter
591
598
  f = create_filter(:binary)
592
599
  f.class_eval do
593
- def run(content, params = {})
600
+ def run(content, _params = {})
594
601
  File.open(output_filename, 'w') { |io| io.write(content) }
595
602
  end
596
603
  end
@@ -603,5 +610,4 @@ class Nanoc::ItemRepTest < Nanoc::TestCase
603
610
  Nanoc::Filter.register filter_klass, "#{type}_filter".to_sym
604
611
  filter_klass
605
612
  end
606
-
607
613
  end