nanoc 3.8.0 → 4.0.0a1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (236) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -0
  3. data/Gemfile.lock +322 -0
  4. data/NEWS.md +6 -0
  5. data/bin/nanoc +0 -18
  6. data/lib/nanoc.rb +5 -3
  7. data/lib/nanoc/base.rb +24 -6
  8. data/lib/nanoc/base/checksummer.rb +6 -4
  9. data/lib/nanoc/base/compilation/checksum_store.rb +4 -4
  10. data/lib/nanoc/base/compilation/compiled_content_cache.rb +5 -5
  11. data/lib/nanoc/base/compilation/compiler.rb +60 -65
  12. data/lib/nanoc/base/compilation/compiler_dsl.rb +11 -9
  13. data/lib/nanoc/base/compilation/dependency_tracker.rb +24 -38
  14. data/lib/nanoc/base/compilation/filter.rb +22 -7
  15. data/lib/nanoc/base/compilation/item_rep_proxy.rb +14 -12
  16. data/lib/nanoc/base/compilation/item_rep_recorder_proxy.rb +8 -8
  17. data/lib/nanoc/base/compilation/outdatedness_checker.rb +32 -32
  18. data/lib/nanoc/base/compilation/outdatedness_reasons.rb +3 -1
  19. data/lib/nanoc/base/compilation/rule.rb +9 -7
  20. data/lib/nanoc/base/compilation/rule_context.rb +15 -15
  21. data/lib/nanoc/base/compilation/rule_memory_calculator.rb +3 -3
  22. data/lib/nanoc/base/compilation/rule_memory_store.rb +7 -7
  23. data/lib/nanoc/base/compilation/rules_collection.rb +28 -30
  24. data/lib/nanoc/base/context.rb +2 -2
  25. data/lib/nanoc/base/core_ext/array.rb +17 -25
  26. data/lib/nanoc/base/core_ext/hash.rb +17 -25
  27. data/lib/nanoc/base/core_ext/pathname.rb +4 -2
  28. data/lib/nanoc/base/core_ext/string.rb +5 -3
  29. data/lib/nanoc/base/directed_graph.rb +4 -9
  30. data/lib/nanoc/base/error.rb +7 -0
  31. data/lib/nanoc/base/errors.rb +16 -23
  32. data/lib/nanoc/base/memoization.rb +4 -2
  33. data/lib/nanoc/base/notification_center.rb +3 -1
  34. data/lib/nanoc/base/plugin_registry.rb +14 -21
  35. data/lib/nanoc/base/result_data/item_rep.rb +43 -88
  36. data/lib/nanoc/base/source_data/code_snippet.rb +6 -4
  37. data/lib/nanoc/base/source_data/configuration.rb +3 -1
  38. data/lib/nanoc/base/source_data/data_source.rb +12 -94
  39. data/lib/nanoc/base/source_data/identifier.rb +50 -0
  40. data/lib/nanoc/base/source_data/item.rb +24 -67
  41. data/lib/nanoc/base/source_data/item_array.rb +6 -4
  42. data/lib/nanoc/base/source_data/layout.rb +17 -28
  43. data/lib/nanoc/base/source_data/site.rb +33 -44
  44. data/lib/nanoc/base/store.rb +3 -5
  45. data/lib/nanoc/base/temp_filename_factory.rb +3 -2
  46. data/lib/nanoc/base/views/config.rb +19 -0
  47. data/lib/nanoc/base/views/item.rb +77 -0
  48. data/lib/nanoc/base/views/item_collection.rb +43 -0
  49. data/lib/nanoc/base/views/item_rep.rb +125 -0
  50. data/lib/nanoc/base/views/layout.rb +42 -0
  51. data/lib/nanoc/base/views/layout_collection.rb +26 -0
  52. data/lib/nanoc/base/views/mutable_config.rb +9 -0
  53. data/lib/nanoc/base/views/mutable_item.rb +9 -0
  54. data/lib/nanoc/base/views/mutable_item_collection.rb +18 -0
  55. data/lib/nanoc/base/views/mutable_layout.rb +9 -0
  56. data/lib/nanoc/base/views/mutable_layout_collection.rb +18 -0
  57. data/lib/nanoc/base/views/site.rb +35 -0
  58. data/lib/nanoc/cli.rb +3 -6
  59. data/lib/nanoc/cli/ansi_string_colorizer.rb +2 -0
  60. data/lib/nanoc/cli/cleaning_stream.rb +2 -0
  61. data/lib/nanoc/cli/command_runner.rb +8 -42
  62. data/lib/nanoc/cli/commands/check.rb +2 -2
  63. data/lib/nanoc/cli/commands/compile.rb +19 -34
  64. data/lib/nanoc/cli/commands/create-site.rb +46 -83
  65. data/lib/nanoc/cli/commands/deploy.rb +4 -4
  66. data/lib/nanoc/cli/commands/shell.rb +1 -1
  67. data/lib/nanoc/cli/commands/show-plugins.rb +4 -6
  68. data/lib/nanoc/cli/error_handler.rb +4 -14
  69. data/lib/nanoc/cli/logger.rb +2 -0
  70. data/lib/nanoc/cli/stream_cleaners.rb +1 -0
  71. data/lib/nanoc/cli/stream_cleaners/abstract.rb +2 -0
  72. data/lib/nanoc/cli/stream_cleaners/ansi_colors.rb +2 -0
  73. data/lib/nanoc/cli/stream_cleaners/utf8.rb +2 -0
  74. data/lib/nanoc/data_sources.rb +1 -17
  75. data/lib/nanoc/data_sources/filesystem.rb +6 -37
  76. data/lib/nanoc/data_sources/filesystem_unified.rb +5 -3
  77. data/lib/nanoc/data_sources/filesystem_verbose.rb +5 -3
  78. data/lib/nanoc/data_sources/static.rb +4 -2
  79. data/lib/nanoc/extra.rb +1 -13
  80. data/lib/nanoc/extra/checking.rb +1 -0
  81. data/lib/nanoc/extra/checking/check.rb +4 -2
  82. data/lib/nanoc/extra/checking/checks.rb +1 -0
  83. data/lib/nanoc/extra/checking/checks/css.rb +1 -0
  84. data/lib/nanoc/extra/checking/checks/external_links.rb +2 -0
  85. data/lib/nanoc/extra/checking/checks/html.rb +1 -0
  86. data/lib/nanoc/extra/checking/checks/internal_links.rb +2 -0
  87. data/lib/nanoc/extra/checking/checks/mixed_content.rb +2 -0
  88. data/lib/nanoc/extra/checking/checks/stale.rb +1 -0
  89. data/lib/nanoc/extra/checking/dsl.rb +1 -0
  90. data/lib/nanoc/extra/checking/issue.rb +1 -0
  91. data/lib/nanoc/extra/checking/runner.rb +3 -3
  92. data/lib/nanoc/extra/core_ext/pathname.rb +5 -3
  93. data/lib/nanoc/extra/core_ext/time.rb +4 -2
  94. data/lib/nanoc/extra/deployer.rb +3 -1
  95. data/lib/nanoc/extra/deployers.rb +1 -0
  96. data/lib/nanoc/extra/deployers/fog.rb +2 -0
  97. data/lib/nanoc/extra/deployers/rsync.rb +2 -0
  98. data/lib/nanoc/extra/filesystem_tools.rb +3 -7
  99. data/lib/nanoc/extra/jruby_nokogiri_warner.rb +1 -0
  100. data/lib/nanoc/extra/link_collector.rb +1 -0
  101. data/lib/nanoc/extra/piper.rb +2 -1
  102. data/lib/nanoc/extra/pruner.rb +5 -3
  103. data/lib/nanoc/filters.rb +1 -2
  104. data/lib/nanoc/filters/asciidoc.rb +2 -0
  105. data/lib/nanoc/filters/bluecloth.rb +1 -0
  106. data/lib/nanoc/filters/coffeescript.rb +2 -0
  107. data/lib/nanoc/filters/colorize_syntax.rb +1 -12
  108. data/lib/nanoc/filters/erb.rb +2 -1
  109. data/lib/nanoc/filters/erubis.rb +2 -1
  110. data/lib/nanoc/filters/haml.rb +2 -1
  111. data/lib/nanoc/filters/handlebars.rb +2 -0
  112. data/lib/nanoc/filters/kramdown.rb +1 -0
  113. data/lib/nanoc/filters/less.rb +1 -0
  114. data/lib/nanoc/filters/markaby.rb +1 -0
  115. data/lib/nanoc/filters/maruku.rb +1 -0
  116. data/lib/nanoc/filters/mustache.rb +2 -0
  117. data/lib/nanoc/filters/pandoc.rb +1 -0
  118. data/lib/nanoc/filters/rainpress.rb +1 -0
  119. data/lib/nanoc/filters/rdiscount.rb +1 -0
  120. data/lib/nanoc/filters/rdoc.rb +1 -0
  121. data/lib/nanoc/filters/redcarpet.rb +2 -0
  122. data/lib/nanoc/filters/redcloth.rb +1 -0
  123. data/lib/nanoc/filters/relativize_paths.rb +1 -0
  124. data/lib/nanoc/filters/rubypants.rb +1 -0
  125. data/lib/nanoc/filters/sass.rb +1 -0
  126. data/lib/nanoc/filters/sass/sass_filesystem_importer.rb +2 -0
  127. data/lib/nanoc/filters/slim.rb +3 -1
  128. data/lib/nanoc/filters/typogruby.rb +2 -0
  129. data/lib/nanoc/filters/uglify_js.rb +1 -0
  130. data/lib/nanoc/filters/xsl.rb +2 -0
  131. data/lib/nanoc/filters/yui_compressor.rb +2 -0
  132. data/lib/nanoc/helpers/blogging.rb +30 -30
  133. data/lib/nanoc/helpers/breadcrumbs.rb +2 -2
  134. data/lib/nanoc/helpers/capturing.rb +6 -17
  135. data/lib/nanoc/helpers/filtering.rb +3 -3
  136. data/lib/nanoc/helpers/link_to.rb +3 -3
  137. data/lib/nanoc/helpers/rendering.rb +11 -11
  138. data/lib/nanoc/helpers/xml_sitemap.rb +3 -3
  139. data/lib/nanoc/tasks.rb +1 -0
  140. data/lib/nanoc/tasks/clean.rake +1 -1
  141. data/lib/nanoc/version.rb +1 -1
  142. data/tasks/doc.rake +2 -1
  143. data/tasks/test.rake +7 -1
  144. data/test/base/checksummer_spec.rb +15 -15
  145. data/test/base/core_ext/array_spec.rb +10 -10
  146. data/test/base/core_ext/hash_spec.rb +16 -16
  147. data/test/base/core_ext/pathname_spec.rb +2 -2
  148. data/test/base/core_ext/string_spec.rb +9 -9
  149. data/test/base/temp_filename_factory_spec.rb +3 -7
  150. data/test/base/test_checksum_store.rb +5 -5
  151. data/test/base/test_code_snippet.rb +3 -3
  152. data/test/base/test_compiler.rb +29 -29
  153. data/test/base/test_compiler_dsl.rb +23 -23
  154. data/test/base/test_context.rb +4 -4
  155. data/test/base/test_data_source.rb +17 -7
  156. data/test/base/test_dependency_tracker.rb +29 -29
  157. data/test/base/test_directed_graph.rb +27 -27
  158. data/test/base/test_item.rb +23 -21
  159. data/test/base/test_item_array.rb +18 -18
  160. data/test/base/test_item_rep.rb +76 -76
  161. data/test/base/test_item_rep_recorder_proxy.rb +4 -4
  162. data/test/base/test_layout.rb +8 -16
  163. data/test/base/test_memoization.rb +4 -4
  164. data/test/base/test_notification_center.rb +6 -6
  165. data/test/base/test_outdatedness_checker.rb +18 -18
  166. data/test/base/test_plugin.rb +1 -1
  167. data/test/base/test_rule.rb +2 -2
  168. data/test/base/test_rule_context.rb +5 -5
  169. data/test/base/test_site.rb +62 -38
  170. data/test/base/test_store.rb +2 -2
  171. data/test/cli/commands/test_check.rb +1 -1
  172. data/test/cli/commands/test_compile.rb +24 -18
  173. data/test/cli/commands/test_create_site.rb +5 -7
  174. data/test/cli/commands/test_deploy.rb +1 -1
  175. data/test/data_sources/test_filesystem.rb +22 -67
  176. data/test/data_sources/test_filesystem_unified.rb +10 -23
  177. data/test/data_sources/test_filesystem_verbose.rb +8 -53
  178. data/test/data_sources/test_static.rb +9 -9
  179. data/test/extra/checking/checks/test_stale.rb +1 -1
  180. data/test/extra/core_ext/test_pathname.rb +3 -3
  181. data/test/extra/core_ext/test_time.rb +4 -4
  182. data/test/extra/test_filesystem_tools.rb +1 -1
  183. data/test/filters/test_handlebars.rb +3 -3
  184. data/test/filters/test_less.rb +6 -6
  185. data/test/filters/test_mustache.rb +2 -2
  186. data/test/filters/test_relativize_paths.rb +81 -81
  187. data/test/filters/test_sass.rb +7 -7
  188. data/test/filters/test_xsl.rb +6 -6
  189. data/test/helper.rb +1 -1
  190. data/test/helpers/test_blogging.rb +78 -99
  191. data/test/helpers/test_breadcrumbs.rb +12 -12
  192. data/test/helpers/test_capturing.rb +10 -11
  193. data/test/helpers/test_filtering.rb +6 -6
  194. data/test/helpers/test_rendering.rb +3 -3
  195. data/test/helpers/test_tagging.rb +7 -7
  196. data/test/helpers/test_xml_sitemap.rb +34 -33
  197. metadata +19 -43
  198. data/lib/nanoc/cli/commands/autocompile.rb +0 -69
  199. data/lib/nanoc/cli/commands/create-item.rb +0 -55
  200. data/lib/nanoc/cli/commands/create-layout.rb +0 -68
  201. data/lib/nanoc/cli/commands/sync.rb +0 -32
  202. data/lib/nanoc/cli/commands/update.rb +0 -63
  203. data/lib/nanoc/cli/commands/validate-css.rb +0 -20
  204. data/lib/nanoc/cli/commands/validate-html.rb +0 -20
  205. data/lib/nanoc/cli/commands/validate-links.rb +0 -27
  206. data/lib/nanoc/cli/commands/watch.rb +0 -176
  207. data/lib/nanoc/data_sources/deprecated/delicious.rb +0 -38
  208. data/lib/nanoc/data_sources/deprecated/last_fm.rb +0 -85
  209. data/lib/nanoc/data_sources/deprecated/twitter.rb +0 -34
  210. data/lib/nanoc/extra/auto_compiler.rb +0 -99
  211. data/lib/nanoc/extra/chick.rb +0 -117
  212. data/lib/nanoc/extra/file_proxy.rb +0 -36
  213. data/lib/nanoc/extra/validators.rb +0 -8
  214. data/lib/nanoc/extra/validators/links.rb +0 -18
  215. data/lib/nanoc/extra/validators/w3c.rb +0 -23
  216. data/lib/nanoc/extra/vcs.rb +0 -62
  217. data/lib/nanoc/extra/vcses.rb +0 -15
  218. data/lib/nanoc/extra/vcses/bazaar.rb +0 -21
  219. data/lib/nanoc/extra/vcses/dummy.rb +0 -20
  220. data/lib/nanoc/extra/vcses/git.rb +0 -21
  221. data/lib/nanoc/extra/vcses/mercurial.rb +0 -21
  222. data/lib/nanoc/extra/vcses/subversion.rb +0 -21
  223. data/lib/nanoc/filters/coderay.rb +0 -19
  224. data/lib/nanoc3.rb +0 -3
  225. data/lib/nanoc3/cli.rb +0 -3
  226. data/lib/nanoc3/tasks.rb +0 -3
  227. data/test/cli/commands/test_create_item.rb +0 -10
  228. data/test/cli/commands/test_create_layout.rb +0 -24
  229. data/test/cli/commands/test_sync.rb +0 -27
  230. data/test/cli/commands/test_update.rb +0 -6
  231. data/test/cli/commands/test_watch.rb +0 -74
  232. data/test/extra/test_auto_compiler.rb +0 -437
  233. data/test/extra/test_vcs.rb +0 -18
  234. data/test/extra/validators/test_links.rb +0 -4
  235. data/test/extra/validators/test_w3c.rb +0 -37
  236. data/test/filters/test_coderay.rb +0 -40
@@ -1,57 +1,48 @@
1
1
  # encoding: utf-8
2
2
 
3
+ # @api private
3
4
  module Nanoc::HashExtensions
4
5
  # Returns a new hash where all keys are recursively converted to symbols by
5
- # calling {Nanoc::ArrayExtensions#symbolize_keys_recursively} or
6
- # {Nanoc::HashExtensions#symbolize_keys_recursively}.
6
+ # calling {Nanoc::ArrayExtensions#__nanoc_symbolize_keys_recursively} or
7
+ # {Nanoc::HashExtensions#__nanoc_symbolize_keys_recursively}.
7
8
  #
8
9
  # @return [Hash] The converted hash
9
- def symbolize_keys_recursively
10
+ def __nanoc_symbolize_keys_recursively
10
11
  hash = {}
11
12
  each_pair do |key, value|
12
13
  new_key = key.respond_to?(:to_sym) ? key.to_sym : key
13
- new_value = value.respond_to?(:symbolize_keys_recursively) ? value.symbolize_keys_recursively : value
14
+ new_value = value.respond_to?(:__nanoc_symbolize_keys_recursively) ? value.__nanoc_symbolize_keys_recursively : value
14
15
  hash[new_key] = new_value
15
16
  end
16
17
  hash
17
18
  end
18
19
 
19
- # @deprecated Renamed to {#symbolize_keys_recursively}
20
- def symbolize_keys
21
- symbolize_keys_recursively
22
- end
23
-
24
20
  # Returns a new hash where all keys are recursively converted to strings by
25
- # calling {Nanoc::ArrayExtensions#stringify_keys_recursively} or
26
- # {Nanoc::HashExtensions#stringify_keys_recursively}.
21
+ # calling {Nanoc::ArrayExtensions#__nanoc_stringify_keys_recursively} or
22
+ # {Nanoc::HashExtensions#__nanoc_stringify_keys_recursively}.
27
23
  #
28
24
  # @return [Hash] The converted hash
29
- def stringify_keys_recursively
25
+ def __nanoc_stringify_keys_recursively
30
26
  reduce({}) do |hash, (key, value)|
31
- hash.merge(key.to_s => value.respond_to?(:stringify_keys_recursively) ? value.stringify_keys_recursively : value)
27
+ hash.merge(key.to_s => value.respond_to?(:__nanoc_stringify_keys_recursively) ? value.__nanoc_stringify_keys_recursively : value)
32
28
  end
33
29
  end
34
30
 
35
- # @deprecated Renamed to {#stringify_keys_recursively}
36
- def stringify_keys
37
- stringify_keys_recursively
38
- end
39
-
40
31
  # Freezes the contents of the hash, as well as all hash values. The hash
41
- # values will be frozen using {#freeze_recursively} if they respond to
32
+ # values will be frozen using {#__nanoc_freeze_recursively} if they respond to
42
33
  # that message, or #freeze if they do not.
43
34
  #
44
- # @see Array#freeze_recursively
35
+ # @see Array#__nanoc_freeze_recursively
45
36
  #
46
37
  # @return [void]
47
38
  #
48
39
  # @since 3.2.0
49
- def freeze_recursively
40
+ def __nanoc_freeze_recursively
50
41
  return if self.frozen?
51
42
  freeze
52
43
  each_pair do |_key, value|
53
- if value.respond_to?(:freeze_recursively)
54
- value.freeze_recursively
44
+ if value.respond_to?(:__nanoc_freeze_recursively)
45
+ value.__nanoc_freeze_recursively
55
46
  else
56
47
  value.freeze
57
48
  end
@@ -64,11 +55,12 @@ module Nanoc::HashExtensions
64
55
  # @return [String] The checksum for this hash
65
56
  #
66
57
  # @api private
67
- def checksum
68
- Nanoc::Checksummer.calc(self)
58
+ def __nanoc_checksum
59
+ Nanoc::Int::Checksummer.calc(self)
69
60
  end
70
61
  end
71
62
 
63
+ # @api private
72
64
  class Hash
73
65
  include Nanoc::HashExtensions
74
66
  end
@@ -1,5 +1,6 @@
1
1
  # encoding: utf-8
2
2
 
3
+ # @api private
3
4
  module Nanoc::PathnameExtensions
4
5
  # Calculates the checksum for the file referenced to by this pathname. Any
5
6
  # change to the file contents will result in a different checksum.
@@ -7,11 +8,12 @@ module Nanoc::PathnameExtensions
7
8
  # @return [String] The checksum for this file
8
9
  #
9
10
  # @api private
10
- def checksum
11
- Nanoc::Checksummer.calc(self)
11
+ def __nanoc_checksum
12
+ Nanoc::Int::Checksummer.calc(self)
12
13
  end
13
14
  end
14
15
 
16
+ # @api private
15
17
  class Pathname
16
18
  include Nanoc::PathnameExtensions
17
19
  end
@@ -1,10 +1,11 @@
1
1
  # encoding: utf-8
2
2
 
3
+ # @api private
3
4
  module Nanoc::StringExtensions
4
5
  # Transforms string into an actual identifier
5
6
  #
6
7
  # @return [String] The identifier generated from the receiver
7
- def cleaned_identifier
8
+ def __nanoc_cleaned_identifier
8
9
  "/#{self}/".gsub(/^\/+|\/+$/, '/')
9
10
  end
10
11
 
@@ -14,11 +15,12 @@ module Nanoc::StringExtensions
14
15
  # @return [String] The checksum for this string
15
16
  #
16
17
  # @api private
17
- def checksum
18
- Nanoc::Checksummer.calc(self)
18
+ def __nanoc_checksum
19
+ Nanoc::Int::Checksummer.calc(self)
19
20
  end
20
21
  end
21
22
 
23
+ # @api private
22
24
  class String
23
25
  include Nanoc::StringExtensions
24
26
  end
@@ -1,13 +1,13 @@
1
1
  # encoding: utf-8
2
2
 
3
- module Nanoc
3
+ module Nanoc::Int
4
4
  # Represents a directed graph. It is used by the dependency tracker for
5
5
  # storing and querying dependencies between items.
6
6
  #
7
7
  # @example Creating and using a directed graph
8
8
  #
9
9
  # # Create a graph with three vertices
10
- # graph = Nanoc::DirectedGraph.new(%w( a b c d ))
10
+ # graph = Nanoc::Int::DirectedGraph.new(%w( a b c d ))
11
11
  #
12
12
  # # Add edges
13
13
  # graph.add_edge('a', 'b')
@@ -28,6 +28,8 @@ module Nanoc
28
28
  # # => %w( c )
29
29
  # graph.predecessors_of('d').sort
30
30
  # # => %w( b c )
31
+ #
32
+ # @api private
31
33
  class DirectedGraph
32
34
  # @group Creating a graph
33
35
 
@@ -224,13 +226,6 @@ module Nanoc
224
226
  @roots
225
227
  end
226
228
 
227
- # @group Deprecated methods
228
-
229
- # @deprecated Use {#delete_edge} instead
230
- def remove_edge(from, to)
231
- delete_edge(from, to)
232
- end
233
-
234
229
  private
235
230
 
236
231
  # Invalidates cached data. This method should be called when the internal
@@ -0,0 +1,7 @@
1
+ # encoding: utf-8
2
+
3
+ module Nanoc
4
+ # Generic error. Superclass for all nanoc-specific errors.
5
+ class Error < ::StandardError
6
+ end
7
+ end
@@ -1,11 +1,11 @@
1
1
  # encoding: utf-8
2
2
 
3
- module Nanoc
3
+ module Nanoc::Int
4
4
  # Module that contains all nanoc-specific errors.
5
+ #
6
+ # @api private
5
7
  module Errors
6
- # Generic error. Superclass for all nanoc-specific errors.
7
- class Generic < ::StandardError
8
- end
8
+ Generic = ::Nanoc::Error
9
9
 
10
10
  # Generic trivial error. Superclass for all nanoc-specific errors that are
11
11
  # considered "trivial", i.e. errors that do not require a full crash report.
@@ -56,7 +56,7 @@ module Nanoc
56
56
  # Error that is raised during site compilation when an item (directly or
57
57
  # indirectly) includes its own item content, leading to endless recursion.
58
58
  class RecursiveCompilation < Generic
59
- # @param [Array<Nanoc::ItemRep>] reps A list of item representations
59
+ # @param [Array<Nanoc::Int::ItemRep>] reps A list of item representations
60
60
  # that mutually depend on each other
61
61
  def initialize(reps)
62
62
  list = reps.map(&:inspect).join("\n")
@@ -75,7 +75,7 @@ module Nanoc
75
75
  # Error that is raised when no compilation rule that can be applied to the
76
76
  # current item can be found.
77
77
  class NoMatchingCompilationRuleFound < Generic
78
- # @param [Nanoc::Item] item The item for which no compilation rule
78
+ # @param [Nanoc::Int::Item] item The item for which no compilation rule
79
79
  # could be found
80
80
  def initialize(item)
81
81
  super("No compilation rules were found for the “#{item.identifier}” item.")
@@ -85,7 +85,7 @@ module Nanoc
85
85
  # Error that is raised when no routing rule that can be applied to the
86
86
  # current item can be found.
87
87
  class NoMatchingRoutingRuleFound < Generic
88
- # @param [Nanoc::ItemRep] rep The item repiresentation for which no
88
+ # @param [Nanoc::Int::ItemRep] rep The item repiresentation for which no
89
89
  # routing rule could be found
90
90
  def initialize(rep)
91
91
  super("No routing rules were found for the “#{rep.item.identifier}” item (rep “#{rep.name}”).")
@@ -95,11 +95,11 @@ module Nanoc
95
95
  # Error that is raised when an rep cannot be compiled because it depends
96
96
  # on other representations.
97
97
  class UnmetDependency < Generic
98
- # @return [Nanoc::ItemRep] The item representation that cannot yet be
98
+ # @return [Nanoc::Int::ItemRep] The item representation that cannot yet be
99
99
  # compiled
100
100
  attr_reader :rep
101
101
 
102
- # @param [Nanoc::ItemRep] rep The item representation that cannot yet be
102
+ # @param [Nanoc::Int::ItemRep] rep The item representation that cannot yet be
103
103
  # compiled
104
104
  def initialize(rep)
105
105
  @rep = rep
@@ -109,7 +109,7 @@ module Nanoc
109
109
 
110
110
  # Error that is raised when a binary item is attempted to be laid out.
111
111
  class CannotLayoutBinaryItem < Generic
112
- # @param [Nanoc::ItemRep] rep The item representation that was attempted
112
+ # @param [Nanoc::Int::ItemRep] rep The item representation that was attempted
113
113
  # to be laid out
114
114
  def initialize(rep)
115
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.")
@@ -119,7 +119,7 @@ module Nanoc
119
119
  # Error that is raised when a textual filter is attempted to be applied to
120
120
  # a binary item representation.
121
121
  class CannotUseTextualFilter < Generic
122
- # @param [Nanoc::ItemRep] rep The item representation that was
122
+ # @param [Nanoc::Int::ItemRep] rep The item representation that was
123
123
  # attempted to be filtered
124
124
  #
125
125
  # @param [Class] filter_class The filter class that was used
@@ -131,7 +131,7 @@ module Nanoc
131
131
  # Error that is raised when a binary filter is attempted to be applied to
132
132
  # a textual item representation.
133
133
  class CannotUseBinaryFilter < Generic
134
- # @param [Nanoc::ItemRep] rep The item representation that was
134
+ # @param [Nanoc::Int::ItemRep] rep The item representation that was
135
135
  # attempted to be filtered
136
136
  #
137
137
  # @param [Class] filter_class The filter class that was used
@@ -143,14 +143,14 @@ module Nanoc
143
143
  # Error that is raised when the compiled content at a non-existing snapshot
144
144
  # is requested.
145
145
  class NoSuchSnapshot < Generic
146
- # @return [Nanoc::ItemRep] The item rep from which the compiled content
146
+ # @return [Nanoc::Int::ItemRep] The item rep from which the compiled content
147
147
  # was requested
148
148
  attr_reader :item_rep
149
149
 
150
150
  # @return [Symbol] The requested snapshot
151
151
  attr_reader :snapshot
152
152
 
153
- # @param [Nanoc::ItemRep] item_rep The item rep from which the compiled
153
+ # @param [Nanoc::Int::ItemRep] item_rep The item rep from which the compiled
154
154
  # content was requested
155
155
  #
156
156
  # @param [Symbol] snapshot The requested snapshot
@@ -162,7 +162,7 @@ module Nanoc
162
162
 
163
163
  # Error that is raised when a snapshot with an existing name is made.
164
164
  class CannotCreateMultipleSnapshotsWithSameName < Generic
165
- # @param [Nanoc::ItemRep] rep The item representation for which a
165
+ # @param [Nanoc::Int::ItemRep] rep The item representation for which a
166
166
  # snapshot was attempted to be made
167
167
  #
168
168
  # @param [Symbol] snapshot The name of the snapshot that was attempted to
@@ -174,19 +174,12 @@ module Nanoc
174
174
 
175
175
  # Error that is raised when the compiled content of a binary item is attempted to be accessed.
176
176
  class CannotGetCompiledContentOfBinaryItem < Generic
177
- # @param [Nanoc::ItemRep] rep The binary item representation whose compiled content was attempted to be accessed
177
+ # @param [Nanoc::Int::ItemRep] rep The binary item representation whose compiled content was attempted to be accessed
178
178
  def initialize(rep)
179
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}.")
180
180
  end
181
181
  end
182
182
 
183
- # @deprecated No longer necessary, but kept for backwards compatibility.
184
- class DataNotYetAvailable < Generic
185
- def initialize(type, plural)
186
- super("#{type} #{plural ? 'are' : 'is'} not available yet. You may be missing a Nanoc::Site#load_data call.")
187
- end
188
- end
189
-
190
183
  # Error that is raised when multiple items or layouts with the same identifier exist.
191
184
  class DuplicateIdentifier < Generic
192
185
  def initialize(identifier, type)
@@ -1,8 +1,10 @@
1
1
  # encoding: utf-8
2
2
 
3
- module Nanoc
3
+ module Nanoc::Int
4
4
  # Adds support for memoizing functions.
5
5
  #
6
+ # @api private
7
+ #
6
8
  # @since 3.2.0
7
9
  module Memoization
8
10
  # Memoizes the method with the given name. The modified method will cache
@@ -20,7 +22,7 @@ module Nanoc
20
22
  #
21
23
  # class FibFast
22
24
  #
23
- # extend Nanoc::Memoization
25
+ # extend Nanoc::Int::Memoization
24
26
  #
25
27
  # def run(n)
26
28
  # if n == 0
@@ -1,6 +1,6 @@
1
1
  # encoding: utf-8
2
2
 
3
- module Nanoc
3
+ module Nanoc::Int
4
4
  # Provides a way to send notifications between objects. It allows blocks
5
5
  # associated with a certain notification name to be registered; these blocks
6
6
  # will be called when the notification with the given name is posted.
@@ -8,6 +8,8 @@ module Nanoc
8
8
  # It is a slightly different implementation of the Observer pattern; the
9
9
  # table of subscribers is not stored in the observable object itself, but in
10
10
  # the notification center.
11
+ #
12
+ # @api private
11
13
  class NotificationCenter
12
14
  class << self
13
15
  # Adds the given block to the list of blocks that should be called when
@@ -1,11 +1,12 @@
1
1
  # encoding: utf-8
2
2
 
3
- module Nanoc
3
+ module Nanoc::Int
4
4
  # The class responsible for keeping track of all loaded plugins, such as
5
- # filters ({Nanoc::Filter}), data sources ({Nanoc::DataSource}) and VCSes
6
- # ({Nanoc::Extra::VCS}).
5
+ # filters ({Nanoc::Filter}) and data sources ({Nanoc::DataSource}).
6
+ #
7
+ # @api private
7
8
  class PluginRegistry
8
- extend Nanoc::Memoization
9
+ extend Nanoc::Int::Memoization
9
10
 
10
11
  # A module that contains class methods for plugins. It provides functions
11
12
  # for setting identifiers, registering plugins and finding plugins. Plugin
@@ -25,7 +26,7 @@ module Nanoc
25
26
  # @return [Array<Symbol>] The identifiers for this plugin
26
27
  def identifiers(*identifiers)
27
28
  if identifiers.empty?
28
- Nanoc::PluginRegistry.instance.identifiers_of(superclass, self)
29
+ Nanoc::Int::PluginRegistry.instance.identifiers_of(superclass, self)
29
30
  else
30
31
  register(self, *identifiers)
31
32
  end
@@ -46,7 +47,7 @@ module Nanoc
46
47
  if identifier
47
48
  identifiers(identifier)
48
49
  else
49
- Nanoc::PluginRegistry.instance.identifiers_of(superclass, self).first
50
+ Nanoc::Int::PluginRegistry.instance.identifiers_of(superclass, self).first
50
51
  end
51
52
  end
52
53
 
@@ -65,14 +66,14 @@ module Nanoc
65
66
  klass = klass.superclass while klass.superclass.respond_to?(:register)
66
67
 
67
68
  # Register
68
- registry = Nanoc::PluginRegistry.instance
69
+ registry = Nanoc::Int::PluginRegistry.instance
69
70
  registry.register(klass, class_or_name, *identifiers)
70
71
  end
71
72
 
72
73
  # @return [Hash<Symbol, Class>] All plugins of this type, with keys
73
74
  # being the identifiers and values the plugin classes
74
75
  def all
75
- Nanoc::Plugin.find_all(self)
76
+ Nanoc::Int::PluginRegistry.instance.find_all(self)
76
77
  end
77
78
 
78
79
  # Returns the plugin with the given name (identifier)
@@ -81,21 +82,21 @@ module Nanoc
81
82
  #
82
83
  # @return [Class] The plugin class with the given name
83
84
  def named(name)
84
- Nanoc::Plugin.find(self, name)
85
+ Nanoc::Int::PluginRegistry.instance.find(self, name)
85
86
  end
86
87
  end
87
88
 
88
89
  # Returns the shared {PluginRegistry} instance, creating it if none exists
89
90
  # yet.
90
91
  #
91
- # @return [Nanoc::PluginRegistry] The shared plugin registry
92
+ # @return [Nanoc::Int::PluginRegistry] The shared plugin registry
92
93
  def self.instance
93
94
  @instance ||= new
94
95
  end
95
96
 
96
97
  # Creates a new plugin registry. This should usually not be necessary; it
97
98
  # is recommended to use the shared instance (obtained from
98
- # {Nanoc::PluginRegistry.instance}).
99
+ # {Nanoc::Int::PluginRegistry.instance}).
99
100
  def initialize
100
101
  @identifiers_to_classes = {}
101
102
  @classes_to_identifiers = {}
@@ -104,7 +105,7 @@ module Nanoc
104
105
  # Registers the given class as a plugin.
105
106
  #
106
107
  # @param [Class] superclass The superclass of the plugin. For example:
107
- # {Nanoc::Filter}, {Nanoc::Extra::VCS}.
108
+ # {Nanoc::Filter}.
108
109
  #
109
110
  # @param [Class, String] class_or_name The class to register. This can be
110
111
  # a string, in which case it will be automatically converted to a proper
@@ -126,7 +127,7 @@ module Nanoc
126
127
  end
127
128
 
128
129
  # @param [Class] superclass The superclass of the plugin. For example:
129
- # {Nanoc::Filter}, {Nanoc::Extra::VCS}.
130
+ # {Nanoc::Filter}.
130
131
  #
131
132
  # @param [Class] klass The class to get the identifiers for.
132
133
  #
@@ -193,11 +194,6 @@ module Nanoc
193
194
  plugins
194
195
  end
195
196
 
196
- # @deprecated Use {Nanoc::PluginRegistry#find} instead
197
- def named(name)
198
- find(self, name)
199
- end
200
-
201
197
  protected
202
198
 
203
199
  def resolve(class_or_name, _klass)
@@ -215,7 +211,4 @@ module Nanoc
215
211
  klass.to_s.sub(/^(::)?/, '::')
216
212
  end
217
213
  end
218
-
219
- # @deprecated Use {Nanoc::PluginRegistry.instance} instead
220
- Plugin = PluginRegistry.instance
221
214
  end