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
  module Nanoc::PathnameExtensions
4
-
5
4
  # Calculates the checksum for the file referenced to by this pathname. Any
6
5
  # change to the file contents will result in a different checksum.
7
6
  #
@@ -11,7 +10,6 @@ module Nanoc::PathnameExtensions
11
10
  def checksum
12
11
  Nanoc::Checksummer.calc(self)
13
12
  end
14
-
15
13
  end
16
14
 
17
15
  class Pathname
@@ -1,7 +1,6 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module Nanoc::StringExtensions
4
-
5
4
  # Transforms string into an actual identifier
6
5
  #
7
6
  # @return [String] The identifier generated from the receiver
@@ -18,7 +17,6 @@ module Nanoc::StringExtensions
18
17
  def checksum
19
18
  Nanoc::Checksummer.calc(self)
20
19
  end
21
-
22
20
  end
23
21
 
24
22
  class String
@@ -1,7 +1,6 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module Nanoc
4
-
5
4
  # Represents a directed graph. It is used by the dependency tracker for
6
5
  # storing and querying dependencies between items.
7
6
  #
@@ -30,7 +29,6 @@ module Nanoc
30
29
  # graph.predecessors_of('d').sort
31
30
  # # => %w( b c )
32
31
  class DirectedGraph
33
-
34
32
  # @group Creating a graph
35
33
 
36
34
  # Creates a new directed graph with the given vertices.
@@ -266,7 +264,5 @@ module Nanoc
266
264
 
267
265
  all_vertices.to_a
268
266
  end
269
-
270
267
  end
271
-
272
268
  end
@@ -1,10 +1,8 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module Nanoc
4
-
5
4
  # Module that contains all nanoc-specific errors.
6
5
  module Errors
7
-
8
6
  # Generic error. Superclass for all nanoc-specific errors.
9
7
  class Generic < ::StandardError
10
8
  end
@@ -17,103 +15,86 @@ module Nanoc
17
15
  # Error that is raised when a site is loaded that uses a data source with
18
16
  # an unknown identifier.
19
17
  class UnknownDataSource < Generic
20
-
21
18
  # @param [String] data_source_name The data source name for which no
22
19
  # data source could be found
23
20
  def initialize(data_source_name)
24
21
  super("The data source specified in the site’s configuration file, “#{data_source_name}”, does not exist.")
25
22
  end
26
-
27
23
  end
28
24
 
29
25
  # Error that is raised during site compilation when an item uses a layout
30
26
  # that is not present in the site.
31
27
  class UnknownLayout < Generic
32
-
33
28
  # @param [String] layout_identifier The layout identifier for which no
34
29
  # layout could be found
35
30
  def initialize(layout_identifier)
36
31
  super("The site does not have a layout with identifier “#{layout_identifier}”.")
37
32
  end
38
-
39
33
  end
40
34
 
41
35
  # Error that is raised during site compilation when an item uses a filter
42
36
  # that is not known.
43
37
  class UnknownFilter < Generic
44
-
45
38
  # @param [Symbol] filter_name The filter name for which no filter could
46
39
  # be found
47
40
  def initialize(filter_name)
48
41
  super("The requested filter, “#{filter_name}”, does not exist.")
49
42
  end
50
-
51
43
  end
52
44
 
53
45
  # Error that is raised during site compilation when a layout is compiled
54
46
  # for which the filter cannot be determined. This is similar to the
55
47
  # {UnknownFilter} error, but specific for filters for layouts.
56
48
  class CannotDetermineFilter < Generic
57
-
58
49
  # @param [String] layout_identifier The identifier of the layout for
59
50
  # which the filter could not be determined
60
51
  def initialize(layout_identifier)
61
52
  super("The filter to be used for the “#{layout_identifier}” layout could not be determined. Make sure the layout does have a filter.")
62
53
  end
63
-
64
54
  end
65
55
 
66
56
  # Error that is raised during site compilation when an item (directly or
67
57
  # indirectly) includes its own item content, leading to endless recursion.
68
58
  class RecursiveCompilation < Generic
69
-
70
59
  # @param [Array<Nanoc::ItemRep>] reps A list of item representations
71
60
  # that mutually depend on each other
72
61
  def initialize(reps)
73
- list = reps.map { |r| r.inspect }.join("\n")
62
+ list = reps.map(&:inspect).join("\n")
74
63
  super("The site cannot be compiled because the following items mutually depend on each other:\n#{list}.")
75
64
  end
76
-
77
65
  end
78
66
 
79
67
  # Error that is raised when no rules file can be found in the current
80
68
  # working directory.
81
69
  class NoRulesFileFound < Generic
82
-
83
70
  def initialize
84
71
  super('This site does not have a rules file, which is required for nanoc sites.')
85
72
  end
86
-
87
73
  end
88
74
 
89
75
  # Error that is raised when no compilation rule that can be applied to the
90
76
  # current item can be found.
91
77
  class NoMatchingCompilationRuleFound < Generic
92
-
93
78
  # @param [Nanoc::Item] item The item for which no compilation rule
94
79
  # could be found
95
80
  def initialize(item)
96
81
  super("No compilation rules were found for the “#{item.identifier}” item.")
97
82
  end
98
-
99
83
  end
100
84
 
101
85
  # Error that is raised when no routing rule that can be applied to the
102
86
  # current item can be found.
103
87
  class NoMatchingRoutingRuleFound < Generic
104
-
105
88
  # @param [Nanoc::ItemRep] rep The item repiresentation for which no
106
89
  # routing rule could be found
107
90
  def initialize(rep)
108
91
  super("No routing rules were found for the “#{rep.item.identifier}” item (rep “#{rep.name}”).")
109
92
  end
110
-
111
93
  end
112
94
 
113
95
  # Error that is raised when an rep cannot be compiled because it depends
114
96
  # on other representations.
115
97
  class UnmetDependency < Generic
116
-
117
98
  # @return [Nanoc::ItemRep] The item representation that cannot yet be
118
99
  # compiled
119
100
  attr_reader :rep
@@ -124,24 +105,20 @@ module Nanoc
124
105
  @rep = rep
125
106
  super("The current item cannot be compiled yet because of an unmet dependency on the “#{rep.item.identifier}” item (rep “#{rep.name}”).")
126
107
  end
127
-
128
108
  end
129
109
 
130
110
  # Error that is raised when a binary item is attempted to be laid out.
131
111
  class CannotLayoutBinaryItem < Generic
132
-
133
112
  # @param [Nanoc::ItemRep] rep The item representation that was attempted
134
113
  # to be laid out
135
114
  def initialize(rep)
136
115
  super("The “{rep.item.identifier}” item (rep “#{rep.name}”) cannot be laid out because it is a binary item. If you are getting this error for an item that should be textual instead of binary, make sure that its extension is included in the text_extensions array in the site configuration.")
137
116
  end
138
-
139
117
  end
140
118
 
141
119
  # Error that is raised when a textual filter is attempted to be applied to
142
120
  # a binary item representation.
143
121
  class CannotUseTextualFilter < Generic
144
-
145
122
  # @param [Nanoc::ItemRep] rep The item representation that was
146
123
  # attempted to be filtered
147
124
  #
@@ -149,13 +126,11 @@ module Nanoc
149
126
  def initialize(rep, filter_class)
150
127
  super("The “#{filter_class.inspect}” filter cannot be used to filter the “#{rep.item.identifier}” item (rep “#{rep.name}”), because textual filters cannot be used on binary items.")
151
128
  end
152
-
153
129
  end
154
130
 
155
131
  # Error that is raised when a binary filter is attempted to be applied to
156
132
  # a textual item representation.
157
133
  class CannotUseBinaryFilter < Generic
158
-
159
134
  # @param [Nanoc::ItemRep] rep The item representation that was
160
135
  # attempted to be filtered
161
136
  #
@@ -163,13 +138,11 @@ module Nanoc
163
138
  def initialize(rep, filter_class)
164
139
  super("The “#{filter_class.inspect}” filter cannot be used to filter the “#{rep.item.identifier}” item (rep “#{rep.name}”), because binary filters cannot be used on textual items. If you are getting this error for an item that should be textual instead of binary, make sure that its extension is included in the text_extensions array in the site configuration.")
165
140
  end
166
-
167
141
  end
168
142
 
169
143
  # Error that is raised when the compiled content at a non-existing snapshot
170
144
  # is requested.
171
145
  class NoSuchSnapshot < Generic
172
-
173
146
  # @return [Nanoc::ItemRep] The item rep from which the compiled content
174
147
  # was requested
175
148
  attr_reader :item_rep
@@ -185,12 +158,10 @@ module Nanoc
185
158
  @item_rep, @snapshot = item_rep, snapshot
186
159
  super("The “#{item_rep.inspect}” item rep does not have a snapshot “#{snapshot.inspect}”")
187
160
  end
188
-
189
161
  end
190
162
 
191
163
  # Error that is raised when a snapshot with an existing name is made.
192
164
  class CannotCreateMultipleSnapshotsWithSameName < Generic
193
-
194
165
  # @param [Nanoc::ItemRep] rep The item representation for which a
195
166
  # snapshot was attempted to be made
196
167
  #
@@ -199,37 +170,28 @@ module Nanoc
199
170
  def initialize(rep, snapshot)
200
171
  super("Attempted to create a snapshot with a duplicate name #{snapshot.inspect} for the item rep “#{rep.inspect}”")
201
172
  end
202
-
203
173
  end
204
174
 
205
175
  # Error that is raised when the compiled content of a binary item is attempted to be accessed.
206
176
  class CannotGetCompiledContentOfBinaryItem < Generic
207
-
208
177
  # @param [Nanoc::ItemRep] rep The binary item representation whose compiled content was attempted to be accessed
209
178
  def initialize(rep)
210
179
  super("You cannot access the compiled content of a binary item representation (but you can access the path). The offending item rep is #{rep.inspect}.")
211
180
  end
212
-
213
181
  end
214
182
 
215
183
  # @deprecated No longer necessary, but kept for backwards compatibility.
216
184
  class DataNotYetAvailable < Generic
217
-
218
185
  def initialize(type, plural)
219
186
  super("#{type} #{plural ? 'are' : 'is'} not available yet. You may be missing a Nanoc::Site#load_data call.")
220
187
  end
221
-
222
188
  end
223
189
 
224
190
  # Error that is raised when multiple items or layouts with the same identifier exist.
225
191
  class DuplicateIdentifier < Generic
226
-
227
192
  def initialize(identifier, type)
228
193
  super("There are multiple #{type}s with the #{identifier} identifier.")
229
194
  end
230
-
231
195
  end
232
-
233
196
  end
234
-
235
197
  end
@@ -1,12 +1,10 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module Nanoc
4
-
5
4
  # Adds support for memoizing functions.
6
5
  #
7
6
  # @since 3.2.0
8
7
  module Memoization
9
-
10
8
  # Memoizes the method with the given name. The modified method will cache
11
9
  # the results of the original method, so that calling a method twice with
12
10
  # the same arguments will short-circuit and return the cached results
@@ -61,7 +59,5 @@ module Nanoc
61
59
  @__memoization_cache[method_name][args]
62
60
  end
63
61
  end
64
-
65
62
  end
66
-
67
63
  end
@@ -1,7 +1,6 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module Nanoc
4
-
5
4
  # Provides a way to send notifications between objects. It allows blocks
6
5
  # associated with a certain notification name to be registered; these blocks
7
6
  # will be called when the notification with the given name is posted.
@@ -10,9 +9,7 @@ module Nanoc
10
9
  # table of subscribers is not stored in the observable object itself, but in
11
10
  # the notification center.
12
11
  class NotificationCenter
13
-
14
12
  class << self
15
-
16
13
  # Adds the given block to the list of blocks that should be called when
17
14
  # the notification with the given name is received.
18
15
  #
@@ -31,7 +28,7 @@ module Nanoc
31
28
  initialize_if_necessary(name)
32
29
 
33
30
  # Add observer
34
- @notifications[name] << { :id => id, :block => block }
31
+ @notifications[name] << { id: id, block: block }
35
32
  end
36
33
 
37
34
  # Posts a notification with the given name and the given arguments.
@@ -76,9 +73,6 @@ module Nanoc
76
73
  @notifications ||= {} # name => observers dictionary
77
74
  @notifications[name] ||= [] # list of observers
78
75
  end
79
-
80
76
  end
81
-
82
77
  end
83
-
84
78
  end
@@ -1,19 +1,16 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module Nanoc
4
-
5
4
  # The class responsible for keeping track of all loaded plugins, such as
6
5
  # filters ({Nanoc::Filter}), data sources ({Nanoc::DataSource}) and VCSes
7
6
  # ({Nanoc::Extra::VCS}).
8
7
  class PluginRegistry
9
-
10
8
  extend Nanoc::Memoization
11
9
 
12
10
  # A module that contains class methods for plugins. It provides functions
13
11
  # for setting identifiers, registering plugins and finding plugins. Plugin
14
12
  # classes should extend this module.
15
13
  module PluginMethods
16
-
17
14
  # @overload identifiers(*identifiers)
18
15
  #
19
16
  # Sets the identifiers for this plugin.
@@ -86,7 +83,6 @@ module Nanoc
86
83
  def named(name)
87
84
  Nanoc::Plugin.find(self, name)
88
85
  end
89
-
90
86
  end
91
87
 
92
88
  # Returns the shared {PluginRegistry} instance, creating it if none exists
@@ -182,13 +178,13 @@ module Nanoc
182
178
  if existing_plugin
183
179
  # Add identifier to existing plugin
184
180
  existing_plugin[:identifiers] << identifier
185
- existing_plugin[:identifiers] = existing_plugin[:identifiers].sort_by { |s| s.to_s }
181
+ existing_plugin[:identifiers] = existing_plugin[:identifiers].sort_by(&:to_s)
186
182
  else
187
183
  # Create new plugin
188
184
  plugins << {
189
- :class => klass,
190
- :superclass => superclass,
191
- :identifiers => [identifier]
185
+ class: klass,
186
+ superclass: superclass,
187
+ identifiers: [identifier]
192
188
  }
193
189
  end
194
190
  end
@@ -218,10 +214,8 @@ module Nanoc
218
214
  def name_for_class(klass)
219
215
  klass.to_s.sub(/^(::)?/, '::')
220
216
  end
221
-
222
217
  end
223
218
 
224
219
  # @deprecated Use {Nanoc::PluginRegistry.instance} instead
225
220
  Plugin = PluginRegistry.instance
226
-
227
221
  end
@@ -1,16 +1,13 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module Nanoc
4
-
5
4
  # A single representation (rep) of an item ({Nanoc::Item}). An item can
6
5
  # have multiple representations. A representation has its own output file.
7
6
  # A single item can therefore have multiple output files, each run through
8
7
  # a different set of filters with a different layout.
9
8
  class ItemRep
10
-
11
9
  # Contains all deprecated methods. Mixed into {Nanoc::ItemRep}.
12
10
  module Deprecated
13
-
14
11
  # @deprecated Modify the {#raw_paths} attribute instead
15
12
  def raw_path=(raw_path)
16
13
  raw_paths[:last] = raw_path
@@ -23,7 +20,7 @@ module Nanoc
23
20
 
24
21
  # @deprecated Use {Nanoc::ItemRep#compiled_content} instead.
25
22
  def content_at_snapshot(snapshot = :pre)
26
- compiled_content(:snapshot => snapshot)
23
+ compiled_content(snapshot: snapshot)
27
24
  end
28
25
 
29
26
  # @deprecated
@@ -55,12 +52,10 @@ module Nanoc
55
52
  def written?
56
53
  raise NotImplementedError, 'Nanoc::ItemRep#written? is no longer implemented'
57
54
  end
58
-
59
55
  end
60
56
 
61
57
  # Contains all private methods. Mixed into {Nanoc::ItemRep}.
62
58
  module Private
63
-
64
59
  # @return [Hash] A hash containing the assigns that will be used in the
65
60
  # next filter or layout operation. The keys (symbols) will be made
66
61
  # available during the next operation.
@@ -120,7 +115,7 @@ module Nanoc
120
115
  # @return [void]
121
116
  def write(snapshot = :last)
122
117
  # Get raw path
123
- raw_path = self.raw_path(:snapshot => snapshot)
118
+ raw_path = self.raw_path(snapshot: snapshot)
124
119
  return if raw_path.nil?
125
120
 
126
121
  # Create parent directory
@@ -175,7 +170,6 @@ module Nanoc
175
170
  def type
176
171
  :item_rep
177
172
  end
178
-
179
173
  end
180
174
 
181
175
  include Deprecated
@@ -352,7 +346,7 @@ module Nanoc
352
346
  end
353
347
 
354
348
  # Create snapshot
355
- snapshot(@content[:post] ? :post : :pre, :final => false) unless self.binary?
349
+ snapshot(@content[:post] ? :post : :pre, final: false) unless self.binary?
356
350
  ensure
357
351
  # Notify end
358
352
  Nanoc::NotificationCenter.post(:filtering_ended, self, filter_name)
@@ -383,13 +377,13 @@ module Nanoc
383
377
 
384
378
  # Create "pre" snapshot
385
379
  if @content[:post].nil?
386
- snapshot(:pre, :final => true)
380
+ snapshot(:pre, final: true)
387
381
  end
388
382
 
389
383
  # Create filter
390
384
  klass = filter_named(filter_name)
391
385
  raise Nanoc::Errors::UnknownFilter.new(filter_name) if klass.nil?
392
- filter = klass.new(assigns.merge({ :layout => layout }))
386
+ filter = klass.new(assigns.merge({ layout: layout }))
393
387
 
394
388
  # Visit
395
389
  Nanoc::NotificationCenter.post(:visit_started, layout)
@@ -404,7 +398,7 @@ module Nanoc
404
398
  @content[:last] = filter.setup_and_run(layout.raw_content, filter_args)
405
399
 
406
400
  # Create "post" snapshot
407
- snapshot(:post, :final => false)
401
+ snapshot(:post, final: false)
408
402
  ensure
409
403
  # Notify end
410
404
  Nanoc::NotificationCenter.post(:filtering_ended, self, filter_name)
@@ -470,10 +464,10 @@ module Nanoc
470
464
  def initialize_content
471
465
  # Initialize content and filenames
472
466
  if self.binary?
473
- @temporary_filenames = { :last => @item.raw_filename }
467
+ @temporary_filenames = { last: @item.raw_filename }
474
468
  @content = {}
475
469
  else
476
- @content = { :last => @item.raw_content }
470
+ @content = { last: @item.raw_content }
477
471
  @content[:last].freeze
478
472
  @temporary_filenames = {}
479
473
  end
@@ -482,7 +476,5 @@ module Nanoc
482
476
  def filter_named(name)
483
477
  Nanoc::Filter.named(name)
484
478
  end
485
-
486
479
  end
487
-
488
480
  end