nanoc 4.4.5 → 4.4.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (233) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +6 -2
  3. data/Gemfile.lock +37 -18
  4. data/NEWS.md +6 -0
  5. data/Rakefile +8 -20
  6. data/lib/nanoc/base/entities/code_snippet.rb +0 -2
  7. data/lib/nanoc/base/entities/item_rep.rb +4 -22
  8. data/lib/nanoc/base/entities/processing_actions/snapshot.rb +9 -7
  9. data/lib/nanoc/base/entities/rule_memory.rb +15 -7
  10. data/lib/nanoc/base/entities/snapshot_def.rb +2 -8
  11. data/lib/nanoc/base/repos/store.rb +2 -28
  12. data/lib/nanoc/base/services/checksummer.rb +9 -10
  13. data/lib/nanoc/base/services/compiler.rb +14 -16
  14. data/lib/nanoc/base/services/executor.rb +2 -13
  15. data/lib/nanoc/base/views/mixins/with_reps_view_mixin.rb +1 -1
  16. data/lib/nanoc/checking/checks/external_links.rb +2 -1
  17. data/lib/nanoc/cli/commands/compile.rb +8 -14
  18. data/lib/nanoc/extra/parallel_collection.rb +57 -0
  19. data/lib/nanoc/extra.rb +1 -0
  20. data/lib/nanoc/filters/mustache.rb +1 -1
  21. data/lib/nanoc/rule_dsl/recording_executor.rb +6 -34
  22. data/lib/nanoc/rule_dsl/rule_memory_calculator.rb +42 -12
  23. data/lib/nanoc/spec.rb +1 -1
  24. data/lib/nanoc/version.rb +1 -1
  25. data/nanoc.gemspec +1 -2
  26. data/spec/contributors_spec.rb +18 -0
  27. data/spec/nanoc/base/checksummer_spec.rb +381 -0
  28. data/spec/nanoc/base/compiler_spec.rb +181 -0
  29. data/spec/nanoc/base/entities/configuration_spec.rb +49 -0
  30. data/spec/nanoc/base/entities/content_spec.rb +193 -0
  31. data/spec/nanoc/base/entities/document_spec.rb +206 -0
  32. data/spec/nanoc/base/entities/identifier_spec.rb +460 -0
  33. data/spec/nanoc/base/entities/item_rep_spec.rb +226 -0
  34. data/spec/nanoc/base/entities/item_spec.rb +3 -0
  35. data/spec/nanoc/base/entities/layout_spec.rb +3 -0
  36. data/spec/nanoc/base/entities/lazy_value_spec.rb +106 -0
  37. data/spec/nanoc/base/entities/outdatedness_status_spec.rb +113 -0
  38. data/spec/nanoc/base/entities/pattern_spec.rb +125 -0
  39. data/spec/nanoc/base/entities/processing_action_spec.rb +9 -0
  40. data/spec/nanoc/base/entities/processing_actions/filter_spec.rb +18 -0
  41. data/spec/nanoc/base/entities/processing_actions/layout_spec.rb +18 -0
  42. data/spec/nanoc/base/entities/processing_actions/snapshot_spec.rb +32 -0
  43. data/spec/nanoc/base/entities/props_spec.rb +195 -0
  44. data/spec/nanoc/base/entities/rule_memory_spec.rb +131 -0
  45. data/spec/nanoc/base/entities/site_spec.rb +73 -0
  46. data/spec/nanoc/base/feature_spec.rb +107 -0
  47. data/spec/nanoc/base/filter_spec.rb +99 -0
  48. data/spec/nanoc/base/item_rep_writer_spec.rb +131 -0
  49. data/spec/nanoc/base/plugin_registry_spec.rb +29 -0
  50. data/spec/nanoc/base/repos/checksum_store_spec.rb +133 -0
  51. data/spec/nanoc/base/repos/compiled_content_cache_spec.rb +55 -0
  52. data/spec/nanoc/base/repos/config_loader_spec.rb +243 -0
  53. data/spec/nanoc/base/repos/dependency_store_spec.rb +195 -0
  54. data/spec/nanoc/base/repos/site_loader_spec.rb +214 -0
  55. data/spec/nanoc/base/services/dependency_tracker_spec.rb +238 -0
  56. data/spec/nanoc/base/services/executor_spec.rb +495 -0
  57. data/spec/nanoc/base/services/item_rep_router_spec.rb +134 -0
  58. data/spec/nanoc/base/services/item_rep_selector_spec.rb +169 -0
  59. data/spec/nanoc/base/services/outdatedness_checker_spec.rb +370 -0
  60. data/spec/nanoc/base/services/outdatedness_rules_spec.rb +432 -0
  61. data/spec/nanoc/base/services/pruner_spec.rb +105 -0
  62. data/spec/nanoc/base/services/temp_filename_factory_spec.rb +87 -0
  63. data/spec/nanoc/base/views/config_view_spec.rb +96 -0
  64. data/spec/nanoc/base/views/document_view_spec.rb +332 -0
  65. data/spec/nanoc/base/views/identifiable_collection_view_spec.rb +190 -0
  66. data/spec/nanoc/base/views/item_collection_with_reps_view_spec.rb +18 -0
  67. data/spec/nanoc/base/views/item_collection_without_reps_view_spec.rb +18 -0
  68. data/spec/nanoc/base/views/item_rep_collection_view_spec.rb +143 -0
  69. data/spec/nanoc/base/views/item_rep_view_spec.rb +265 -0
  70. data/spec/nanoc/base/views/item_view_spec.rb +341 -0
  71. data/spec/nanoc/base/views/layout_collection_view_spec.rb +18 -0
  72. data/spec/nanoc/base/views/layout_view_spec.rb +14 -0
  73. data/spec/nanoc/base/views/mutable_config_view_spec.rb +16 -0
  74. data/spec/nanoc/base/views/mutable_document_view_spec.rb +92 -0
  75. data/spec/nanoc/base/views/mutable_identifiable_collection_view_spec.rb +36 -0
  76. data/spec/nanoc/base/views/mutable_item_collection_view_spec.rb +49 -0
  77. data/spec/nanoc/base/views/mutable_item_view_spec.rb +22 -0
  78. data/spec/nanoc/base/views/mutable_layout_collection_view_spec.rb +49 -0
  79. data/spec/nanoc/base/views/mutable_layout_view_spec.rb +13 -0
  80. data/spec/nanoc/base/views/post_compile_item_rep_collection_view_spec.rb +4 -0
  81. data/spec/nanoc/base/views/post_compile_item_rep_view_spec.rb +137 -0
  82. data/spec/nanoc/base/views/post_compile_item_view_spec.rb +56 -0
  83. data/spec/nanoc/cli/commands/compile/file_action_printer_spec.rb +76 -0
  84. data/spec/nanoc/cli/commands/compile/timing_recorder_spec.rb +66 -0
  85. data/spec/nanoc/cli/commands/compile_spec.rb +64 -0
  86. data/spec/nanoc/cli/commands/deploy_spec.rb +327 -0
  87. data/spec/nanoc/cli/commands/shell_spec.rb +54 -0
  88. data/spec/nanoc/cli/commands/show_data_spec.rb +126 -0
  89. data/spec/nanoc/cli/commands/show_rules_spec.rb +112 -0
  90. data/spec/nanoc/cli/commands/view_spec.rb +58 -0
  91. data/spec/nanoc/data_sources/filesystem_spec.rb +56 -0
  92. data/spec/nanoc/deploying/fog_spec.rb +193 -0
  93. data/spec/nanoc/extra/parallel_collection_spec.rb +108 -0
  94. data/spec/nanoc/filters/colorize_syntax/rouge_spec.rb +195 -0
  95. data/spec/nanoc/filters/less_spec.rb +120 -0
  96. data/spec/nanoc/helpers/blogging_spec.rb +216 -0
  97. data/spec/nanoc/helpers/breadcrumbs_spec.rb +133 -0
  98. data/spec/nanoc/helpers/capturing_spec.rb +181 -0
  99. data/spec/nanoc/helpers/child_parent_spec.rb +105 -0
  100. data/spec/nanoc/helpers/filtering_spec.rb +72 -0
  101. data/spec/nanoc/helpers/html_escape_spec.rb +35 -0
  102. data/spec/nanoc/helpers/link_to_spec.rb +275 -0
  103. data/spec/nanoc/helpers/rendering_spec.rb +141 -0
  104. data/spec/nanoc/helpers/tagging_spec.rb +104 -0
  105. data/spec/nanoc/helpers/text_spec.rb +58 -0
  106. data/spec/nanoc/integration/outdatedness_integration_spec.rb +208 -0
  107. data/spec/nanoc/regressions/gh_1015_spec.rb +17 -0
  108. data/spec/nanoc/regressions/gh_1031_spec.rb +54 -0
  109. data/spec/nanoc/regressions/gh_1035_spec.rb +33 -0
  110. data/spec/nanoc/regressions/gh_1040_spec.rb +22 -0
  111. data/spec/nanoc/regressions/gh_761_spec.rb +23 -0
  112. data/spec/nanoc/regressions/gh_767_spec.rb +19 -0
  113. data/spec/nanoc/regressions/gh_769_spec.rb +30 -0
  114. data/spec/nanoc/regressions/gh_776_spec.rb +43 -0
  115. data/spec/nanoc/regressions/gh_787_spec.rb +19 -0
  116. data/spec/nanoc/regressions/gh_795_spec.rb +19 -0
  117. data/spec/nanoc/regressions/gh_804_spec.rb +26 -0
  118. data/spec/nanoc/regressions/gh_807_spec.rb +17 -0
  119. data/spec/nanoc/regressions/gh_809_spec.rb +17 -0
  120. data/spec/nanoc/regressions/gh_813_spec.rb +22 -0
  121. data/spec/nanoc/regressions/gh_815_spec.rb +18 -0
  122. data/spec/nanoc/regressions/gh_828_spec.rb +23 -0
  123. data/spec/nanoc/regressions/gh_833_spec.rb +14 -0
  124. data/spec/nanoc/regressions/gh_841_spec.rb +15 -0
  125. data/spec/nanoc/regressions/gh_867_spec.rb +15 -0
  126. data/spec/nanoc/regressions/gh_882_spec.rb +29 -0
  127. data/spec/nanoc/regressions/gh_885_spec.rb +30 -0
  128. data/spec/nanoc/regressions/gh_891_spec.rb +26 -0
  129. data/spec/nanoc/regressions/gh_913_spec.rb +24 -0
  130. data/spec/nanoc/regressions/gh_928_spec.rb +5 -0
  131. data/spec/nanoc/regressions/gh_937_spec.rb +25 -0
  132. data/spec/nanoc/regressions/gh_942_spec.rb +21 -0
  133. data/spec/nanoc/regressions/gh_947_spec.rb +21 -0
  134. data/spec/nanoc/regressions/gh_948_spec.rb +16 -0
  135. data/spec/nanoc/regressions/gh_951_spec.rb +19 -0
  136. data/spec/nanoc/regressions/gh_954_spec.rb +33 -0
  137. data/spec/nanoc/regressions/gh_970a_spec.rb +17 -0
  138. data/spec/nanoc/regressions/gh_970b_spec.rb +50 -0
  139. data/spec/nanoc/regressions/gh_974_spec.rb +17 -0
  140. data/spec/nanoc/regressions/gh_981_spec.rb +21 -0
  141. data/spec/nanoc/rule_dsl/recording_executor_spec.rb +142 -0
  142. data/spec/nanoc/rule_dsl/rule_context_spec.rb +177 -0
  143. data/spec/nanoc/rule_dsl/rule_memory_calculator_spec.rb +233 -0
  144. data/spec/nanoc/rule_dsl/rules_collection_spec.rb +299 -0
  145. data/spec/regression_filenames_spec.rb +16 -0
  146. data/spec/spec_helper.rb +173 -0
  147. data/test/base/core_ext/array_spec.rb +2 -0
  148. data/test/base/core_ext/hash_spec.rb +2 -0
  149. data/test/base/core_ext/string_spec.rb +2 -0
  150. data/test/base/test_code_snippet.rb +2 -0
  151. data/test/base/test_compiler.rb +2 -0
  152. data/test/base/test_context.rb +4 -2
  153. data/test/base/test_data_source.rb +2 -0
  154. data/test/base/test_dependency_tracker.rb +2 -0
  155. data/test/base/test_directed_graph.rb +2 -0
  156. data/test/base/test_filter.rb +7 -5
  157. data/test/base/test_item.rb +2 -0
  158. data/test/base/test_item_array.rb +3 -1
  159. data/test/base/test_layout.rb +2 -0
  160. data/test/base/test_memoization.rb +2 -0
  161. data/test/base/test_notification_center.rb +2 -0
  162. data/test/base/test_outdatedness_checker.rb +2 -0
  163. data/test/base/test_plugin.rb +2 -0
  164. data/test/base/test_site.rb +2 -0
  165. data/test/base/test_store.rb +2 -0
  166. data/test/checking/checks/test_css.rb +2 -0
  167. data/test/checking/checks/test_external_links.rb +4 -2
  168. data/test/checking/checks/test_html.rb +2 -0
  169. data/test/checking/checks/test_internal_links.rb +5 -3
  170. data/test/checking/checks/test_mixed_content.rb +2 -0
  171. data/test/checking/checks/test_stale.rb +2 -0
  172. data/test/checking/test_check.rb +2 -0
  173. data/test/checking/test_dsl.rb +2 -0
  174. data/test/checking/test_runner.rb +2 -0
  175. data/test/cli/commands/test_check.rb +2 -0
  176. data/test/cli/commands/test_compile.rb +2 -0
  177. data/test/cli/commands/test_create_site.rb +2 -0
  178. data/test/cli/commands/test_help.rb +2 -0
  179. data/test/cli/commands/test_info.rb +2 -0
  180. data/test/cli/commands/test_prune.rb +2 -0
  181. data/test/cli/test_cleaning_stream.rb +2 -0
  182. data/test/cli/test_cli.rb +11 -9
  183. data/test/cli/test_error_handler.rb +2 -0
  184. data/test/cli/test_logger.rb +2 -0
  185. data/test/data_sources/test_filesystem.rb +8 -6
  186. data/test/data_sources/test_filesystem_tools.rb +2 -0
  187. data/test/deploying/test_fog.rb +2 -0
  188. data/test/deploying/test_rsync.rb +4 -2
  189. data/test/extra/core_ext/test_pathname.rb +2 -0
  190. data/test/extra/core_ext/test_time.rb +2 -0
  191. data/test/extra/test_link_collector.rb +2 -0
  192. data/test/extra/test_piper.rb +2 -0
  193. data/test/filters/colorize_syntax/test_coderay.rb +2 -0
  194. data/test/filters/colorize_syntax/test_common.rb +2 -0
  195. data/test/filters/colorize_syntax/test_pygmentize.rb +2 -0
  196. data/test/filters/colorize_syntax/test_pygments.rb +2 -0
  197. data/test/filters/colorize_syntax/test_simon.rb +2 -0
  198. data/test/filters/test_asciidoc.rb +2 -0
  199. data/test/filters/test_bluecloth.rb +2 -0
  200. data/test/filters/test_coffeescript.rb +2 -0
  201. data/test/filters/test_erb.rb +7 -5
  202. data/test/filters/test_erubis.rb +6 -4
  203. data/test/filters/test_haml.rb +7 -5
  204. data/test/filters/test_handlebars.rb +2 -0
  205. data/test/filters/test_kramdown.rb +2 -0
  206. data/test/filters/test_markaby.rb +2 -0
  207. data/test/filters/test_maruku.rb +2 -0
  208. data/test/filters/test_mustache.rb +4 -2
  209. data/test/filters/test_pandoc.rb +2 -0
  210. data/test/filters/test_rainpress.rb +2 -0
  211. data/test/filters/test_rdiscount.rb +2 -0
  212. data/test/filters/test_rdoc.rb +2 -0
  213. data/test/filters/test_redcarpet.rb +2 -0
  214. data/test/filters/test_redcloth.rb +2 -0
  215. data/test/filters/test_relativize_paths.rb +2 -0
  216. data/test/filters/test_rubypants.rb +2 -0
  217. data/test/filters/test_sass.rb +4 -2
  218. data/test/filters/test_slim.rb +4 -2
  219. data/test/filters/test_typogruby.rb +2 -0
  220. data/test/filters/test_uglify_js.rb +2 -0
  221. data/test/filters/test_xsl.rb +2 -0
  222. data/test/filters/test_yui_compressor.rb +5 -3
  223. data/test/helpers/test_blogging.rb +2 -0
  224. data/test/helpers/test_capturing.rb +2 -0
  225. data/test/helpers/test_link_to.rb +2 -0
  226. data/test/helpers/test_xml_sitemap.rb +2 -0
  227. data/test/rule_dsl/test_action_provider.rb +2 -0
  228. data/test/rule_dsl/test_compiler_dsl.rb +6 -4
  229. data/test/rule_dsl/test_rule.rb +2 -0
  230. data/test/rule_dsl/test_rules_collection.rb +2 -0
  231. data/test/test_gem.rb +2 -0
  232. metadata +124 -17
  233. data/test/base/test_item_rep.rb +0 -156
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 863abf7fed2e1998046a921fe61e76d21bc0d4d3
4
- data.tar.gz: 03a50e4fc4e75f74e0505c0664c352e5b2821d09
3
+ metadata.gz: '0186a136e28013d7133ebf66fa6d1e7065992a40'
4
+ data.tar.gz: 9198ef4aa5d624328b6bc3a5dc20238c4d4a4e53
5
5
  SHA512:
6
- metadata.gz: 5efd6d09aef769a17e8a1d66ee9557ca8b70dbdca303b36e2142e331d133904caf4b902b246d65d9b22ead0cb152746684bf0ae52436ce7c7bfa6de670a537af
7
- data.tar.gz: 62b27f158e7d10f8faf730df0ce02bb931fc15d665e5ad4960ca006c2f917333dcc74ff8cd49532245b47f65648313095819c4bda84e4657e515585ea20a6686
6
+ metadata.gz: b4f5f734e8a28c0cb7f01fa35119bbd7b2ffe7cae4a1d832fd70d3fa1fb7657a7f000ed9557213c8f849117033d4222bb7681fe4bc3bc3977dc9f441a59658af
7
+ data.tar.gz: b193bcfdf436fa88af0ae448019037bba79a5ab75a643280a3b5ce031e92e3e7ebbeab8e135f0d77111244d15fcff0bbf112662f027a60cb5544ed048a809f30
data/Gemfile CHANGED
@@ -8,14 +8,17 @@ group :devel do
8
8
  gem 'fuubar'
9
9
  gem 'guard-rake'
10
10
  gem 'json', '~> 2.0'
11
+ gem 'm', '~> 1.5'
11
12
  gem 'minitest', '~> 5.0'
12
13
  gem 'mocha'
13
14
  gem 'pry'
15
+ gem 'rainbow', '~> 2.1'
14
16
  gem 'rake'
15
17
  gem 'rdoc', '~> 5.0'
16
- gem 'rspec-mocks'
17
18
  gem 'rspec'
18
- gem 'rubocop'
19
+ gem 'rspec-its', '~> 1.2'
20
+ gem 'rspec-mocks'
21
+ gem 'rubocop', github: 'bbatsov/rubocop'
19
22
  gem 'simplecov', require: false
20
23
  gem 'timecop'
21
24
  gem 'vcr'
@@ -55,6 +58,7 @@ group :plugins do
55
58
  gem 'rubypants'
56
59
  gem 'sass'
57
60
  gem 'slim'
61
+ gem 'therubyracer', github: 'cowboyd/therubyracer'
58
62
  gem 'typogruby'
59
63
  gem 'uglifier'
60
64
  gem 'w3c_validators'
data/Gemfile.lock CHANGED
@@ -1,3 +1,22 @@
1
+ GIT
2
+ remote: git://github.com/bbatsov/rubocop.git
3
+ revision: 186b16e10514eaf304990d614184b980abc0ad2b
4
+ specs:
5
+ rubocop (0.46.0)
6
+ parser (>= 2.3.3.1, < 3.0)
7
+ powerpack (~> 0.1)
8
+ rainbow (>= 1.99.1, < 3.0)
9
+ ruby-progressbar (~> 1.7)
10
+ unicode-display_width (~> 1.0, >= 1.0.1)
11
+
12
+ GIT
13
+ remote: git://github.com/cowboyd/therubyracer.git
14
+ revision: 2f1127bed45f03b91f3c92469be26399d3c1bcd8
15
+ specs:
16
+ therubyracer (0.12.2)
17
+ libv8 (~> 3.16.14.15)
18
+ ref
19
+
1
20
  GIT
2
21
  remote: git://github.com/tmm1/pygments.rb.git
3
22
  revision: a988d127d3270d21685d2ac2e586060bf43709f3
@@ -8,10 +27,9 @@ GIT
8
27
  PATH
9
28
  remote: .
10
29
  specs:
11
- nanoc (4.4.5)
30
+ nanoc (4.4.6)
12
31
  cri (~> 2.3)
13
32
  hamster (~> 3.0)
14
- parallel (~> 1.9)
15
33
  ref (~> 2.0)
16
34
 
17
35
  GEM
@@ -50,7 +68,7 @@ GEM
50
68
  sass (>= 3.3.0, < 3.5)
51
69
  compass-import-once (1.0.5)
52
70
  sass (>= 3.2, < 3.5)
53
- concurrent-ruby (1.0.3)
71
+ concurrent-ruby (1.0.4)
54
72
  contracts (0.14.0)
55
73
  coveralls (0.8.17)
56
74
  json (>= 1.8, < 3)
@@ -219,7 +237,7 @@ GEM
219
237
  handlebars-source (~> 4.0.5)
220
238
  therubyracer (~> 0.12.1)
221
239
  handlebars-source (4.0.6)
222
- hashdiff (0.3.1)
240
+ hashdiff (0.3.2)
223
241
  inflecto (0.0.2)
224
242
  ipaddress (0.8.3)
225
243
  json (2.0.2)
@@ -232,6 +250,9 @@ GEM
232
250
  rb-inotify (~> 0.9, >= 0.9.7)
233
251
  ruby_dep (~> 1.2)
234
252
  lumberjack (1.0.10)
253
+ m (1.5.0)
254
+ method_source (>= 0.6.7)
255
+ rake (>= 0.9.2.2)
235
256
  markaby (0.8.0)
236
257
  builder
237
258
  maruku (0.7.2)
@@ -247,7 +268,7 @@ GEM
247
268
  multi_json (1.12.1)
248
269
  mustache (1.0.3)
249
270
  nenv (0.3.0)
250
- nokogiri (1.6.8.1)
271
+ nokogiri (1.7.0)
251
272
  mini_portile2 (~> 2.1.0)
252
273
  notiffany (0.1.1)
253
274
  nenv (~> 0.1)
@@ -263,7 +284,7 @@ GEM
263
284
  slop (~> 3.4)
264
285
  public_suffix (2.0.4)
265
286
  rack (2.0.1)
266
- rainbow (2.1.0)
287
+ rainbow (2.2.0)
267
288
  rainpress (1.0)
268
289
  rake (12.0.0)
269
290
  rb-fsevent (0.9.8)
@@ -276,7 +297,7 @@ GEM
276
297
  trollop (~> 2.1)
277
298
  rdiscount (2.2.0.1)
278
299
  rdoc (5.0.0)
279
- redcarpet (3.3.4)
300
+ redcarpet (3.4.0)
280
301
  ref (2.0.0)
281
302
  rouge (2.0.7)
282
303
  rspec (3.5.0)
@@ -288,16 +309,13 @@ GEM
288
309
  rspec-expectations (3.5.0)
289
310
  diff-lcs (>= 1.2.0, < 2.0)
290
311
  rspec-support (~> 3.5.0)
312
+ rspec-its (1.2.0)
313
+ rspec-core (>= 3.0.0)
314
+ rspec-expectations (>= 3.0.0)
291
315
  rspec-mocks (3.5.0)
292
316
  diff-lcs (>= 1.2.0, < 2.0)
293
317
  rspec-support (~> 3.5.0)
294
318
  rspec-support (3.5.0)
295
- rubocop (0.46.0)
296
- parser (>= 2.3.1.1, < 3.0)
297
- powerpack (~> 0.1)
298
- rainbow (>= 1.99.1, < 3.0)
299
- ruby-progressbar (~> 1.7)
300
- unicode-display_width (~> 1.0, >= 1.0.1)
301
319
  ruby-progressbar (1.8.1)
302
320
  ruby_dep (1.5.0)
303
321
  rubypants (0.6.0)
@@ -316,9 +334,6 @@ GEM
316
334
  temple (0.7.7)
317
335
  term-ansicolor (1.4.0)
318
336
  tins (~> 1.0)
319
- therubyracer (0.12.2)
320
- libv8 (~> 3.16.14.0)
321
- ref
322
337
  thor (0.19.4)
323
338
  tilt (2.0.5)
324
339
  timecop (0.8.1)
@@ -369,6 +384,7 @@ DEPENDENCIES
369
384
  kramdown
370
385
  less (~> 2.0)
371
386
  listen
387
+ m (~> 1.5)
372
388
  markaby
373
389
  maruku
374
390
  mime-types
@@ -382,6 +398,7 @@ DEPENDENCIES
382
398
  pry
383
399
  pygments.rb!
384
400
  rack
401
+ rainbow (~> 2.1)
385
402
  rainpress
386
403
  rake
387
404
  rdiscount (~> 2.2)
@@ -389,12 +406,14 @@ DEPENDENCIES
389
406
  redcarpet
390
407
  rouge
391
408
  rspec
409
+ rspec-its (~> 1.2)
392
410
  rspec-mocks
393
- rubocop
411
+ rubocop!
394
412
  rubypants
395
413
  sass
396
414
  simplecov
397
415
  slim
416
+ therubyracer!
398
417
  timecop
399
418
  typogruby
400
419
  uglifier
@@ -406,4 +425,4 @@ DEPENDENCIES
406
425
  yuicompressor
407
426
 
408
427
  BUNDLED WITH
409
- 1.13.6
428
+ 1.13.7
data/NEWS.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Nanoc news
2
2
 
3
+ ## 4.4.6 (2016-12-28)
4
+
5
+ Fixes:
6
+
7
+ * Fixed issue where `#compiled_content` would not return the correct content (#1040, #1041)
8
+
3
9
  ## 4.4.5 (2016-12-24)
4
10
 
5
11
  Fixes:
data/Rakefile CHANGED
@@ -3,30 +3,18 @@ require 'rspec/core/rake_task'
3
3
  require 'rake/testtask'
4
4
  require 'coveralls/rake/task'
5
5
 
6
- RuboCop::RakeTask.new(:rubocop) do |task|
7
- task.options = %w(--display-cop-names --format simple)
8
- task.patterns = ['bin/nanoc', 'lib/**/*.rb', 'spec/**/*.rb', 'test/**/*.rb']
9
- end
6
+ RuboCop::RakeTask.new(:rubocop)
10
7
 
11
8
  Coveralls::RakeTask.new
12
9
 
13
- SUBDIRS = %w(* base checking cli data_sources deploying extra filters helpers).freeze
14
-
15
- namespace :test do
16
- SUBDIRS.each do |dir|
17
- Rake::TestTask.new(dir == '*' ? 'all' : dir) do |t|
18
- t.test_files = Dir["test/#{dir}/**/*_spec.rb"] + Dir["test/#{dir}/**/test_*.rb"]
19
- t.libs = ['./lib', '.']
20
- t.ruby_opts = ['-r./test/helper']
21
- end
22
- end
10
+ Rake::TestTask.new(:test_all) do |t|
11
+ t.test_files = Dir['test/**/*_spec.rb'] + Dir['test/**/test_*.rb']
12
+ t.libs << 'test'
23
13
  end
24
14
 
25
- RSpec::Core::RakeTask.new(:spec) do |t|
26
- t.verbose = false
27
- end
15
+ RSpec::Core::RakeTask.new(:spec)
28
16
 
29
- desc 'Run all tests and specs'
30
- task test: [:spec, :'test:all', :'coveralls:push']
17
+ task test: [:spec, :test_all, :rubocop]
18
+ task test_ci: [:test, :'coveralls:push']
31
19
 
32
- task default: [:test, :rubocop]
20
+ task default: :test
@@ -32,9 +32,7 @@ module Nanoc::Int
32
32
  #
33
33
  # @return [void]
34
34
  def load
35
- # rubocop:disable Lint/Eval
36
35
  eval(@data, TOPLEVEL_BINDING, @filename)
37
- # rubocop:enable Lint/Eval
38
36
  nil
39
37
  end
40
38
 
@@ -66,24 +66,16 @@ module Nanoc::Int
66
66
  def compiled_content(snapshot: nil)
67
67
  # Get name of last pre-layout snapshot
68
68
  snapshot_name = snapshot || (@snapshot_contents[:pre] ? :pre : :last)
69
- is_movable = [:pre, :post, :last].include?(snapshot_name)
70
69
 
71
70
  # Check existance of snapshot
72
71
  snapshot_def = snapshot_defs.reverse.find { |sd| sd.name == snapshot_name }
73
- is_final = snapshot_def && snapshot_def.final?
74
- if !is_movable && !is_final
72
+ unless snapshot_def
75
73
  raise Nanoc::Int::Errors::NoSuchSnapshot.new(self, snapshot_name)
76
74
  end
77
75
 
78
76
  # Verify snapshot is usable
79
- is_still_moving =
80
- case snapshot_name
81
- when :post, :last
82
- true
83
- when :pre
84
- !is_final
85
- end
86
- is_usable_snapshot = @snapshot_contents[snapshot_name] && (compiled? || !is_still_moving)
77
+ stopped_moving = snapshot_name != :last || compiled?
78
+ is_usable_snapshot = @snapshot_contents[snapshot_name] && stopped_moving
87
79
  unless is_usable_snapshot
88
80
  Fiber.yield(Nanoc::Int::Errors::UnmetDependency.new(self))
89
81
  return compiled_content(snapshot: snapshot)
@@ -98,16 +90,6 @@ module Nanoc::Int
98
90
  snapshot_content.string
99
91
  end
100
92
 
101
- contract Symbol => C::Bool
102
- # Checks whether content exists at a given snapshot.
103
- #
104
- # @return [Boolean] True if content exists for the snapshot with the
105
- # given name, false otherwise
106
- def snapshot?(snapshot_name)
107
- !@snapshot_contents[snapshot_name].nil?
108
- end
109
- alias has_snapshot? snapshot?
110
-
111
93
  contract C::KeywordArgs[snapshot: C::Optional[Symbol]] => C::Maybe[String]
112
94
  # Returns the item rep’s raw path. It includes the path to the output
113
95
  # directory and the full filename.
@@ -144,7 +126,7 @@ module Nanoc::Int
144
126
  end
145
127
 
146
128
  def inspect
147
- "<#{self.class} name=\"#{name}\" binary=#{binary?} raw_path=\"#{raw_path}\" item.identifier=\"#{item.identifier}\">"
129
+ "<#{self.class} name=\"#{name}\" raw_path=\"#{raw_path}\" item.identifier=\"#{item.identifier}\">"
148
130
  end
149
131
  end
150
132
  end
@@ -1,26 +1,28 @@
1
1
  module Nanoc::Int::ProcessingActions
2
2
  class Snapshot < Nanoc::Int::ProcessingAction
3
3
  # snapshot :before_layout
4
- # snapshot :before_layout, final: true
5
4
  # snapshot :before_layout, path: '/about.md'
6
5
 
7
6
  attr_reader :snapshot_name
8
- attr_reader :final
9
7
  attr_reader :path
10
- alias final? final
11
8
 
12
- def initialize(snapshot_name, final, path)
9
+ def initialize(snapshot_name, path)
13
10
  @snapshot_name = snapshot_name
14
- @final = final
15
11
  @path = path
16
12
  end
17
13
 
18
14
  def serialize
19
- [:snapshot, @snapshot_name, @final, @path]
15
+ [:snapshot, @snapshot_name, true, @path]
16
+ end
17
+
18
+ NONE = Object.new
19
+
20
+ def copy(path: NONE)
21
+ self.class.new(@snapshot_name, path.equal?(NONE) ? @path : path)
20
22
  end
21
23
 
22
24
  def to_s
23
- "snapshot #{@snapshot_name.inspect}, final: #{@final.inspect}, path: #{@path.inspect}"
25
+ "snapshot #{@snapshot_name.inspect}, path: #{@path.inspect}"
24
26
  end
25
27
  end
26
28
  end
@@ -3,9 +3,9 @@ module Nanoc::Int
3
3
  include Nanoc::Int::ContractsSupport
4
4
  include Enumerable
5
5
 
6
- def initialize(item_rep)
6
+ def initialize(item_rep, actions: [])
7
7
  @item_rep = item_rep
8
- @actions = []
8
+ @actions = actions
9
9
  end
10
10
 
11
11
  contract C::None => Numeric
@@ -30,10 +30,10 @@ module Nanoc::Int
30
30
  self
31
31
  end
32
32
 
33
- contract Symbol, C::Bool, C::Maybe[String] => self
34
- def add_snapshot(snapshot_name, final, path)
35
- will_add_snapshot(snapshot_name) if final
36
- @actions << Nanoc::Int::ProcessingActions::Snapshot.new(snapshot_name, final, path)
33
+ contract Symbol, C::Maybe[String] => self
34
+ def add_snapshot(snapshot_name, path)
35
+ will_add_snapshot(snapshot_name)
36
+ @actions << Nanoc::Int::ProcessingActions::Snapshot.new(snapshot_name, path)
37
37
  self
38
38
  end
39
39
 
@@ -56,7 +56,7 @@ module Nanoc::Int
56
56
 
57
57
  # TODO: Add contract
58
58
  def serialize
59
- map(&:serialize)
59
+ to_a.map(&:serialize)
60
60
  end
61
61
 
62
62
  contract C::Func[Nanoc::Int::ProcessingAction => C::Any] => self
@@ -65,6 +65,14 @@ module Nanoc::Int
65
65
  self
66
66
  end
67
67
 
68
+ contract C::Func[Nanoc::Int::ProcessingAction => C::Any] => self
69
+ def map
70
+ self.class.new(
71
+ @item_rep,
72
+ actions: @actions.map { |a| yield(a) },
73
+ )
74
+ end
75
+
68
76
  private
69
77
 
70
78
  def will_add_snapshot(name)
@@ -5,15 +5,9 @@ module Nanoc
5
5
 
6
6
  attr_reader :name
7
7
 
8
- contract Symbol, C::Bool => C::Any
9
- def initialize(name, is_final)
8
+ contract Symbol => C::Any
9
+ def initialize(name)
10
10
  @name = name
11
- @is_final = is_final
12
- end
13
-
14
- contract C::None => C::Bool
15
- def final?
16
- @is_final
17
11
  end
18
12
  end
19
13
  end
@@ -66,21 +66,11 @@ module Nanoc::Int
66
66
  #
67
67
  # @return [void]
68
68
  def load
69
- # Check file existance
70
- unless File.file?(filename)
71
- no_data_found
72
- return
73
- end
69
+ return unless File.file?(filename)
74
70
 
75
71
  begin
76
72
  pstore.transaction do
77
- # Check version
78
- if pstore[:version] != version
79
- version_mismatch_detected
80
- return
81
- end
82
-
83
- # Load
73
+ return if pstore[:version] != version
84
74
  self.data = pstore[:data]
85
75
  end
86
76
  rescue
@@ -102,22 +92,6 @@ module Nanoc::Int
102
92
  end
103
93
  end
104
94
 
105
- # @group Callback methods
106
-
107
- # Callback method that is called when no data file was found. By default,
108
- # this implementation does nothing, but it should probably be overridden
109
- # by the subclass.
110
- #
111
- # @return [void]
112
- def no_data_found; end
113
-
114
- # Callback method that is called when a version mismatch is detected. By
115
- # default, this implementation does nothing, but it should probably be
116
- # overridden by the subclass.
117
- #
118
- # @return [void]
119
- def version_mismatch_detected; end
120
-
121
95
  private
122
96
 
123
97
  def pstore
@@ -104,7 +104,13 @@ module Nanoc::Int
104
104
  end
105
105
  end
106
106
 
107
- class RuleContextUpdateBehavior
107
+ class UpdateBehavior
108
+ def self.update(_obj, _digest)
109
+ raise NotImpementedError
110
+ end
111
+ end
112
+
113
+ class RuleContextUpdateBehavior < UpdateBehavior
108
114
  def self.update(obj, digest)
109
115
  digest.update('item=')
110
116
  yield(obj.item)
@@ -119,7 +125,7 @@ module Nanoc::Int
119
125
  end
120
126
  end
121
127
 
122
- class ContextUpdateBehavior
128
+ class ContextUpdateBehavior < UpdateBehavior
123
129
  def self.update(obj, digest)
124
130
  obj.instance_variables.each do |var|
125
131
  digest.update(var.to_s)
@@ -130,12 +136,6 @@ module Nanoc::Int
130
136
  end
131
137
  end
132
138
 
133
- class UpdateBehavior
134
- def self.update(_obj, _digest)
135
- raise NotImpementedError
136
- end
137
- end
138
-
139
139
  class RawUpdateBehavior < UpdateBehavior
140
140
  def self.update(obj, digest)
141
141
  digest.update(obj.to_s)
@@ -167,8 +167,7 @@ module Nanoc::Int
167
167
  end
168
168
 
169
169
  class NoUpdateBehavior < UpdateBehavior
170
- def self.update(_obj, _digest)
171
- end
170
+ def self.update(_obj, _digest); end
172
171
  end
173
172
 
174
173
  class UnwrapUpdateBehavior < UpdateBehavior
@@ -75,7 +75,7 @@ module Nanoc::Int
75
75
 
76
76
  # Provides functionality for (re)calculating the content of an item rep, without caching or
77
77
  # outdatedness checking.
78
- class RecalculatingItemRepCompiler
78
+ class RecalculatePhase
79
79
  include Nanoc::Int::ContractsSupport
80
80
 
81
81
  def initialize(action_provider:, dependency_store:, compilation_context:)
@@ -98,7 +98,7 @@ module Nanoc::Int
98
98
  when Nanoc::Int::ProcessingActions::Layout
99
99
  executor.layout(action.layout_identifier, action.params)
100
100
  when Nanoc::Int::ProcessingActions::Snapshot
101
- executor.snapshot(action.snapshot_name, final: action.final?, path: action.path)
101
+ executor.snapshot(action.snapshot_name)
102
102
  else
103
103
  raise Nanoc::Int::Errors::InternalInconsistency, "unknown action #{action.inspect}"
104
104
  end
@@ -109,8 +109,8 @@ module Nanoc::Int
109
109
  end
110
110
 
111
111
  # Provides functionality for (re)calculating the content of an item rep, with caching or
112
- # outdatedness checking. Delegates to RecalculatingItemRepCompiler if outdated or no cache available.
113
- class CachingItemRepCompiler
112
+ # outdatedness checking. Delegates to RecalculatePhase if outdated or no cache available.
113
+ class CachePhase
114
114
  include Nanoc::Int::ContractsSupport
115
115
 
116
116
  def initialize(compiled_content_cache:, wrapped:)
@@ -138,7 +138,7 @@ module Nanoc::Int
138
138
  end
139
139
 
140
140
  # Provides functionality for suspending and resuming item rep compilation (using fibers).
141
- class ResumableItemRepCompiler
141
+ class ResumePhase
142
142
  include Nanoc::Int::ContractsSupport
143
143
 
144
144
  def initialize(wrapped:)
@@ -182,7 +182,7 @@ module Nanoc::Int
182
182
  end
183
183
  end
184
184
 
185
- class WritingItemRepCompiler
185
+ class WritePhase
186
186
  include Nanoc::Int::ContractsSupport
187
187
 
188
188
  def initialize(wrapped:)
@@ -194,9 +194,7 @@ module Nanoc::Int
194
194
  @wrapped.run(rep, is_outdated: is_outdated)
195
195
 
196
196
  rep.snapshot_defs.each do |sdef|
197
- if sdef.final?
198
- ItemRepWriter.new.write(rep, sdef.name)
199
- end
197
+ ItemRepWriter.new.write(rep, sdef.name)
200
198
  end
201
199
  end
202
200
  end
@@ -344,23 +342,23 @@ module Nanoc::Int
344
342
 
345
343
  def item_rep_compiler
346
344
  @_item_rep_compiler ||= begin
347
- recalculating_item_rep_compiler = RecalculatingItemRepCompiler.new(
345
+ recalculate_phase = RecalculatePhase.new(
348
346
  action_provider: action_provider,
349
347
  dependency_store: @dependency_store,
350
348
  compilation_context: compilation_context,
351
349
  )
352
350
 
353
- caching_item_rep_compiler = CachingItemRepCompiler.new(
351
+ cache_phase = CachePhase.new(
354
352
  compiled_content_cache: compiled_content_cache,
355
- wrapped: recalculating_item_rep_compiler,
353
+ wrapped: recalculate_phase,
356
354
  )
357
355
 
358
- resumable_item_rep_compiler = ResumableItemRepCompiler.new(
359
- wrapped: caching_item_rep_compiler,
356
+ resume_phase = ResumePhase.new(
357
+ wrapped: cache_phase,
360
358
  )
361
359
 
362
- WritingItemRepCompiler.new(
363
- wrapped: resumable_item_rep_compiler,
360
+ WritePhase.new(
361
+ wrapped: resume_phase,
364
362
  )
365
363
  end
366
364
  end
@@ -35,9 +35,6 @@ module Nanoc
35
35
  if filter.class.to_binary? && !File.file?(filter.output_filename)
36
36
  raise OutputNotWrittenError.new(filter_name, filter.output_filename)
37
37
  end
38
-
39
- # Create snapshot
40
- snapshot(@rep.snapshot_contents[:post] ? :post : :pre, final: false) unless @rep.binary?
41
38
  ensure
42
39
  Nanoc::Int::NotificationCenter.post(:filtering_ended, @rep, filter_name)
43
40
  end
@@ -55,17 +52,12 @@ module Nanoc
55
52
  # Check whether item can be laid out
56
53
  raise Nanoc::Int::Errors::CannotLayoutBinaryItem.new(@rep) if @rep.binary?
57
54
 
58
- # Create "pre" snapshot
59
- if @rep.snapshot_contents[:post].nil?
60
- snapshot(:pre, final: true)
61
- end
62
-
63
55
  # Create filter
64
56
  klass = Nanoc::Filter.named(filter_name)
65
57
  raise Nanoc::Int::Errors::UnknownFilter.new(filter_name) if klass.nil?
66
58
  view_context = @compilation_context.create_view_context(@dependency_tracker)
67
59
  layout_view = Nanoc::LayoutView.new(layout, view_context)
68
- filter = klass.new(assigns_for(@rep).merge({ layout: layout_view }))
60
+ filter = klass.new(assigns_for(@rep).merge(layout: layout_view))
69
61
 
70
62
  # Visit
71
63
  @dependency_tracker.bounce(layout, raw_content: true)
@@ -78,15 +70,12 @@ module Nanoc
78
70
  arg = content.binary? ? content.filename : content.string
79
71
  res = filter.setup_and_run(arg, filter_args)
80
72
  @rep.snapshot_contents[:last] = Nanoc::Int::TextualContent.new(res).tap(&:freeze)
81
-
82
- # Create "post" snapshot
83
- snapshot(:post, final: false)
84
73
  ensure
85
74
  Nanoc::Int::NotificationCenter.post(:filtering_ended, @rep, filter_name)
86
75
  end
87
76
  end
88
77
 
89
- def snapshot(snapshot_name, final: true, path: nil) # rubocop:disable Lint/UnusedMethodArgument
78
+ def snapshot(snapshot_name)
90
79
  @rep.snapshot_contents[snapshot_name] = @rep.snapshot_contents[:last]
91
80
  end
92
81
 
@@ -12,7 +12,7 @@ module Nanoc
12
12
  # any).
13
13
  #
14
14
  # @return [String] The content of the given rep at the given snapshot.
15
- def compiled_content(rep: :default, snapshot: :pre)
15
+ def compiled_content(rep: :default, snapshot: nil)
16
16
  reps.fetch(rep).compiled_content(snapshot: snapshot)
17
17
  end
18
18
 
@@ -43,7 +43,8 @@ module ::Nanoc::Checking::Checks
43
43
  end
44
44
 
45
45
  def select_invalid(hrefs)
46
- Parallel.map(hrefs, in_threads: 10) { |href| validate(href) }.compact
46
+ col = Nanoc::Extra::ParallelCollection.new(hrefs, parallelism: 10)
47
+ col.map { |href| validate(href) }.compact
47
48
  end
48
49
 
49
50
  def validate(href)