nanoc 3.7.4 → 3.7.5

Sign up to get free protection for your applications and to get access to all the features.
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::SiteTest < Nanoc::TestCase
4
-
5
4
  def test_initialize_with_dir_without_config_yaml
6
5
  assert_raises(Nanoc::Errors::GenericTrivial) do
7
6
  Nanoc::Site.new('.')
@@ -21,12 +20,12 @@ class Nanoc::SiteTest < Nanoc::TestCase
21
20
  end
22
21
 
23
22
  def test_initialize_with_config_hash
24
- site = Nanoc::Site.new(:foo => 'bar')
23
+ site = Nanoc::Site.new(foo: 'bar')
25
24
  assert_equal 'bar', site.config[:foo]
26
25
  end
27
26
 
28
27
  def test_initialize_with_incomplete_data_source_config
29
- site = Nanoc::Site.new(:data_sources => [{ :type => 'foo', :items_root => '/bar/' }])
28
+ site = Nanoc::Site.new(data_sources: [{ type: 'foo', items_root: '/bar/' }])
30
29
  assert_equal('foo', site.config[:data_sources][0][:type])
31
30
  assert_equal('/bar/', site.config[:data_sources][0][:items_root])
32
31
  assert_equal('/', site.config[:data_sources][0][:layouts_root])
@@ -74,7 +73,7 @@ EOF
74
73
  end
75
74
 
76
75
  error = assert_raises(Nanoc::Errors::GenericTrivial) do
77
- site = Nanoc::Site.new('.')
76
+ Nanoc::Site.new('.')
78
77
  end
79
78
  assert_equal(
80
79
  "Could not find parent configuration file 'foo/foo.yaml'",
@@ -98,7 +97,7 @@ EOF
98
97
  end
99
98
 
100
99
  error = assert_raises(Nanoc::Errors::GenericTrivial) do
101
- site = Nanoc::Site.new('.')
100
+ Nanoc::Site.new('.')
102
101
  end
103
102
  assert_equal(
104
103
  "Cycle detected. Could not use parent configuration file '../nanoc.yaml'",
@@ -213,15 +212,13 @@ EOF
213
212
  end
214
213
  end
215
214
  end
216
-
217
215
  end
218
216
 
219
217
  describe 'Nanoc::Site#initialize' do
220
-
221
218
  include Nanoc::TestHelpers
222
219
 
223
220
  it 'should merge default config' do
224
- site = Nanoc::Site.new(:foo => 'bar')
221
+ site = Nanoc::Site.new(foo: 'bar')
225
222
  site.config[:foo].must_equal 'bar'
226
223
  site.config[:output_dir].must_equal 'output'
227
224
  end
@@ -231,30 +228,26 @@ describe 'Nanoc::Site#initialize' do
231
228
  end
232
229
 
233
230
  it 'should not raise for non-existant output directory' do
234
- Nanoc::Site.new(:output_dir => 'fklsdhailfdjalghlkasdflhagjskajdf')
231
+ Nanoc::Site.new(output_dir: 'fklsdhailfdjalghlkasdflhagjskajdf')
235
232
  end
236
233
 
237
234
  it 'should not raise for unknown data sources' do
238
235
  proc do
239
- Nanoc::Site.new(:data_source => 'fklsdhailfdjalghlkasdflhagjskajdf')
236
+ Nanoc::Site.new(data_source: 'fklsdhailfdjalghlkasdflhagjskajdf')
240
237
  end
241
238
  end
242
-
243
239
  end
244
240
 
245
241
  describe 'Nanoc::Site#compiler' do
246
-
247
242
  include Nanoc::TestHelpers
248
243
 
249
244
  it 'should not raise under normal circumstances' do
250
245
  site = Nanoc::Site.new({})
251
246
  site.compiler
252
247
  end
253
-
254
248
  end
255
249
 
256
250
  describe 'Nanoc::Site#data_sources' do
257
-
258
251
  include Nanoc::TestHelpers
259
252
 
260
253
  it 'should not raise for known data sources' do
@@ -265,8 +258,8 @@ describe 'Nanoc::Site#data_sources' do
265
258
  it 'should raise for unknown data sources' do
266
259
  proc do
267
260
  site = Nanoc::Site.new(
268
- :data_sources => [
269
- { :type => 'fklsdhailfdjalghlkasdflhagjskajdf' }
261
+ data_sources: [
262
+ { type: 'fklsdhailfdjalghlkasdflhagjskajdf' }
270
263
  ]
271
264
  )
272
265
  site.data_sources
@@ -291,5 +284,4 @@ describe 'Nanoc::Site#data_sources' do
291
284
  assert data_sources.first.config[:bbb] = 'two'
292
285
  end
293
286
  end
294
-
295
287
  end
@@ -1,9 +1,7 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  class Nanoc::StoreTest < Nanoc::TestCase
4
-
5
4
  class TestStore < Nanoc::Store
6
-
7
5
  def data
8
6
  @data
9
7
  end
@@ -11,7 +9,6 @@ class Nanoc::StoreTest < Nanoc::TestCase
11
9
  def data=(new_data)
12
10
  @data = new_data
13
11
  end
14
-
15
12
  end
16
13
 
17
14
  def test_delete_and_reload_on_error
@@ -19,13 +16,13 @@ class Nanoc::StoreTest < Nanoc::TestCase
19
16
 
20
17
  # Create
21
18
  store.load
22
- store.data = { :fun => 'sure' }
19
+ store.data = { fun: 'sure' }
23
20
  store.store
24
21
 
25
22
  # Test stored values
26
23
  store = TestStore.new('test.db', 1)
27
24
  store.load
28
- assert_equal({ :fun => 'sure' }, store.data)
25
+ assert_equal({ fun: 'sure' }, store.data)
29
26
 
30
27
  # Mess up
31
28
  File.open('test.db', 'w') do |io|
@@ -37,5 +34,4 @@ class Nanoc::StoreTest < Nanoc::TestCase
37
34
  store.load
38
35
  assert_equal(nil, store.data)
39
36
  end
40
-
41
37
  end
@@ -1,9 +1,8 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  class Nanoc::CLI::Commands::CheckTest < Nanoc::TestCase
4
-
5
4
  def test_check_stale
6
- with_site do |site|
5
+ with_site do |_site|
7
6
  FileUtils.mkdir_p('output')
8
7
 
9
8
  # Should not raise now
@@ -16,5 +15,4 @@ class Nanoc::CLI::Commands::CheckTest < Nanoc::TestCase
16
15
  end
17
16
  end
18
17
  end
19
-
20
18
  end
@@ -1,9 +1,8 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  class Nanoc::CLI::Commands::CompileTest < Nanoc::TestCase
4
-
5
4
  def test_profiling_information
6
- with_site do |site|
5
+ with_site do |_site|
7
6
  Nanoc::CLI.run %w( create_item foo )
8
7
  Nanoc::CLI.run %w( create_item bar )
9
8
  Nanoc::CLI.run %w( create_item baz )
@@ -29,7 +28,7 @@ class Nanoc::CLI::Commands::CompileTest < Nanoc::TestCase
29
28
  end
30
29
 
31
30
  def test_auto_prune
32
- with_site do |site|
31
+ with_site do |_site|
33
32
  Nanoc::CLI.run %w( create_item foo )
34
33
  Nanoc::CLI.run %w( create_item bar )
35
34
  Nanoc::CLI.run %w( create_item baz )
@@ -70,7 +69,7 @@ class Nanoc::CLI::Commands::CompileTest < Nanoc::TestCase
70
69
  end
71
70
 
72
71
  def test_auto_prune_with_exclude
73
- with_site do |site|
72
+ with_site do |_site|
74
73
  Nanoc::CLI.run %w( create_item foo )
75
74
  Nanoc::CLI.run %w( create_item bar )
76
75
  Nanoc::CLI.run %w( create_item baz )
@@ -118,10 +117,21 @@ class Nanoc::CLI::Commands::CompileTest < Nanoc::TestCase
118
117
  def test_setup_and_teardown_listeners
119
118
  with_site do
120
119
  test_listener_class = Class.new(::Nanoc::CLI::Commands::Compile::Listener) do
121
- def start; @started = true; end
122
- def stop; @stopped = true; end
123
- def started?; @started; end
124
- def stopped?; @stopped; end
120
+ def start
121
+ @started = true
122
+ end
123
+
124
+ def stop
125
+ @stopped = true
126
+ end
127
+
128
+ def started?
129
+ @started
130
+ end
131
+
132
+ def stopped?
133
+ @stopped
134
+ end
125
135
  end
126
136
 
127
137
  options = {}
@@ -129,7 +139,7 @@ class Nanoc::CLI::Commands::CompileTest < Nanoc::TestCase
129
139
  cmd = nil
130
140
  listener_classes = [test_listener_class]
131
141
  cmd_runner = Nanoc::CLI::Commands::Compile.new(
132
- options, arguments, cmd, :listener_classes => listener_classes)
142
+ options, arguments, cmd, listener_classes: listener_classes)
133
143
 
134
144
  cmd_runner.run
135
145
 
@@ -183,15 +193,15 @@ class Nanoc::CLI::Commands::CompileTest < Nanoc::TestCase
183
193
  end
184
194
 
185
195
  def new_file_action_printer(reps)
186
- listener = Nanoc::CLI::Commands::Compile::FileActionPrinter.new(:reps => reps)
196
+ listener = Nanoc::CLI::Commands::Compile::FileActionPrinter.new(reps: reps)
187
197
 
188
198
  def listener.log(level, action, path, duration)
189
199
  @events ||= []
190
200
  @events << {
191
- :level => level,
192
- :action => action,
193
- :path => path,
194
- :duration => duration
201
+ level: level,
202
+ action: action,
203
+ path: path,
204
+ duration: duration
195
205
  }
196
206
  end
197
207
 
@@ -201,5 +211,4 @@ class Nanoc::CLI::Commands::CompileTest < Nanoc::TestCase
201
211
 
202
212
  listener
203
213
  end
204
-
205
214
  end
@@ -1,12 +1,10 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  class Nanoc::CLI::Commands::CreateItemTest < Nanoc::TestCase
4
-
5
4
  def test_run
6
- with_site do |site|
5
+ with_site do |_site|
7
6
  Nanoc::CLI.run %w( create_item /blah/ )
8
7
  assert File.file?('content/blah.html')
9
8
  end
10
9
  end
11
-
12
10
  end
@@ -1,7 +1,6 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  class Nanoc::CLI::Commands::CreateLayoutTest < Nanoc::TestCase
4
-
5
4
  def test_can_compile_new_layout
6
5
  require 'nanoc/cli'
7
6
 
@@ -22,5 +21,4 @@ class Nanoc::CLI::Commands::CreateLayoutTest < Nanoc::TestCase
22
21
  site.compile
23
22
  end
24
23
  end
25
-
26
24
  end
@@ -1,7 +1,6 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  class Nanoc::CLI::Commands::CreateSiteTest < Nanoc::TestCase
4
-
5
4
  def test_create_site_with_existing_name
6
5
  Nanoc::CLI.run %w( create_site foo )
7
6
  assert_raises(::Nanoc::Errors::GenericTrivial) do
@@ -31,7 +30,6 @@ class Nanoc::CLI::Commands::CreateSiteTest < Nanoc::TestCase
31
30
  Nanoc::CLI.run %w( create_site foo )
32
31
 
33
32
  FileUtils.cd('foo') do
34
-
35
33
  # Try with encoding = default encoding = utf-8
36
34
  File.open('content/index.html', 'w') { |io| io.write("Hello <\xD6>!\n") }
37
35
  site = Nanoc::Site.new('.')
@@ -59,5 +57,4 @@ class Nanoc::CLI::Commands::CreateSiteTest < Nanoc::TestCase
59
57
  assert_match(/\/stylesheet.css/, File.read('output/index.html'))
60
58
  end
61
59
  end
62
-
63
60
  end
@@ -1,10 +1,9 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  class Nanoc::CLI::Commands::DeployTest < Nanoc::TestCase
4
-
5
4
  def test_deploy
6
5
  skip_unless_have_command 'rsync'
7
- with_site do |site|
6
+ with_site do |_site|
8
7
  File.open('nanoc.yaml', 'w') do |io|
9
8
  io.write "deploy:\n"
10
9
  io.write " public:\n"
@@ -23,7 +22,7 @@ class Nanoc::CLI::Commands::DeployTest < Nanoc::TestCase
23
22
  end
24
23
 
25
24
  def test_deploy_with_dry_run
26
- with_site do |site|
25
+ with_site do |_site|
27
26
  File.open('nanoc.yaml', 'w') do |io|
28
27
  io.write "deploy:\n"
29
28
  io.write " public:\n"
@@ -42,7 +41,7 @@ class Nanoc::CLI::Commands::DeployTest < Nanoc::TestCase
42
41
  end
43
42
 
44
43
  def test_deploy_with_list_without_config
45
- with_site do |site|
44
+ with_site do |_site|
46
45
  FileUtils.mkdir_p('output')
47
46
  File.open('output/blah.html', 'w') { |io| io.write 'moo' }
48
47
 
@@ -58,7 +57,7 @@ class Nanoc::CLI::Commands::DeployTest < Nanoc::TestCase
58
57
  end
59
58
 
60
59
  def test_deploy_with_list
61
- with_site do |site|
60
+ with_site do |_site|
62
61
  File.open('nanoc.yaml', 'w') do |io|
63
62
  io.write "deploy:\n"
64
63
  io.write " public:\n"
@@ -81,7 +80,7 @@ class Nanoc::CLI::Commands::DeployTest < Nanoc::TestCase
81
80
  end
82
81
 
83
82
  def test_deploy_with_list_deployers
84
- with_site do |site|
83
+ with_site do |_site|
85
84
  File.open('nanoc.yaml', 'w') do |io|
86
85
  io.write "deploy:\n"
87
86
  io.write " public:\n"
@@ -105,7 +104,7 @@ class Nanoc::CLI::Commands::DeployTest < Nanoc::TestCase
105
104
 
106
105
  def test_deploy_without_kind
107
106
  skip_unless_have_command 'rsync'
108
- with_site do |site|
107
+ with_site do |_site|
109
108
  File.open('nanoc.yaml', 'w') do |io|
110
109
  io.write "deploy:\n"
111
110
  io.write " public:\n"
@@ -127,7 +126,7 @@ class Nanoc::CLI::Commands::DeployTest < Nanoc::TestCase
127
126
  end
128
127
 
129
128
  def test_deploy_without_target_without_default
130
- with_site do |site|
129
+ with_site do |_site|
131
130
  File.open('nanoc.yaml', 'w') do |io|
132
131
  io.write "deploy:\n"
133
132
  io.write " public:\n"
@@ -137,7 +136,7 @@ class Nanoc::CLI::Commands::DeployTest < Nanoc::TestCase
137
136
  FileUtils.mkdir_p('output')
138
137
  File.open('output/blah.html', 'w') { |io| io.write 'moo' }
139
138
 
140
- capturing_stdio do
139
+ capturing_stdio do
141
140
  err = assert_raises Nanoc::Errors::GenericTrivial do
142
141
  Nanoc::CLI.run %w( deploy )
143
142
  end
@@ -148,7 +147,7 @@ class Nanoc::CLI::Commands::DeployTest < Nanoc::TestCase
148
147
 
149
148
  def test_deploy_without_target_with_default
150
149
  skip_unless_have_command 'rsync'
151
- with_site do |site|
150
+ with_site do |_site|
152
151
  File.open('nanoc.yaml', 'w') do |io|
153
152
  io.write "deploy:\n"
154
153
  io.write " default:\n"
@@ -166,5 +165,4 @@ class Nanoc::CLI::Commands::DeployTest < Nanoc::TestCase
166
165
  assert File.file?('mydestination/blah.html')
167
166
  end
168
167
  end
169
-
170
168
  end
@@ -1,10 +1,8 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  class Nanoc::CLI::Commands::HelpTest < Nanoc::TestCase
4
-
5
4
  def test_run
6
5
  Nanoc::CLI.run %w( help )
7
6
  Nanoc::CLI.run %w( help co )
8
7
  end
9
-
10
8
  end
@@ -1,9 +1,7 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  class Nanoc::CLI::Commands::InfoTest < Nanoc::TestCase
4
-
5
4
  def test_run
6
5
  Nanoc::CLI.run %w( info )
7
6
  end
8
-
9
7
  end
@@ -1,9 +1,8 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  class Nanoc::CLI::Commands::PruneTest < Nanoc::TestCase
4
-
5
4
  def test_run_without_yes
6
- with_site do |site|
5
+ with_site do |_site|
7
6
  # Set output dir
8
7
  File.open('nanoc.yaml', 'w') { |io| io.write 'output_dir: output2' }
9
8
  FileUtils.mkdir_p('output2')
@@ -25,7 +24,7 @@ class Nanoc::CLI::Commands::PruneTest < Nanoc::TestCase
25
24
  end
26
25
 
27
26
  def test_run_with_yes
28
- with_site do |site|
27
+ with_site do |_site|
29
28
  # Set output dir
30
29
  File.open('nanoc.yaml', 'w') { |io| io.write 'output_dir: output2' }
31
30
  FileUtils.mkdir_p('output2')
@@ -45,7 +44,7 @@ class Nanoc::CLI::Commands::PruneTest < Nanoc::TestCase
45
44
  end
46
45
 
47
46
  def test_run_with_dry_run
48
- with_site do |site|
47
+ with_site do |_site|
49
48
  # Set output dir
50
49
  File.open('nanoc.yaml', 'w') { |io| io.write 'output_dir: output2' }
51
50
  FileUtils.mkdir_p('output2')
@@ -65,7 +64,7 @@ class Nanoc::CLI::Commands::PruneTest < Nanoc::TestCase
65
64
  end
66
65
 
67
66
  def test_run_with_exclude
68
- with_site do |site|
67
+ with_site do |_site|
69
68
  # Set output dir
70
69
  File.open('nanoc.yaml', 'w') { |io| io.write "prune:\n exclude: [ 'good-dir', 'good-file.html' ]" }
71
70
  FileUtils.mkdir_p('output')
@@ -98,7 +97,7 @@ class Nanoc::CLI::Commands::PruneTest < Nanoc::TestCase
98
97
  skip 'JRuby 1.7.11 has buggy File.find behavior (see https://github.com/jruby/jruby/issues/1647)'
99
98
  end
100
99
 
101
- with_site do |site|
100
+ with_site do |_site|
102
101
  # Set output dir
103
102
  FileUtils.rm_rf('output')
104
103
  FileUtils.mkdir_p('output-real')
@@ -121,7 +120,7 @@ class Nanoc::CLI::Commands::PruneTest < Nanoc::TestCase
121
120
  end
122
121
 
123
122
  def test_run_with_nested_empty_dirs
124
- with_site do |site|
123
+ with_site do |_site|
125
124
  # Set output dir
126
125
  File.open('nanoc.yaml', 'w') { |io| io.write 'output_dir: output' }
127
126
  FileUtils.mkdir_p('output')
@@ -138,5 +137,4 @@ class Nanoc::CLI::Commands::PruneTest < Nanoc::TestCase
138
137
  assert !File.directory?('output/a')
139
138
  end
140
139
  end
141
-
142
140
  end