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
@@ -19,7 +19,7 @@ module Nanoc::CLI::Commands
19
19
 
20
20
  # List deployers
21
21
  if options[:'list-deployers']
22
- deployers = Nanoc::PluginRegistry.instance.find_all(Nanoc::Extra::Deployer)
22
+ deployers = Nanoc::Int::PluginRegistry.instance.find_all(Nanoc::Extra::Deployer)
23
23
  deployer_names = deployers.keys.sort_by(&:to_s)
24
24
  puts 'Available deployers:'
25
25
  deployer_names.each do |name|
@@ -45,13 +45,13 @@ module Nanoc::CLI::Commands
45
45
 
46
46
  # Can't proceed further without a deploy config
47
47
  if deploy_configs.empty?
48
- raise Nanoc::Errors::GenericTrivial, 'The site has no deployment configurations.'
48
+ raise Nanoc::Int::Errors::GenericTrivial, 'The site has no deployment configurations.'
49
49
  end
50
50
 
51
51
  # Get target
52
52
  target = options.fetch(:target, :default).to_sym
53
53
  config = deploy_configs.fetch(target) do
54
- raise Nanoc::Errors::GenericTrivial, "The site has no deployment configuration for #{target}."
54
+ raise Nanoc::Int::Errors::GenericTrivial, "The site has no deployment configuration for #{target}."
55
55
  end
56
56
 
57
57
  # Get deployer
@@ -62,7 +62,7 @@ module Nanoc::CLI::Commands
62
62
  end
63
63
  deployer_class = Nanoc::Extra::Deployer.named(name)
64
64
  if deployer_class.nil?
65
- raise Nanoc::Errors::GenericTrivial, "The specified deploy target has an unrecognised kind “#{name}” (expected one of #{names.join(', ')})."
65
+ raise Nanoc::Int::Errors::GenericTrivial, "The specified deploy target has an unrecognised kind “#{name}” (expected one of #{names.join(', ')})."
66
66
  end
67
67
 
68
68
  # Check
@@ -14,7 +14,7 @@ module Nanoc::CLI::Commands
14
14
 
15
15
  require_site
16
16
 
17
- Nanoc::Context.new(env).pry
17
+ Nanoc::Int::Context.new(env).pry
18
18
  end
19
19
 
20
20
  protected
@@ -4,7 +4,7 @@ summary 'show all available plugins'
4
4
  aliases :info
5
5
  usage 'show-plugins [options]'
6
6
  description <<-EOS
7
- Show a list of available plugins, including filters, data sources and VCSes.
7
+ Show a list of available plugins, including filters and data sources.
8
8
  If the current directory contains a nanoc web site, the plugins defined in this site will be shown as well.
9
9
  EOS
10
10
 
@@ -13,13 +13,13 @@ module Nanoc::CLI::Commands
13
13
  def run
14
14
  # Check arguments
15
15
  if arguments.size != 0
16
- raise Nanoc::Errors::GenericTrivial, "usage: #{command.usage}"
16
+ raise Nanoc::Int::Errors::GenericTrivial, "usage: #{command.usage}"
17
17
  end
18
18
 
19
19
  # Get list of plugins (before and after)
20
- plugins_before = Nanoc::Plugin.all
20
+ plugins_before = Nanoc::Int::PluginRegistry.instance.all
21
21
  site.code_snippets if site
22
- plugins_after = Nanoc::Plugin.all
22
+ plugins_after = Nanoc::Int::PluginRegistry.instance.all
23
23
 
24
24
  # Divide list of plugins into builtin and custom
25
25
  plugins_builtin = plugins_before
@@ -73,7 +73,6 @@ module Nanoc::CLI::Commands
73
73
 
74
74
  PLUGIN_CLASS_ORDER = [
75
75
  Nanoc::Filter,
76
- Nanoc::Extra::VCS,
77
76
  Nanoc::DataSource,
78
77
  Nanoc::Extra::Deployer
79
78
  ] unless defined? PLUGIN_CLASS_ORDER
@@ -81,7 +80,6 @@ module Nanoc::CLI::Commands
81
80
  PLUGIN_CLASSES = {
82
81
  Nanoc::Filter => 'Filters',
83
82
  Nanoc::DataSource => 'Data Sources',
84
- Nanoc::Extra::VCS => 'VCSes',
85
83
  Nanoc::Extra::Deployer => 'Deployers'
86
84
  } unless defined? PLUGIN_CLASSES
87
85
 
@@ -27,8 +27,6 @@ module Nanoc::CLI
27
27
 
28
28
  # Disables error handling. This is used by the test cases to prevent error
29
29
  # from being handled by the CLI while tests are running.
30
- #
31
- # @api private
32
30
  def self.disable
33
31
  @disabled = true
34
32
  end
@@ -36,8 +34,6 @@ module Nanoc::CLI
36
34
  # Re-enables error handling after it was disabled. This is used by the test
37
35
  # cases to prevent error from being handled by the CLI while tests are
38
36
  # running.
39
- #
40
- # @api private
41
37
  def self.enable
42
38
  @disabled = false
43
39
  end
@@ -46,8 +42,6 @@ module Nanoc::CLI
46
42
  # called directly; use {Nanoc::CLI::ErrorHandler.handle_while} instead.
47
43
  #
48
44
  # @return [void]
49
- #
50
- # @api private
51
45
  def handle_while(&_block)
52
46
  # Set exit handler
53
47
  %w( INT TERM ).each do |signal|
@@ -70,7 +64,7 @@ module Nanoc::CLI
70
64
 
71
65
  # Run
72
66
  yield
73
- rescue Nanoc::Errors::GenericTrivial => e
67
+ rescue Nanoc::Int::Errors::GenericTrivial => e
74
68
  $stderr.puts "Error: #{e.message}"
75
69
  exit(1)
76
70
  rescue Interrupt
@@ -113,8 +107,6 @@ module Nanoc::CLI
113
107
  #
114
108
  # @param [IO] stream The stream to write the description too
115
109
  #
116
- # @api private
117
- #
118
110
  # @return [void]
119
111
  def write_compact_error(error, stream)
120
112
  # Header
@@ -136,8 +128,6 @@ module Nanoc::CLI
136
128
  #
137
129
  # @param [IO] stream The stream to write the description too
138
130
  #
139
- # @api private
140
- #
141
131
  # @return [void]
142
132
  def write_verbose_error(error, stream)
143
133
  # Header
@@ -164,12 +154,12 @@ module Nanoc::CLI
164
154
  Nanoc::CLI.debug?
165
155
  end
166
156
 
167
- # @return [Nanoc::Site] The site that is currently being processed
157
+ # @return [Nanoc::Int::Site] The site that is currently being processed
168
158
  def site
169
159
  @command && @command.site
170
160
  end
171
161
 
172
- # @return [Nanoc::Compiler] The compiler for the current site
162
+ # @return [Nanoc::Int::Compiler] The compiler for the current site
173
163
  def compiler
174
164
  site && site.compiler
175
165
  end
@@ -284,7 +274,7 @@ module Nanoc::CLI
284
274
  stream.puts ' (empty)'
285
275
  else
286
276
  stack.reverse_each do |obj|
287
- if obj.is_a?(Nanoc::ItemRep)
277
+ if obj.is_a?(Nanoc::Int::ItemRep)
288
278
  stream.puts " - [item] #{obj.item.identifier} (rep #{obj.name})"
289
279
  else # layout
290
280
  stream.puts " - [layout] #{obj.identifier}"
@@ -5,6 +5,8 @@ require 'singleton'
5
5
  module Nanoc::CLI
6
6
  # Nanoc::CLI::Logger is a singleton class responsible for generating
7
7
  # feedback in the terminal.
8
+ #
9
+ # @api private
8
10
  class Logger
9
11
  # Maps actions (`:create`, `:update`, `:identical`, `:skip` and `:delete`)
10
12
  # onto their ANSI color codes.
@@ -1,6 +1,7 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module Nanoc::CLI
4
+ # @api private
4
5
  module StreamCleaners
5
6
  autoload 'Abstract', 'nanoc/cli/stream_cleaners/abstract'
6
7
  autoload 'ANSIColors', 'nanoc/cli/stream_cleaners/ansi_colors'
@@ -6,6 +6,8 @@ module Nanoc::CLI::StreamCleaners
6
6
  # can have state, so they can act as a FSM.
7
7
  #
8
8
  # @abstract Subclasses must implement {#clean}
9
+ #
10
+ # @api private
9
11
  class Abstract
10
12
  # Returns a cleaned version of the given string.
11
13
  #
@@ -2,6 +2,8 @@
2
2
 
3
3
  module Nanoc::CLI::StreamCleaners
4
4
  # Removes ANSI color escape sequences.
5
+ #
6
+ # @api private
5
7
  class ANSIColors < Abstract
6
8
  # @see Nanoc::CLI::StreamCleaners::Abstract#clean
7
9
  def clean(s)
@@ -2,6 +2,8 @@
2
2
 
3
3
  module Nanoc::CLI::StreamCleaners
4
4
  # Simplifies output by replacing UTF-8 characters with their ASCII decompositions.
5
+ #
6
+ # @api private
5
7
  class UTF8 < Abstract
6
8
  # @see Nanoc::CLI::StreamCleaners::Abstract#clean
7
9
  def clean(s)
@@ -1,5 +1,6 @@
1
1
  # encoding: utf-8
2
2
 
3
+ # @api private
3
4
  module Nanoc::DataSources
4
5
  autoload 'Filesystem', 'nanoc/data_sources/filesystem'
5
6
  autoload 'FilesystemUnified', 'nanoc/data_sources/filesystem_unified'
@@ -9,21 +10,4 @@ module Nanoc::DataSources
9
10
  Nanoc::DataSource.register '::Nanoc::DataSources::FilesystemVerbose', :filesystem_verbose
10
11
  Nanoc::DataSource.register '::Nanoc::DataSources::FilesystemUnified', :filesystem_unified
11
12
  Nanoc::DataSource.register '::Nanoc::DataSources::Static', :static
12
-
13
- # Deprecated; fetch data from online data sources manually instead
14
- # TODO: [in nanoc 4.0] remove me
15
- autoload 'Delicious', 'nanoc/data_sources/deprecated/delicious'
16
- autoload 'LastFM', 'nanoc/data_sources/deprecated/last_fm'
17
- autoload 'Twitter', 'nanoc/data_sources/deprecated/twitter'
18
- Nanoc::DataSource.register '::Nanoc::DataSources::Delicious', :delicious
19
- Nanoc::DataSource.register '::Nanoc::DataSources::LastFM', :last_fm
20
- Nanoc::DataSource.register '::Nanoc::DataSources::Twitter', :twitter
21
-
22
- # Deprecated; use `filesystem_verbose` or `filesystem_unified` instead
23
- # TODO: [in nanoc 4.0] remove me
24
- Nanoc::DataSource.register '::Nanoc::DataSources::FilesystemVerbose', :filesystem
25
- Nanoc::DataSource.register '::Nanoc::DataSources::FilesystemUnified', :filesystem_combined
26
- Nanoc::DataSource.register '::Nanoc::DataSources::FilesystemUnified', :filesystem_compact
27
- FilesystemCombined = FilesystemUnified
28
- FilesystemCompact = FilesystemUnified
29
13
  end
@@ -2,17 +2,9 @@
2
2
 
3
3
  module Nanoc::DataSources
4
4
  # Provides functionality common across all filesystem data sources.
5
+ #
6
+ # @api private
5
7
  module Filesystem
6
- # The VCS that will be called when adding, deleting and moving files. If
7
- # no VCS has been set, or if the VCS has been set to `nil`, a dummy VCS
8
- # will be returned.
9
- #
10
- # @return [Nanoc::Extra::VCS, nil] The VCS that will be used.
11
- def vcs
12
- @vcs ||= Nanoc::Extra::VCSes::Dummy.new
13
- end
14
- attr_writer :vcs
15
-
16
8
  # See {Nanoc::DataSource#up}.
17
9
  def up
18
10
  end
@@ -29,33 +21,14 @@ module Nanoc::DataSources
29
21
  config.fetch(:layouts_dir, 'layouts')
30
22
  end
31
23
 
32
- # See {Nanoc::DataSource#setup}.
33
- def setup
34
- # Create directories
35
- [content_dir_name, layouts_dir_name].each do |dir|
36
- FileUtils.mkdir_p(dir)
37
- vcs.add(dir)
38
- end
39
- end
40
-
41
24
  # See {Nanoc::DataSource#items}.
42
25
  def items
43
- load_objects(content_dir_name, 'item', Nanoc::Item)
26
+ load_objects(content_dir_name, 'item', Nanoc::Int::Item)
44
27
  end
45
28
 
46
29
  # See {Nanoc::DataSource#layouts}.
47
30
  def layouts
48
- load_objects(layouts_dir_name, 'layout', Nanoc::Layout)
49
- end
50
-
51
- # See {Nanoc::DataSource#create_item}.
52
- def create_item(content, attributes, identifier, params = {})
53
- create_object(content_dir_name, content, attributes, identifier, params)
54
- end
55
-
56
- # See {Nanoc::DataSource#create_layout}.
57
- def create_layout(content, attributes, identifier, params = {})
58
- create_object(layouts_dir_name, content, attributes, identifier, params)
31
+ load_objects(layouts_dir_name, 'layout', Nanoc::Int::Layout)
59
32
  end
60
33
 
61
34
  protected
@@ -88,10 +61,10 @@ module Nanoc::DataSources
88
61
 
89
62
  # Read content and metadata
90
63
  is_binary = content_filename && !@site.config[:text_extensions].include?(File.extname(content_filename)[1..-1])
91
- if is_binary && klass == Nanoc::Item
64
+ if is_binary && klass == Nanoc::Int::Item
92
65
  meta = (meta_filename && YAML.load_file(meta_filename)) || {}
93
66
  content_or_filename = content_filename
94
- elsif is_binary && klass == Nanoc::Layout
67
+ elsif is_binary && klass == Nanoc::Int::Layout
95
68
  raise "The layout file '#{content_filename}' is a binary file, but layouts can only be textual"
96
69
  else
97
70
  meta, content_or_filename = parse(content_filename, meta_filename, kind)
@@ -103,10 +76,6 @@ module Nanoc::DataSources
103
76
  content_filename: content_filename,
104
77
  meta_filename: meta_filename,
105
78
  extension: content_filename ? ext_of(content_filename)[1..-1] : nil,
106
- # WARNING :file is deprecated; please create a File object manually
107
- # using the :content_filename or :meta_filename attributes.
108
- # TODO: [in nanoc 4.0] remove me
109
- file: content_filename ? Nanoc::Extra::FileProxy.new(content_filename) : nil
110
79
  }.merge(meta)
111
80
 
112
81
  # Get identifier
@@ -66,6 +66,8 @@ module Nanoc::DataSources
66
66
  # files. In the data source configuration, set `encoding` to an encoding
67
67
  # understood by Ruby’s `Encoding`. If no encoding is set in the configuration,
68
68
  # one will be inferred from the environment.
69
+ #
70
+ # @api private
69
71
  class FilesystemUnified < Nanoc::DataSource
70
72
  include Nanoc::DataSources::Filesystem
71
73
 
@@ -84,12 +86,12 @@ module Nanoc::DataSources
84
86
  parent_path = File.dirname(path)
85
87
 
86
88
  # Notify
87
- Nanoc::NotificationCenter.post(:file_created, path)
89
+ Nanoc::Int::NotificationCenter.post(:file_created, path)
88
90
 
89
91
  # Write item
90
92
  FileUtils.mkdir_p(parent_path)
91
93
  File.open(path, 'w') do |io|
92
- meta = attributes.stringify_keys_recursively
94
+ meta = attributes.__nanoc_stringify_keys_recursively
93
95
  unless meta == {}
94
96
  io.write(YAML.dump(meta).strip + "\n")
95
97
  io.write("---\n")
@@ -117,7 +119,7 @@ module Nanoc::DataSources
117
119
  else
118
120
  regex = @config && @config[:allow_periods_in_identifiers] ? /\.[^\/\.]+$/ : /\.[^\/]+$/
119
121
  end
120
- filename.sub(regex, '').cleaned_identifier
122
+ filename.sub(regex, '').__nanoc_cleaned_identifier
121
123
  end
122
124
  end
123
125
  end
@@ -38,6 +38,8 @@ module Nanoc::DataSources
38
38
  # files. In the data source configuration, set `encoding` to an encoding
39
39
  # understood by Ruby’s `Encoding`. If no encoding is set in the configuration,
40
40
  # one will be inferred from the environment.
41
+ #
42
+ # @api private
41
43
  class FilesystemVerbose < Nanoc::DataSource
42
44
  include Nanoc::DataSources::Filesystem
43
45
 
@@ -55,12 +57,12 @@ module Nanoc::DataSources
55
57
  content_filename = dir_name + identifier + last_component + ext
56
58
 
57
59
  # Notify
58
- Nanoc::NotificationCenter.post(:file_created, meta_filename)
59
- Nanoc::NotificationCenter.post(:file_created, content_filename)
60
+ Nanoc::Int::NotificationCenter.post(:file_created, meta_filename)
61
+ Nanoc::Int::NotificationCenter.post(:file_created, content_filename)
60
62
 
61
63
  # Create files
62
64
  FileUtils.mkdir_p(dir_path)
63
- File.open(meta_filename, 'w') { |io| io.write(YAML.dump(attributes.stringify_keys_recursively)) }
65
+ File.open(meta_filename, 'w') { |io| io.write(YAML.dump(attributes.__nanoc_stringify_keys_recursively)) }
64
66
  File.open(content_filename, 'w') { |io| io.write(content) }
65
67
  end
66
68
 
@@ -24,6 +24,8 @@ module Nanoc::DataSources
24
24
  # data sources will have the :is_hidden attribute set by default, which will
25
25
  # exclude them from the Blogging helper's atom feed generator, among other
26
26
  # things.
27
+ #
28
+ # @api private
27
29
  class Static < Nanoc::DataSource
28
30
  identifier :static
29
31
 
@@ -40,9 +42,9 @@ module Nanoc::DataSources
40
42
  attributes[:is_hidden] = true unless config[:hide_items] == false
41
43
  identifier = filename[(prefix.length + 1)..-1] + '/'
42
44
  mtime = File.mtime(filename)
43
- checksum = Pathname.new(filename).checksum
45
+ checksum = Pathname.new(filename).__nanoc_checksum
44
46
 
45
- Nanoc::Item.new(
47
+ Nanoc::Int::Item.new(
46
48
  filename,
47
49
  attributes,
48
50
  identifier,
@@ -1,27 +1,15 @@
1
1
  # encoding: utf-8
2
2
 
3
+ # @api private
3
4
  module Nanoc::Extra
4
- autoload 'AutoCompiler', 'nanoc/extra/auto_compiler'
5
5
  autoload 'Checking', 'nanoc/extra/checking'
6
- autoload 'CHiCk', 'nanoc/extra/chick'
7
6
  autoload 'FilesystemTools', 'nanoc/extra/filesystem_tools'
8
7
  autoload 'LinkCollector', 'nanoc/extra/link_collector.rb'
9
8
  autoload 'Pruner', 'nanoc/extra/pruner'
10
- autoload 'Validators', 'nanoc/extra/validators'
11
9
  autoload 'Piper', 'nanoc/extra/piper'
12
10
  autoload 'JRubyNokogiriWarner', 'nanoc/extra/jruby_nokogiri_warner'
13
-
14
- # Deprecated; use {Nanoc::Context} instead
15
- # TODO: [in nanoc 4.0] remove me
16
- Context = ::Nanoc::Context
17
-
18
- # Deprecated
19
- # TODO: [in nanoc 4.0] remove me
20
- autoload 'FileProxy', 'nanoc/extra/file_proxy'
21
11
  end
22
12
 
23
13
  require 'nanoc/extra/core_ext'
24
14
  require 'nanoc/extra/deployer'
25
15
  require 'nanoc/extra/deployers'
26
- require 'nanoc/extra/vcs'
27
- require 'nanoc/extra/vcses'
@@ -1,6 +1,7 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module Nanoc::Extra
4
+ # @api private
4
5
  module Checking
5
6
  autoload 'Check', 'nanoc/extra/checking/check'
6
7
  autoload 'DSL', 'nanoc/extra/checking/dsl'
@@ -1,14 +1,16 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module Nanoc::Extra::Checking
4
- class OutputDirNotFoundError < Nanoc::Errors::Generic
4
+ # @api private
5
+ class OutputDirNotFoundError < Nanoc::Int::Errors::Generic
5
6
  def initialize(directory_path)
6
7
  super("Unable to run check against output directory at “#{directory_path}”: directory does not exist.")
7
8
  end
8
9
  end
9
10
 
11
+ # @api private
10
12
  class Check
11
- extend Nanoc::PluginRegistry::PluginMethods
13
+ extend Nanoc::Int::PluginRegistry::PluginMethods
12
14
 
13
15
  attr_reader :site
14
16
  attr_reader :issues