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,7 +1,9 @@
1
1
  # encoding: utf-8
2
2
 
3
- module Nanoc
3
+ module Nanoc::Int
4
4
  # Module that contains all outdatedness reasons.
5
+ #
6
+ # @api private
5
7
  module OutdatednessReasons
6
8
  # A generic outdatedness reason. An outdatedness reason is basically a
7
9
  # descriptive message that explains why a given object is outdated.
@@ -1,7 +1,9 @@
1
1
  # encoding: utf-8
2
2
 
3
- module Nanoc
3
+ module Nanoc::Int
4
4
  # Contains the processing information for a item.
5
+ #
6
+ # @api private
5
7
  class Rule
6
8
  # @return [Regexp] The regex that determines which items this rule can be
7
9
  # applied to. This rule can be applied to items with a identifier
@@ -42,7 +44,7 @@ module Nanoc
42
44
  @block = block
43
45
  end
44
46
 
45
- # @param [Nanoc::Item] item The item to check
47
+ # @param [Nanoc::Int::Item] item The item to check
46
48
  #
47
49
  # @return [Boolean] true if this rule can be applied to the given item
48
50
  # rep, false otherwise
@@ -52,10 +54,10 @@ module Nanoc
52
54
 
53
55
  # Applies this rule to the given item rep.
54
56
  #
55
- # @param [Nanoc::ItemRep] rep The item representation where this rule
57
+ # @param [Nanoc::Int::ItemRep] rep The item representation where this rule
56
58
  # should be applied to
57
59
  #
58
- # @option params [Nanoc::Compiler] :compiler The compiler
60
+ # @option params [Nanoc::Int::Compiler] :compiler The compiler
59
61
  #
60
62
  # @raise [ArgumentError] if no compiler is passed
61
63
  #
@@ -64,8 +66,8 @@ module Nanoc
64
66
  compiler = params.fetch(:compiler) do
65
67
  raise ArgumentError, 'Required :compiler option is missing'
66
68
  end
67
- rep = Nanoc::ItemRepProxy.new(rep, compiler) unless rep.proxy?
68
- context = Nanoc::RuleContext.new(rep: rep, compiler: compiler)
69
+ rep = Nanoc::Int::ItemRepProxy.new(rep, compiler) unless rep.proxy?
70
+ context = Nanoc::Int::RuleContext.new(rep: rep, compiler: compiler)
69
71
  context.instance_exec(matches(rep.item.identifier), &@block)
70
72
  end
71
73
 
@@ -78,7 +80,7 @@ module Nanoc
78
80
  #
79
81
  # @return [nil, Array] Captured groups, if any
80
82
  def matches(identifier)
81
- matches = @identifier_regex.match(identifier)
83
+ matches = @identifier_regex.match(identifier.to_s)
82
84
  matches && matches.captures
83
85
  end
84
86
  end
@@ -1,25 +1,25 @@
1
1
  # encoding: utf-8
2
2
 
3
- module Nanoc
3
+ module Nanoc::Int
4
4
  # Provides a context in which compilation and routing rules can be executed.
5
5
  # It provides access to the item representation that is being compiled or
6
6
  # routed.
7
7
  #
8
8
  # The following variables will be available in this rules context:
9
9
  #
10
- # * `rep` ({Nanoc::ItemRep}) - The current item rep
11
- # * `item` ({Nanoc::Item}) - The current item
12
- # * `site` ({Nanoc::Site}) - The site
10
+ # * `rep` ({Nanoc::Int::ItemRep}) - The current item rep
11
+ # * `item` ({Nanoc::Int::Item}) - The current item
12
+ # * `site` ({Nanoc::Int::Site}) - The site
13
13
  # * `config` ({Hash}) - The site configuration
14
- # * `items` ({Array}<{Nanoc::Item}>) - A list of all items
15
- # * `layouts` ({Array}<{Nanoc::Layout}>) - A list of all layouts
14
+ # * `items` ({Array}<{Nanoc::Int::Item}>) - A list of all items
15
+ # * `layouts` ({Array}<{Nanoc::Int::Layout}>) - A list of all layouts
16
16
  #
17
17
  # @api private
18
- class RuleContext < Context
19
- # @option params [Nanoc::ItemRep] :rep The item representation that will
18
+ class RuleContext < Nanoc::Int::Context
19
+ # @option params [Nanoc::Int::ItemRep] :rep The item representation that will
20
20
  # be processed in this rule context
21
21
  #
22
- # @option params [Nanoc::Compiler] :compiler The compiler that is being
22
+ # @option params [Nanoc::Int::Compiler] :compiler The compiler that is being
23
23
  # used to compile the site
24
24
  #
25
25
  # @raise [ArgumentError] if the `:rep` or the `:compiler` option is
@@ -43,10 +43,10 @@ module Nanoc
43
43
  })
44
44
  end
45
45
 
46
- # Filters the current representation (calls {Nanoc::ItemRep#filter} with
46
+ # Filters the current representation (calls {Nanoc::Int::ItemRep#filter} with
47
47
  # the given arguments on the rep).
48
48
  #
49
- # @see Nanoc::ItemRep#filter
49
+ # @see Nanoc::Int::ItemRep#filter
50
50
  #
51
51
  # @param [Symbol] filter_name The name of the filter to run the item
52
52
  # representations' content through
@@ -59,10 +59,10 @@ module Nanoc
59
59
  rep.filter(filter_name, filter_args)
60
60
  end
61
61
 
62
- # Layouts the current representation (calls {Nanoc::ItemRep#layout} with
62
+ # Layouts the current representation (calls {Nanoc::Int::ItemRep#layout} with
63
63
  # the given arguments on the rep).
64
64
  #
65
- # @see Nanoc::ItemRep#layout
65
+ # @see Nanoc::Int::ItemRep#layout
66
66
  #
67
67
  # @param [String] layout_identifier The identifier of the layout the item
68
68
  # should be laid out with
@@ -73,9 +73,9 @@ module Nanoc
73
73
  end
74
74
 
75
75
  # Creates a snapshot of the current compiled item content. Calls
76
- # {Nanoc::ItemRep#snapshot} with the given arguments on the rep.
76
+ # {Nanoc::Int::ItemRep#snapshot} with the given arguments on the rep.
77
77
  #
78
- # @see Nanoc::ItemRep#snapshot
78
+ # @see Nanoc::Int::ItemRep#snapshot
79
79
  #
80
80
  # @param [Symbol] snapshot_name The name of the snapshot to create
81
81
  #
@@ -1,14 +1,14 @@
1
1
  # encoding: utf-8
2
2
 
3
- module Nanoc
3
+ module Nanoc::Int
4
4
  # Calculates rule memories for objects that can be run through a rule (item
5
5
  # representations and layouts).
6
6
  #
7
7
  # @api private
8
8
  class RuleMemoryCalculator
9
- extend Nanoc::Memoization
9
+ extend Nanoc::Int::Memoization
10
10
 
11
- # @option params [Nanoc::RulesCollection] rules_collection The rules
11
+ # @option params [Nanoc::Int::RulesCollection] rules_collection The rules
12
12
  # collection
13
13
  def initialize(params = {})
14
14
  @rules_collection = params.fetch(:rules_collection) do
@@ -1,12 +1,12 @@
1
1
  # encoding: utf-8
2
2
 
3
- module Nanoc
3
+ module Nanoc::Int
4
4
  # Stores rule memories for objects that can be run through a rule (item
5
5
  # representations and layouts).
6
6
  #
7
7
  # @api private
8
- class RuleMemoryStore < ::Nanoc::Store
9
- # @option params [Nanoc::Site] site The site where this rule memory store
8
+ class RuleMemoryStore < ::Nanoc::Int::Store
9
+ # @option params [Nanoc::Int::Site] site The site where this rule memory store
10
10
  # belongs to
11
11
  def initialize(params = {})
12
12
  super('tmp/rule_memory', 1)
@@ -16,7 +16,7 @@ module Nanoc
16
16
  @rule_memories = {}
17
17
  end
18
18
 
19
- # @param [Nanoc::ItemRep, Nanoc::Layout] obj The item representation or
19
+ # @param [Nanoc::Int::ItemRep, Nanoc::Int::Layout] obj The item representation or
20
20
  # the layout to get the rule memory for
21
21
  #
22
22
  # @return [Array] The rule memory for the given object
@@ -24,7 +24,7 @@ module Nanoc
24
24
  @rule_memories[obj.reference]
25
25
  end
26
26
 
27
- # @param [Nanoc::ItemRep, Nanoc::Layout] obj The item representation or
27
+ # @param [Nanoc::Int::ItemRep, Nanoc::Int::Layout] obj The item representation or
28
28
  # the layout to set the rule memory for
29
29
  #
30
30
  # @param [Array] rule_memory The new rule memory to be stored
@@ -36,12 +36,12 @@ module Nanoc
36
36
 
37
37
  protected
38
38
 
39
- # @see Nanoc::Store#data
39
+ # @see Nanoc::Int::Store#data
40
40
  def data
41
41
  @rule_memories
42
42
  end
43
43
 
44
- # @see Nanoc::Store#data=
44
+ # @see Nanoc::Int::Store#data=
45
45
  def data=(new_data)
46
46
  @rule_memories = new_data
47
47
  end
@@ -1,22 +1,20 @@
1
1
  # encoding: utf-8
2
2
 
3
- module Nanoc
3
+ module Nanoc::Int
4
4
  # Keeps track of the rules in a site.
5
5
  #
6
6
  # @api private
7
7
  class RulesCollection
8
8
  # @return [String] the contents of the Rules file
9
- #
10
- # @api private
11
9
  attr_accessor :data
12
10
 
13
- extend Nanoc::Memoization
11
+ extend Nanoc::Int::Memoization
14
12
 
15
- # @return [Array<Nanoc::Rule>] The list of item compilation rules that
13
+ # @return [Array<Nanoc::Int::Rule>] The list of item compilation rules that
16
14
  # will be used to compile items.
17
15
  attr_reader :item_compilation_rules
18
16
 
19
- # @return [Array<Nanoc::Rule>] The list of routing rules that will be
17
+ # @return [Array<Nanoc::Int::Rule>] The list of routing rules that will be
20
18
  # used to give all items a path.
21
19
  attr_reader :item_routing_rules
22
20
 
@@ -33,7 +31,7 @@ module Nanoc
33
31
  # be executed after all data is loaded but before the site is compiled
34
32
  attr_accessor :preprocessors
35
33
 
36
- # @param [Nanoc::Compiler] compiler The site’s compiler
34
+ # @param [Nanoc::Int::Compiler] compiler The site’s compiler
37
35
  def initialize(compiler)
38
36
  @compiler = compiler
39
37
 
@@ -45,7 +43,7 @@ module Nanoc
45
43
 
46
44
  # Add the given rule to the list of item compilation rules.
47
45
  #
48
- # @param [Nanoc::Rule] rule The item compilation rule to add
46
+ # @param [Nanoc::Int::Rule] rule The item compilation rule to add
49
47
  #
50
48
  # @return [void]
51
49
  def add_item_compilation_rule(rule)
@@ -54,14 +52,14 @@ module Nanoc
54
52
 
55
53
  # Add the given rule to the list of item routing rules.
56
54
  #
57
- # @param [Nanoc::Rule] rule The item routing rule to add
55
+ # @param [Nanoc::Int::Rule] rule The item routing rule to add
58
56
  #
59
57
  # @return [void]
60
58
  def add_item_routing_rule(rule)
61
59
  @item_routing_rules << rule
62
60
  end
63
61
 
64
- # @param [Nanoc::Item] item The item for which the compilation rules
62
+ # @param [Nanoc::Int::Item] item The item for which the compilation rules
65
63
  # should be retrieved
66
64
  #
67
65
  # @return [Array] The list of item compilation rules for the given item
@@ -76,7 +74,7 @@ module Nanoc
76
74
  # Find rules file
77
75
  rules_filenames = ['Rules', 'rules', 'Rules.rb', 'rules.rb']
78
76
  rules_filename = rules_filenames.find { |f| File.file?(f) }
79
- raise Nanoc::Errors::NoRulesFileFound.new if rules_filename.nil?
77
+ raise Nanoc::Int::Errors::NoRulesFileFound.new if rules_filename.nil?
80
78
 
81
79
  parse(rules_filename)
82
80
  end
@@ -106,9 +104,9 @@ module Nanoc
106
104
  # Finds the first matching compilation rule for the given item
107
105
  # representation.
108
106
  #
109
- # @param [Nanoc::ItemRep] rep The item rep for which to fetch the rule
107
+ # @param [Nanoc::Int::ItemRep] rep The item rep for which to fetch the rule
110
108
  #
111
- # @return [Nanoc::Rule, nil] The compilation rule for the given item rep,
109
+ # @return [Nanoc::Int::Rule, nil] The compilation rule for the given item rep,
112
110
  # or nil if no rules have been found
113
111
  def compilation_rule_for(rep)
114
112
  @item_compilation_rules.find do |rule|
@@ -118,9 +116,9 @@ module Nanoc
118
116
 
119
117
  # Finds the first matching routing rule for the given item representation.
120
118
  #
121
- # @param [Nanoc::ItemRep] rep The item rep for which to fetch the rule
119
+ # @param [Nanoc::Int::ItemRep] rep The item rep for which to fetch the rule
122
120
  #
123
- # @return [Nanoc::Rule, nil] The routing rule for the given item rep, or
121
+ # @return [Nanoc::Int::Rule, nil] The routing rule for the given item rep, or
124
122
  # nil if no rules have been found
125
123
  def routing_rule_for(rep)
126
124
  @item_routing_rules.find do |rule|
@@ -133,9 +131,9 @@ module Nanoc
133
131
  # returned. The result is a hash containing the corresponding rule for
134
132
  # each snapshot.
135
133
  #
136
- # @param [Nanoc::ItemRep] rep The item rep for which to fetch the rules
134
+ # @param [Nanoc::Int::ItemRep] rep The item rep for which to fetch the rules
137
135
  #
138
- # @return [Hash<Symbol, Nanoc::Rule>] The routing rules for the given rep
136
+ # @return [Hash<Symbol, Nanoc::Int::Rule>] The routing rules for the given rep
139
137
  def routing_rules_for(rep)
140
138
  rules = {}
141
139
  @item_routing_rules.each do |rule|
@@ -150,7 +148,7 @@ module Nanoc
150
148
 
151
149
  # Finds the filter name and arguments to use for the given layout.
152
150
  #
153
- # @param [Nanoc::Layout] layout The layout for which to fetch the filter.
151
+ # @param [Nanoc::Int::Layout] layout The layout for which to fetch the filter.
154
152
  #
155
153
  # @return [Array, nil] A tuple containing the filter name and the filter
156
154
  # arguments for the given layout.
@@ -161,9 +159,9 @@ module Nanoc
161
159
  nil
162
160
  end
163
161
 
164
- # Returns the Nanoc::CompilerDSL that should be used for this site.
162
+ # Returns the Nanoc::Int::CompilerDSL that should be used for this site.
165
163
  def dsl
166
- Nanoc::CompilerDSL.new(self, @compiler.site.config)
164
+ Nanoc::Int::CompilerDSL.new(self, @compiler.site.config)
167
165
  end
168
166
  memoize :dsl
169
167
 
@@ -176,15 +174,15 @@ module Nanoc
176
174
 
177
175
  # @return [String] The checksum for this object. If its contents change,
178
176
  # the checksum will change as well.
179
- def checksum
180
- Nanoc::Checksummer.calc(self)
177
+ def __nanoc_checksum
178
+ Nanoc::Int::Checksummer.calc(self)
181
179
  end
182
180
 
183
181
  def inspect
184
182
  "<#{self.class}>"
185
183
  end
186
184
 
187
- # @param [Nanoc::ItemRep] rep The item representation to get the rule
185
+ # @param [Nanoc::Int::ItemRep] rep The item representation to get the rule
188
186
  # memory for
189
187
  #
190
188
  # @return [Array] The rule memory for the given item representation
@@ -197,7 +195,7 @@ module Nanoc
197
195
  memoize :new_rule_memory_for_rep
198
196
 
199
197
  # Makes the given rule memory serializable by calling
200
- # `Nanoc::Checksummer#calc` on the filter arguments, so that objects such as
198
+ # `Nanoc::Int::Checksummer#calc` on the filter arguments, so that objects such as
201
199
  # classes and filenames can be serialized.
202
200
  #
203
201
  # @param [Array] rs The rule memory for a certain item rep
@@ -206,14 +204,14 @@ module Nanoc
206
204
  def make_rule_memory_serializable(rs)
207
205
  rs.map do |r|
208
206
  if r[0] == :filter
209
- [r[0], r[1], r[2].to_a.map { |a| Nanoc::Checksummer.calc(a) }]
207
+ [r[0], r[1], r[2].to_a.map { |a| Nanoc::Int::Checksummer.calc(a) }]
210
208
  else
211
209
  r
212
210
  end
213
211
  end
214
212
  end
215
213
 
216
- # @param [Nanoc::Layout] layout The layout to get the rule memory for
214
+ # @param [Nanoc::Int::Layout] layout The layout to get the rule memory for
217
215
  #
218
216
  # @return [Array] The rule memory for the given layout
219
217
  def new_rule_memory_for_layout(layout)
@@ -221,7 +219,7 @@ module Nanoc
221
219
  end
222
220
  memoize :new_rule_memory_for_layout
223
221
 
224
- # @param [Nanoc::ItemRep] rep The item representation for which to fetch
222
+ # @param [Nanoc::Int::ItemRep] rep The item representation for which to fetch
225
223
  # the list of snapshots
226
224
  #
227
225
  # @return [Array] A list of snapshots, represented as arrays where the
@@ -233,7 +231,7 @@ module Nanoc
233
231
  end
234
232
  end
235
233
 
236
- # @param [Nanoc::Item] obj The object for which to check the rule memory
234
+ # @param [Nanoc::Int::Item] obj The object for which to check the rule memory
237
235
  #
238
236
  # @return [Boolean] true if the rule memory for the given object has
239
237
  # changed since the last compilation, false otherwise
@@ -242,12 +240,12 @@ module Nanoc
242
240
  end
243
241
  memoize :rule_memory_differs_for
244
242
 
245
- # @return [Nanoc::RuleMemoryStore] The rule memory store
243
+ # @return [Nanoc::Int::RuleMemoryStore] The rule memory store
246
244
  def rule_memory_store
247
245
  @compiler.rule_memory_store
248
246
  end
249
247
 
250
- # @return [Nanoc::RuleMemoryCalculator] The rule memory calculator
248
+ # @return [Nanoc::Int::RuleMemoryCalculator] The rule memory calculator
251
249
  def rule_memory_calculator
252
250
  @compiler.rule_memory_calculator
253
251
  end
@@ -1,6 +1,6 @@
1
1
  # encoding: utf-8
2
2
 
3
- module Nanoc
3
+ module Nanoc::Int
4
4
  # Provides a context and a binding for use in filters such as the ERB and
5
5
  # Haml ones.
6
6
  class Context
@@ -15,7 +15,7 @@ module Nanoc
15
15
  #
16
16
  # @example Defining a context and accessing values
17
17
  #
18
- # context = Nanoc::Context.new(
18
+ # context = Nanoc::Int::Context.new(
19
19
  # :name => 'Max Payne',
20
20
  # :location => 'in a cheap motel'
21
21
  # )
@@ -1,55 +1,46 @@
1
1
  # encoding: utf-8
2
2
 
3
+ # @api private
3
4
  module Nanoc::ArrayExtensions
4
5
  # Returns a new array where all items' keys are recursively converted to
5
- # symbols by calling {Nanoc::ArrayExtensions#symbolize_keys_recursively} or
6
- # {Nanoc::HashExtensions#symbolize_keys_recursively}.
6
+ # symbols by calling {Nanoc::ArrayExtensions#__nanoc_symbolize_keys_recursively} or
7
+ # {Nanoc::HashExtensions#__nanoc_symbolize_keys_recursively}.
7
8
  #
8
9
  # @return [Array] The converted array
9
- def symbolize_keys_recursively
10
+ def __nanoc_symbolize_keys_recursively
10
11
  array = []
11
12
  each do |element|
12
- array << (element.respond_to?(:symbolize_keys_recursively) ? element.symbolize_keys_recursively : element)
13
+ array << (element.respond_to?(:__nanoc_symbolize_keys_recursively) ? element.__nanoc_symbolize_keys_recursively : element)
13
14
  end
14
15
  array
15
16
  end
16
17
 
17
- # @deprecated Renamed to {#symbolize_keys_recursively}
18
- def symbolize_keys
19
- symbolize_keys_recursively
20
- end
21
-
22
18
  # Returns a new array where all items' keys are recursively converted to
23
- # strings by calling {Nanoc::ArrayExtensions#stringify_keys_recursively} or
24
- # {Nanoc::HashExtensions#stringify_keys_recursively}.
19
+ # strings by calling {Nanoc::ArrayExtensions#__nanoc_stringify_keys_recursively} or
20
+ # {Nanoc::HashExtensions#__nanoc_stringify_keys_recursively}.
25
21
  #
26
22
  # @return [Array] The converted array
27
- def stringify_keys_recursively
23
+ def __nanoc_stringify_keys_recursively
28
24
  reduce([]) do |array, element|
29
- array + [element.respond_to?(:stringify_keys_recursively) ? element.stringify_keys_recursively : element]
25
+ array + [element.respond_to?(:__nanoc_stringify_keys_recursively) ? element.__nanoc_stringify_keys_recursively : element]
30
26
  end
31
27
  end
32
28
 
33
- # @deprecated Renamed to {#stringify_keys_recursively}
34
- def stringify_keys
35
- stringify_keys_recursively
36
- end
37
-
38
29
  # Freezes the contents of the array, as well as all array elements. The
39
- # array elements will be frozen using {#freeze_recursively} if they respond
30
+ # array elements will be frozen using {#__nanoc_freeze_recursively} if they respond
40
31
  # to that message, or #freeze if they do not.
41
32
  #
42
- # @see Hash#freeze_recursively
33
+ # @see Hash#__nanoc_freeze_recursively
43
34
  #
44
35
  # @return [void]
45
36
  #
46
37
  # @since 3.2.0
47
- def freeze_recursively
38
+ def __nanoc_freeze_recursively
48
39
  return if self.frozen?
49
40
  freeze
50
41
  each do |value|
51
- if value.respond_to?(:freeze_recursively)
52
- value.freeze_recursively
42
+ if value.respond_to?(:__nanoc_freeze_recursively)
43
+ value.__nanoc_freeze_recursively
53
44
  else
54
45
  value.freeze
55
46
  end
@@ -62,11 +53,12 @@ module Nanoc::ArrayExtensions
62
53
  # @return [String] The checksum for this array
63
54
  #
64
55
  # @api private
65
- def checksum
66
- Nanoc::Checksummer.calc(self)
56
+ def __nanoc_checksum
57
+ Nanoc::Int::Checksummer.calc(self)
67
58
  end
68
59
  end
69
60
 
61
+ # @api private
70
62
  class Array
71
63
  include Nanoc::ArrayExtensions
72
64
  end