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,11 +1,10 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  class Nanoc::LayoutTest < Nanoc::TestCase
4
-
5
4
  def test_initialize
6
5
  # Make sure attributes are cleaned
7
6
  layout = Nanoc::Layout.new('content', { 'foo' => 'bar' }, '/foo/')
8
- assert_equal({ :foo => 'bar' }, layout.attributes)
7
+ assert_equal({ foo: 'bar' }, layout.attributes)
9
8
 
10
9
  # Make sure identifier is cleaned
11
10
  layout = Nanoc::Layout.new('content', { 'foo' => 'bar' }, 'foo')
@@ -39,14 +38,13 @@ class Nanoc::LayoutTest < Nanoc::TestCase
39
38
  def test_dump_and_load
40
39
  layout = Nanoc::Layout.new(
41
40
  'foobar',
42
- { :a => { :b => 123 }},
41
+ { a: { b: 123 } },
43
42
  '/foo/')
44
43
 
45
44
  layout = Marshal.load(Marshal.dump(layout))
46
45
 
47
46
  assert_equal '/foo/', layout.identifier
48
47
  assert_equal 'foobar', layout.raw_content
49
- assert_equal({ :a => { :b => 123 }}, layout.attributes)
48
+ assert_equal({ a: { b: 123 } }, layout.attributes)
50
49
  end
51
-
52
50
  end
@@ -1,9 +1,7 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  class Nanoc::MemoizationTest < Nanoc::TestCase
4
-
5
4
  class Sample1
6
-
7
5
  extend Nanoc::Memoization
8
6
 
9
7
  def initialize(value)
@@ -11,14 +9,12 @@ class Nanoc::MemoizationTest < Nanoc::TestCase
11
9
  end
12
10
 
13
11
  def run(n)
14
- @value*10 + n
12
+ @value * 10 + n
15
13
  end
16
14
  memoize :run
17
-
18
15
  end
19
16
 
20
17
  class Sample2
21
-
22
18
  extend Nanoc::Memoization
23
19
 
24
20
  def initialize(value)
@@ -26,14 +22,12 @@ class Nanoc::MemoizationTest < Nanoc::TestCase
26
22
  end
27
23
 
28
24
  def run(n)
29
- @value*100 + n
25
+ @value * 100 + n
30
26
  end
31
27
  memoize :run
32
-
33
28
  end
34
29
 
35
30
  class EqualSample
36
-
37
31
  extend Nanoc::Memoization
38
32
 
39
33
  def initialize(value)
@@ -44,19 +38,18 @@ class Nanoc::MemoizationTest < Nanoc::TestCase
44
38
  4
45
39
  end
46
40
 
47
- def eql?(other)
41
+ def eql?(_other)
48
42
  true
49
43
  end
50
44
 
51
- def ==(other)
45
+ def ==(_other)
52
46
  true
53
47
  end
54
48
 
55
49
  def run(n)
56
- @value*10 + n
50
+ @value * 10 + n
57
51
  end
58
52
  memoize :run
59
-
60
53
  end
61
54
 
62
55
  def test
@@ -66,10 +59,10 @@ class Nanoc::MemoizationTest < Nanoc::TestCase
66
59
  sample2b = Sample2.new(25)
67
60
 
68
61
  3.times do
69
- assert_equal 10*10+5, sample1a.run(5)
70
- assert_equal 10*15+7, sample1b.run(7)
71
- assert_equal 100*20+5, sample2a.run(5)
72
- assert_equal 100*25+7, sample2b.run(7)
62
+ assert_equal 10 * 10 + 5, sample1a.run(5)
63
+ assert_equal 10 * 15 + 7, sample1b.run(7)
64
+ assert_equal 100 * 20 + 5, sample2a.run(5)
65
+ assert_equal 100 * 25 + 7, sample2b.run(7)
73
66
  end
74
67
  end
75
68
 
@@ -78,11 +71,10 @@ class Nanoc::MemoizationTest < Nanoc::TestCase
78
71
  sample2 = EqualSample.new(3)
79
72
 
80
73
  3.times do
81
- assert_equal 2*10+5, sample1.run(5)
82
- assert_equal 2*10+3, sample1.run(3)
83
- assert_equal 3*10+5, sample2.run(5)
84
- assert_equal 3*10+3, sample2.run(3)
74
+ assert_equal 2 * 10 + 5, sample1.run(5)
75
+ assert_equal 2 * 10 + 3, sample1.run(3)
76
+ assert_equal 3 * 10 + 5, sample2.run(5)
77
+ assert_equal 3 * 10 + 3, sample2.run(3)
85
78
  end
86
79
  end
87
-
88
80
  end
@@ -1,7 +1,6 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  class Nanoc::NotificationCenterTest < Nanoc::TestCase
4
-
5
4
  def test_post
6
5
  # Set up notification
7
6
  Nanoc::NotificationCenter.on :ping_received, :test do
@@ -28,5 +27,4 @@ class Nanoc::NotificationCenterTest < Nanoc::TestCase
28
27
  Nanoc::NotificationCenter.post :ping_received
29
28
  assert(!@ping_received)
30
29
  end
31
-
32
30
  end
@@ -1,10 +1,9 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  class Nanoc::OutdatednessCheckerTest < Nanoc::TestCase
4
-
5
4
  def test_not_outdated
6
5
  # Compile once
7
- with_site(:name => 'foo') do |site|
6
+ with_site(name: 'foo') do |site|
8
7
  File.open('content/index.html', 'w') { |io| io.write('o hello') }
9
8
  File.open('lib/stuff.rb', 'w') { |io| io.write('$foo = 123') }
10
9
 
@@ -12,7 +11,7 @@ class Nanoc::OutdatednessCheckerTest < Nanoc::TestCase
12
11
  end
13
12
 
14
13
  # Check
15
- with_site(:name => 'foo') do |site|
14
+ with_site(name: 'foo') do |site|
16
15
  outdatedness_checker = site.compiler.send :outdatedness_checker
17
16
  rep = site.items[0].reps[0]
18
17
  assert_nil outdatedness_checker.outdatedness_reason_for(rep)
@@ -21,7 +20,7 @@ class Nanoc::OutdatednessCheckerTest < Nanoc::TestCase
21
20
 
22
21
  def test_outdated_if_item_checksum_nil
23
22
  # Compile once
24
- with_site(:name => 'foo') do |site|
23
+ with_site(name: 'foo') do |site|
25
24
  File.open('content/index.html', 'w') { |io| io.write('o hello') }
26
25
  File.open('lib/stuff.rb', 'w') { |io| io.write('$foo = 123') }
27
26
 
@@ -29,12 +28,12 @@ class Nanoc::OutdatednessCheckerTest < Nanoc::TestCase
29
28
  end
30
29
 
31
30
  # Delete checksums
32
- with_site(:name => 'foo') do |site|
31
+ with_site(name: 'foo') do |_site|
33
32
  FileUtils.rm('tmp/checksums')
34
33
  end
35
34
 
36
35
  # Check
37
- with_site(:name => 'foo') do |site|
36
+ with_site(name: 'foo') do |site|
38
37
  outdatedness_checker = site.compiler.send :outdatedness_checker
39
38
  rep = site.items.find { |i| i.identifier == '/' }.reps[0]
40
39
  assert_equal ::Nanoc::OutdatednessReasons::NotEnoughData,
@@ -44,7 +43,7 @@ class Nanoc::OutdatednessCheckerTest < Nanoc::TestCase
44
43
 
45
44
  def test_outdated_if_compiled_file_doesnt_exist
46
45
  # Compile once
47
- with_site(:name => 'foo') do |site|
46
+ with_site(name: 'foo') do |site|
48
47
  File.open('content/index.html', 'w') { |io| io.write('o hello') }
49
48
  File.open('lib/stuff.rb', 'w') { |io| io.write('$foo = 123') }
50
49
 
@@ -57,7 +56,7 @@ class Nanoc::OutdatednessCheckerTest < Nanoc::TestCase
57
56
  end
58
57
 
59
58
  # Check
60
- with_site(:name => 'foo') do |site|
59
+ with_site(name: 'foo') do |site|
61
60
  outdatedness_checker = site.compiler.send :outdatedness_checker
62
61
  rep = site.items.find { |i| i.identifier == '/' }.reps[0]
63
62
  assert_equal ::Nanoc::OutdatednessReasons::NotWritten,
@@ -67,7 +66,7 @@ class Nanoc::OutdatednessCheckerTest < Nanoc::TestCase
67
66
 
68
67
  def test_outdated_if_item_checksum_is_different
69
68
  # Compile once
70
- with_site(:name => 'foo') do |site|
69
+ with_site(name: 'foo') do |site|
71
70
  File.open('content/index.html', 'w') { |io| io.write('o hello') }
72
71
  File.open('content/new.html', 'w') { |io| io.write('o hello too') }
73
72
  File.open('lib/stuff.rb', 'w') { |io| io.write('$foo = 123') }
@@ -81,7 +80,7 @@ class Nanoc::OutdatednessCheckerTest < Nanoc::TestCase
81
80
  end
82
81
 
83
82
  # Check
84
- with_site(:name => 'foo') do |site|
83
+ with_site(name: 'foo') do |site|
85
84
  outdatedness_checker = site.compiler.send :outdatedness_checker
86
85
  rep = site.items.find { |i| i.identifier == '/new/' }.reps[0]
87
86
  assert_equal ::Nanoc::OutdatednessReasons::SourceModified,
@@ -91,7 +90,7 @@ class Nanoc::OutdatednessCheckerTest < Nanoc::TestCase
91
90
 
92
91
  def test_outdated_if_dependent_layout_outdated
93
92
  # Compile once
94
- with_site(:name => 'foo', :compilation_rule_content => 'layout "/default/"', :has_layout => true) do |site|
93
+ with_site(name: 'foo', compilation_rule_content: 'layout "/default/"', has_layout: true) do |site|
95
94
  File.open('content/index.html', 'w') { |io| io.write('o hello') }
96
95
  File.open('layouts/default.html', 'w') { |io| io.write('!!! <%= yield %> !!!') }
97
96
 
@@ -104,8 +103,8 @@ class Nanoc::OutdatednessCheckerTest < Nanoc::TestCase
104
103
  end
105
104
 
106
105
  # Check
107
- with_site(:name => 'foo') do |site|
108
- # FIXME ugly fugly hack
106
+ with_site(name: 'foo') do |site|
107
+ # FIXME: ugly fugly hack
109
108
  site.compiler.load
110
109
 
111
110
  outdatedness_checker = site.compiler.send :outdatedness_checker
@@ -117,7 +116,7 @@ class Nanoc::OutdatednessCheckerTest < Nanoc::TestCase
117
116
 
118
117
  def test_outdated_if_dependent_item_outdated
119
118
  # Compile once
120
- with_site(:name => 'foo', :compilation_rule_content => 'filter :erb') do |site|
119
+ with_site(name: 'foo', compilation_rule_content: 'filter :erb') do |site|
121
120
  File.open('content/a.html', 'w') do |io|
122
121
  io.write('<%= @items.find { |i| i.identifier == "/b/" }.compiled_content %>')
123
122
  end
@@ -136,8 +135,8 @@ class Nanoc::OutdatednessCheckerTest < Nanoc::TestCase
136
135
  end
137
136
 
138
137
  # Check
139
- with_site(:name => 'foo') do |site|
140
- # FIXME ugly fugly hack
138
+ with_site(name: 'foo') do |site|
139
+ # FIXME: ugly fugly hack
141
140
  site.compiler.load
142
141
 
143
142
  outdatedness_checker = site.compiler.send :outdatedness_checker
@@ -149,7 +148,7 @@ class Nanoc::OutdatednessCheckerTest < Nanoc::TestCase
149
148
 
150
149
  def test_outdated_if_dependent_item_outdated_chained
151
150
  # Compile once
152
- with_site(:name => 'foo', :compilation_rule_content => 'filter :erb') do |site|
151
+ with_site(name: 'foo', compilation_rule_content: 'filter :erb') do |site|
153
152
  File.open('content/a.html', 'w') do |io|
154
153
  io.write('<%= @items.find { |i| i.identifier == "/b/" }.compiled_content %> aaa')
155
154
  end
@@ -171,8 +170,8 @@ class Nanoc::OutdatednessCheckerTest < Nanoc::TestCase
171
170
  end
172
171
 
173
172
  # Check
174
- with_site(:name => 'foo') do |site|
175
- # FIXME ugly fugly hack
173
+ with_site(name: 'foo') do |site|
174
+ # FIXME: ugly fugly hack
176
175
  site.compiler.load
177
176
 
178
177
  outdatedness_checker = site.compiler.send :outdatedness_checker
@@ -184,7 +183,7 @@ class Nanoc::OutdatednessCheckerTest < Nanoc::TestCase
184
183
 
185
184
  def test_outdated_if_dependent_item_removed
186
185
  # Compile once
187
- with_site(:name => 'foo', :compilation_rule_content => 'filter :erb') do |site|
186
+ with_site(name: 'foo', compilation_rule_content: 'filter :erb') do |site|
188
187
  File.open('content/a.html', 'w') do |io|
189
188
  io.write('<% @items.select { |i| i.identifier != @item.identifier }.each do |i| %>')
190
189
  io.write(' <%= i.compiled_content %>')
@@ -203,8 +202,8 @@ class Nanoc::OutdatednessCheckerTest < Nanoc::TestCase
203
202
  end
204
203
 
205
204
  # Check
206
- with_site(:name => 'foo') do |site|
207
- # FIXME ugly fugly hack
205
+ with_site(name: 'foo') do |site|
206
+ # FIXME: ugly fugly hack
208
207
  site.compiler.load
209
208
 
210
209
  outdatedness_checker = site.compiler.send :outdatedness_checker
@@ -216,7 +215,7 @@ class Nanoc::OutdatednessCheckerTest < Nanoc::TestCase
216
215
 
217
216
  def test_outdated_if_dependent_item_added
218
217
  # Compile once
219
- with_site(:name => 'foo', :compilation_rule_content => 'filter :erb') do |site|
218
+ with_site(name: 'foo', compilation_rule_content: 'filter :erb') do |site|
220
219
  File.open('content/a.html', 'w') do |io|
221
220
  io.write('<% @items.select { |i| i.identifier != @item.identifier }.each do |i| %>')
222
221
  io.write(' <%= i.compiled_content %>')
@@ -237,8 +236,8 @@ class Nanoc::OutdatednessCheckerTest < Nanoc::TestCase
237
236
  end
238
237
 
239
238
  # Check
240
- with_site(:name => 'foo') do |site|
241
- # FIXME ugly fugly hack
239
+ with_site(name: 'foo') do |site|
240
+ # FIXME: ugly fugly hack
242
241
  site.compiler.load
243
242
 
244
243
  outdatedness_checker = site.compiler.send :outdatedness_checker
@@ -248,11 +247,11 @@ class Nanoc::OutdatednessCheckerTest < Nanoc::TestCase
248
247
  end
249
248
  end
250
249
 
251
- # TODO make sure outdatedness of non-outdated items is correct
250
+ # TODO: make sure outdatedness of non-outdated items is correct
252
251
 
253
252
  def test_outdated_if_code_snippets_outdated
254
253
  # Compile once
255
- with_site(:name => 'foo') do |site|
254
+ with_site(name: 'foo') do |site|
256
255
  File.open('content/index.html', 'w') { |io| io.write('o hello') }
257
256
 
258
257
  site.compile
@@ -264,7 +263,7 @@ class Nanoc::OutdatednessCheckerTest < Nanoc::TestCase
264
263
  end
265
264
 
266
265
  # Check
267
- with_site(:name => 'foo') do |site|
266
+ with_site(name: 'foo') do |site|
268
267
  outdatedness_checker = site.compiler.send :outdatedness_checker
269
268
  rep = site.items.find { |i| i.identifier == '/' }.reps[0]
270
269
  assert_equal ::Nanoc::OutdatednessReasons::CodeSnippetsModified,
@@ -274,7 +273,7 @@ class Nanoc::OutdatednessCheckerTest < Nanoc::TestCase
274
273
 
275
274
  def test_outdated_if_config_outdated
276
275
  # Compile once
277
- with_site(:name => 'foo') do |site|
276
+ with_site(name: 'foo') do |site|
278
277
  File.open('content/index.html', 'w') { |io| io.write('o hello') }
279
278
 
280
279
  site.compile
@@ -286,7 +285,7 @@ class Nanoc::OutdatednessCheckerTest < Nanoc::TestCase
286
285
  end
287
286
 
288
287
  # Check
289
- with_site(:name => 'foo') do |site|
288
+ with_site(name: 'foo') do |site|
290
289
  outdatedness_checker = site.compiler.send :outdatedness_checker
291
290
  rep = site.items.find { |i| i.identifier == '/' }.reps[0]
292
291
  assert_equal ::Nanoc::OutdatednessReasons::ConfigurationModified,
@@ -296,7 +295,7 @@ class Nanoc::OutdatednessCheckerTest < Nanoc::TestCase
296
295
 
297
296
  def test_not_outdated_if_irrelevant_rule_modified
298
297
  # Compile once
299
- with_site(:name => 'foo') do |site|
298
+ with_site(name: 'foo') do |site|
300
299
  File.open('content/index.html', 'w') { |io| io.write('o hello') }
301
300
 
302
301
  site.compile
@@ -308,7 +307,7 @@ class Nanoc::OutdatednessCheckerTest < Nanoc::TestCase
308
307
  end
309
308
 
310
309
  # Check
311
- with_site(:name => 'foo') do |site|
310
+ with_site(name: 'foo') do |site|
312
311
  outdatedness_checker = site.compiler.send :outdatedness_checker
313
312
  rep = site.items.find { |i| i.identifier == '/' }.reps[0]
314
313
  assert_nil outdatedness_checker.outdatedness_reason_for(rep)
@@ -317,7 +316,7 @@ class Nanoc::OutdatednessCheckerTest < Nanoc::TestCase
317
316
 
318
317
  def test_outdated_if_relevant_rule_modified
319
318
  # Create site
320
- with_site(:name => 'foo') do |site|
319
+ with_site(name: 'foo') do |_site|
321
320
  File.open('content/index.html', 'w') { |io| io.write('o hello') }
322
321
  File.open('Rules', 'w') do |io|
323
322
  io.write("compile '/' do\n")
@@ -360,7 +359,7 @@ class Nanoc::OutdatednessCheckerTest < Nanoc::TestCase
360
359
 
361
360
  def test_items_in_rules_should_not_cause_outdatedness
362
361
  # Create site
363
- with_site(:name => 'foo') do |site|
362
+ with_site(name: 'foo') do |_site|
364
363
  File.open('content/index.html', 'w') { |io| io.write('o hello') }
365
364
  File.open('Rules', 'w') do |io|
366
365
  io.write("compile '/' do\n")
@@ -391,7 +390,7 @@ class Nanoc::OutdatednessCheckerTest < Nanoc::TestCase
391
390
 
392
391
  def test_non_serializable_parameters_in_rules_should_be_allowed
393
392
  # Create site
394
- with_site(:name => 'foo') do |site|
393
+ with_site(name: 'foo') do |_site|
395
394
  File.open('content/index.html', 'w') { |io| io.write('o hello') }
396
395
  File.open('Rules', 'w') do |io|
397
396
  io.write("compile '/' do\n")
@@ -421,5 +420,4 @@ class Nanoc::OutdatednessCheckerTest < Nanoc::TestCase
421
420
  end
422
421
  end
423
422
  end
424
-
425
423
  end
@@ -1,7 +1,6 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  class Nanoc::PluginTest < Nanoc::TestCase
4
-
5
4
  class SampleFilter < Nanoc::Filter
6
5
  identifier :_plugin_test_sample_filter
7
6
  end
@@ -24,5 +23,4 @@ class Nanoc::PluginTest < Nanoc::TestCase
24
23
 
25
24
  refute_nil filter
26
25
  end
27
-
28
26
  end
@@ -1,17 +1,15 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  class Nanoc::RuleTest < Nanoc::TestCase
4
-
5
4
  def test_initialize
6
- # TODO implement
5
+ # TODO: implement
7
6
  end
8
7
 
9
8
  def test_applicable_to
10
- # TODO implement
9
+ # TODO: implement
11
10
  end
12
11
 
13
12
  def test_apply_to
14
- # TODO implement
13
+ # TODO: implement
15
14
  end
16
-
17
15
  end
@@ -1,7 +1,6 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  class Nanoc::RuleContextTest < Nanoc::TestCase
4
-
5
4
  def test_objects
6
5
  # Mock everything
7
6
  config = mock
@@ -18,7 +17,7 @@ class Nanoc::RuleContextTest < Nanoc::TestCase
18
17
  compiler = Nanoc::Compiler.new(site)
19
18
 
20
19
  # Create context
21
- @rule_context = Nanoc::RuleContext.new(:rep => rep, :compiler => compiler)
20
+ @rule_context = Nanoc::RuleContext.new(rep: rep, compiler: compiler)
22
21
 
23
22
  # Check
24
23
  assert_equal rep, @rule_context.rep
@@ -44,7 +43,7 @@ class Nanoc::RuleContextTest < Nanoc::TestCase
44
43
  # Mock rep
45
44
  rep = mock
46
45
  rep.stubs(:item).returns(item)
47
- rep.expects(:filter).with(:foo, { :bar => 'baz' })
46
+ rep.expects(:filter).with(:foo, { bar: 'baz' })
48
47
  rep.expects(:layout).with('foo')
49
48
  rep.expects(:snapshot).with('awesome')
50
49
 
@@ -52,12 +51,11 @@ class Nanoc::RuleContextTest < Nanoc::TestCase
52
51
  compiler = Nanoc::Compiler.new(site)
53
52
 
54
53
  # Create context
55
- @rule_context = Nanoc::RuleContext.new(:rep => rep, :compiler => compiler)
54
+ @rule_context = Nanoc::RuleContext.new(rep: rep, compiler: compiler)
56
55
 
57
56
  # Check
58
- rep.filter :foo, :bar => 'baz'
57
+ rep.filter :foo, bar: 'baz'
59
58
  rep.layout 'foo'
60
59
  rep.snapshot 'awesome'
61
60
  end
62
-
63
61
  end