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,23 +1,19 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module Nanoc::CLI::StreamCleaners
4
-
5
4
  # Superclass for all stream cleaners. Stream cleaners have a single method,
6
5
  # {#clean}, that takes a string and returns a cleaned string. Stream cleaners
7
6
  # can have state, so they can act as a FSM.
8
7
  #
9
8
  # @abstract Subclasses must implement {#clean}
10
9
  class Abstract
11
-
12
10
  # Returns a cleaned version of the given string.
13
11
  #
14
12
  # @param [String] s The string to clean
15
13
  #
16
14
  # @return [String] The cleaned string
17
- def clean(_s)
15
+ def clean(s) # rubocop:disable Lint/UnusedMethodArgument
18
16
  raise NotImplementedError, 'Subclasses of Nanoc::CLI::StreamCleaners::Abstract must implement #clean'
19
17
  end
20
-
21
18
  end
22
-
23
19
  end
@@ -1,15 +1,11 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module Nanoc::CLI::StreamCleaners
4
-
5
4
  # Removes ANSI color escape sequences.
6
5
  class ANSIColors < Abstract
7
-
8
6
  # @see Nanoc::CLI::StreamCleaners::Abstract#clean
9
7
  def clean(s)
10
8
  s.gsub(/\e\[.+?m/, '')
11
9
  end
12
-
13
10
  end
14
-
15
11
  end
@@ -1,16 +1,12 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module Nanoc::CLI::StreamCleaners
4
-
5
4
  # Simplifies output by replacing UTF-8 characters with their ASCII decompositions.
6
5
  class UTF8 < Abstract
7
-
8
6
  # @see Nanoc::CLI::StreamCleaners::Abstract#clean
9
7
  def clean(s)
10
- # FIXME this decomposition is not generally usable
8
+ # FIXME: this decomposition is not generally usable
11
9
  s.gsub(/“|”/, '"').gsub(/‘|’/, '\'').gsub('…', '...').gsub('©', '(c)')
12
10
  end
13
-
14
11
  end
15
-
16
12
  end
@@ -1,7 +1,6 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module Nanoc::DataSources
4
-
5
4
  autoload 'Filesystem', 'nanoc/data_sources/filesystem'
6
5
  autoload 'FilesystemUnified', 'nanoc/data_sources/filesystem_unified'
7
6
  autoload 'FilesystemVerbose', 'nanoc/data_sources/filesystem_verbose'
@@ -12,7 +11,7 @@ module Nanoc::DataSources
12
11
  Nanoc::DataSource.register '::Nanoc::DataSources::Static', :static
13
12
 
14
13
  # Deprecated; fetch data from online data sources manually instead
15
- # TODO [in nanoc 4.0] remove me
14
+ # TODO: [in nanoc 4.0] remove me
16
15
  autoload 'Delicious', 'nanoc/data_sources/deprecated/delicious'
17
16
  autoload 'LastFM', 'nanoc/data_sources/deprecated/last_fm'
18
17
  autoload 'Twitter', 'nanoc/data_sources/deprecated/twitter'
@@ -21,11 +20,10 @@ module Nanoc::DataSources
21
20
  Nanoc::DataSource.register '::Nanoc::DataSources::Twitter', :twitter
22
21
 
23
22
  # Deprecated; use `filesystem_verbose` or `filesystem_unified` instead
24
- # TODO [in nanoc 4.0] remove me
23
+ # TODO: [in nanoc 4.0] remove me
25
24
  Nanoc::DataSource.register '::Nanoc::DataSources::FilesystemVerbose', :filesystem
26
25
  Nanoc::DataSource.register '::Nanoc::DataSources::FilesystemUnified', :filesystem_combined
27
26
  Nanoc::DataSource.register '::Nanoc::DataSources::FilesystemUnified', :filesystem_compact
28
27
  FilesystemCombined = FilesystemUnified
29
28
  FilesystemCompact = FilesystemUnified
30
-
31
29
  end
@@ -1,10 +1,8 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module Nanoc::DataSources
4
-
5
4
  # @deprecated Fetch data from online data sources manually instead
6
5
  class Delicious < Nanoc::DataSource
7
-
8
6
  def items
9
7
  @items ||= begin
10
8
  require 'json'
@@ -21,12 +19,12 @@ module Nanoc::DataSources
21
19
  # Get data
22
20
  content = raw_item['n']
23
21
  attributes = {
24
- :url => raw_item['u'],
25
- :description => raw_item['d'],
26
- :tags => raw_item['t'],
27
- :date => Time.parse(raw_item['dt']),
28
- :note => raw_item['n'],
29
- :author => raw_item['a']
22
+ url: raw_item['u'],
23
+ description: raw_item['d'],
24
+ tags: raw_item['t'],
25
+ date: Time.parse(raw_item['dt']),
26
+ note: raw_item['n'],
27
+ author: raw_item['a']
30
28
  }
31
29
  identifier = "/#{i}/"
32
30
  mtime = nil
@@ -36,7 +34,5 @@ module Nanoc::DataSources
36
34
  end
37
35
  end
38
36
  end
39
-
40
37
  end
41
-
42
38
  end
@@ -1,10 +1,8 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module Nanoc::DataSources
4
-
5
4
  # @deprecated Fetch data from online data sources manually instead
6
5
  class LastFM < Nanoc::DataSource
7
-
8
6
  def items
9
7
  @items ||= begin
10
8
  require 'json'
@@ -66,14 +64,14 @@ module Nanoc::DataSources
66
64
  end
67
65
 
68
66
  attributes = {
69
- :name => raw_item['name'],
70
- :artist => {
71
- :name => raw_artist_info['name'],
72
- :url => raw_artist_info['url']
67
+ name: raw_item['name'],
68
+ artist: {
69
+ name: raw_artist_info['name'],
70
+ url: raw_artist_info['url']
73
71
  },
74
- :url => raw_item['url'],
75
- :played_at => track_played_at,
76
- :now_playing => now_playing
72
+ url: raw_item['url'],
73
+ played_at: track_played_at,
74
+ now_playing: now_playing
77
75
  }
78
76
  identifier = "/#{i}/"
79
77
  mtime = nil
@@ -83,7 +81,5 @@ module Nanoc::DataSources
83
81
  end
84
82
  end
85
83
  end
86
-
87
84
  end
88
-
89
85
  end
@@ -1,10 +1,8 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module Nanoc::DataSources
4
-
5
4
  # @deprecated Fetch data from online data sources manually instead
6
5
  class Twitter < Nanoc::DataSource
7
-
8
6
  def items
9
7
  @item ||= begin
10
8
  require 'json'
@@ -21,8 +19,8 @@ module Nanoc::DataSources
21
19
  # Get data
22
20
  content = raw_item['text']
23
21
  attributes = {
24
- :created_at => raw_item['created_at'],
25
- :source => raw_item['source']
22
+ created_at: raw_item['created_at'],
23
+ source: raw_item['source']
26
24
  }
27
25
  identifier = "/#{raw_item['id']}/"
28
26
  mtime = Time.parse(raw_item['created_at'])
@@ -32,7 +30,5 @@ module Nanoc::DataSources
32
30
  end
33
31
  end
34
32
  end
35
-
36
33
  end
37
-
38
34
  end
@@ -1,10 +1,8 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module Nanoc::DataSources
4
-
5
4
  # Provides functionality common across all filesystem data sources.
6
5
  module Filesystem
7
-
8
6
  # The VCS that will be called when adding, deleting and moving files. If
9
7
  # no VCS has been set, or if the VCS has been set to `nil`, a dummy VCS
10
8
  # will be returned.
@@ -101,14 +99,14 @@ module Nanoc::DataSources
101
99
 
102
100
  # Get attributes
103
101
  attributes = {
104
- :filename => content_filename,
105
- :content_filename => content_filename,
106
- :meta_filename => meta_filename,
107
- :extension => content_filename ? ext_of(content_filename)[1..-1] : nil,
102
+ filename: content_filename,
103
+ content_filename: content_filename,
104
+ meta_filename: meta_filename,
105
+ extension: content_filename ? ext_of(content_filename)[1..-1] : nil,
108
106
  # WARNING :file is deprecated; please create a File object manually
109
107
  # using the :content_filename or :meta_filename attributes.
110
- # TODO [in nanoc 4.0] remove me
111
- :file => content_filename ? Nanoc::Extra::FileProxy.new(content_filename) : nil
108
+ # TODO: [in nanoc 4.0] remove me
109
+ file: content_filename ? Nanoc::Extra::FileProxy.new(content_filename) : nil
112
110
  }.merge(meta)
113
111
 
114
112
  # Get identifier
@@ -136,7 +134,7 @@ module Nanoc::DataSources
136
134
  # Create layout object
137
135
  klass.new(
138
136
  content_or_filename, attributes, identifier,
139
- :binary => is_binary, :mtime => mtime
137
+ binary: is_binary, mtime: mtime
140
138
  )
141
139
  end
142
140
  end
@@ -153,7 +151,8 @@ module Nanoc::DataSources
153
151
  # 'content/qux' => [ nil, 'html' ]
154
152
  # }
155
153
  def all_split_files_in(dir_name)
156
- grouped_filenames = all_files_in(dir_name)
154
+ grouped_filenames =
155
+ all_files_in(dir_name)
157
156
  .reject { |fn| fn =~ /(~|\.orig|\.rej|\.bak)$/ }
158
157
  .group_by { |fn| basename_of(fn) }
159
158
 
@@ -180,7 +179,7 @@ module Nanoc::DataSources
180
179
 
181
180
  # Returns all files in the given directory and directories below it.
182
181
  def all_files_in(dir_name)
183
- Nanoc::Extra::FilesystemTools.all_files_in(dir_name)
182
+ Nanoc::Extra::FilesystemTools.all_files_in(dir_name, config[:extra_files])
184
183
  end
185
184
 
186
185
  # Returns the filename for the given base filename and the extension.
@@ -318,7 +317,5 @@ module Nanoc::DataSources
318
317
  def raise_encoding_error(filename, encoding)
319
318
  raise RuntimeError.new("Could not read #{filename} because the file is not valid #{encoding}.")
320
319
  end
321
-
322
320
  end
323
-
324
321
  end
@@ -1,7 +1,6 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module Nanoc::DataSources
4
-
5
4
  # The filesystem_unified data source stores its items and layouts in nested
6
5
  # directories. Items and layouts are represented by one or two files; if it
7
6
  # is represented using one file, the metadata can be contained in this file.
@@ -68,7 +67,6 @@ module Nanoc::DataSources
68
67
  # understood by Ruby’s `Encoding`. If no encoding is set in the configuration,
69
68
  # one will be inferred from the environment.
70
69
  class FilesystemUnified < Nanoc::DataSource
71
-
72
70
  include Nanoc::DataSources::Filesystem
73
71
 
74
72
  private
@@ -121,7 +119,5 @@ module Nanoc::DataSources
121
119
  end
122
120
  filename.sub(regex, '').cleaned_identifier
123
121
  end
124
-
125
122
  end
126
-
127
123
  end
@@ -1,7 +1,6 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module Nanoc::DataSources
4
-
5
4
  # The filesystem_verbose data source is the old data source for a new nanoc
6
5
  # site. It stores all data as files on the hard disk.
7
6
  #
@@ -40,7 +39,6 @@ module Nanoc::DataSources
40
39
  # understood by Ruby’s `Encoding`. If no encoding is set in the configuration,
41
40
  # one will be inferred from the environment.
42
41
  class FilesystemVerbose < Nanoc::DataSource
43
-
44
42
  include Nanoc::DataSources::Filesystem
45
43
 
46
44
  private
@@ -84,7 +82,5 @@ module Nanoc::DataSources
84
82
  def identifier_for_filename(filename)
85
83
  filename.sub(/[^\/]+\.yaml$/, '')
86
84
  end
87
-
88
85
  end
89
-
90
86
  end
@@ -1,7 +1,6 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module Nanoc::DataSources
4
-
5
4
  # The static data source provides items from a single directory. Unlike the
6
5
  # filesystem data sources, static provides no additional item metadata. In
7
6
  # addition, all items are treated as 'binary', regardless of their extension
@@ -26,7 +25,6 @@ module Nanoc::DataSources
26
25
  # exclude them from the Blogging helper's atom feed generator, among other
27
26
  # things.
28
27
  class Static < Nanoc::DataSource
29
-
30
28
  identifier :static
31
29
 
32
30
  def items
@@ -36,8 +34,8 @@ module Nanoc::DataSources
36
34
  # Convert filenames to items
37
35
  all_files_in(prefix).map do |filename|
38
36
  attributes = {
39
- :extension => File.extname(filename)[1..-1],
40
- :filename => filename,
37
+ extension: File.extname(filename)[1..-1],
38
+ filename: filename,
41
39
  }
42
40
  attributes[:is_hidden] = true unless config[:hide_items] == false
43
41
  identifier = filename[(prefix.length + 1)..-1] + '/'
@@ -48,7 +46,7 @@ module Nanoc::DataSources
48
46
  filename,
49
47
  attributes,
50
48
  identifier,
51
- :binary => true, :mtime => mtime, :checksum => checksum
49
+ binary: true, mtime: mtime, checksum: checksum
52
50
  )
53
51
  end
54
52
  end
@@ -56,9 +54,7 @@ module Nanoc::DataSources
56
54
  protected
57
55
 
58
56
  def all_files_in(dir_name)
59
- Nanoc::Extra::FilesystemTools.all_files_in(dir_name)
57
+ Nanoc::Extra::FilesystemTools.all_files_in(dir_name, config[:extra_files])
60
58
  end
61
-
62
59
  end
63
-
64
60
  end
@@ -1,7 +1,6 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module Nanoc::Extra
4
-
5
4
  autoload 'AutoCompiler', 'nanoc/extra/auto_compiler'
6
5
  autoload 'Checking', 'nanoc/extra/checking'
7
6
  autoload 'CHiCk', 'nanoc/extra/chick'
@@ -13,13 +12,12 @@ module Nanoc::Extra
13
12
  autoload 'JRubyNokogiriWarner', 'nanoc/extra/jruby_nokogiri_warner'
14
13
 
15
14
  # Deprecated; use {Nanoc::Context} instead
16
- # TODO [in nanoc 4.0] remove me
15
+ # TODO: [in nanoc 4.0] remove me
17
16
  Context = ::Nanoc::Context
18
17
 
19
18
  # Deprecated
20
- # TODO [in nanoc 4.0] remove me
19
+ # TODO: [in nanoc 4.0] remove me
21
20
  autoload 'FileProxy', 'nanoc/extra/file_proxy'
22
-
23
21
  end
24
22
 
25
23
  require 'nanoc/extra/core_ext'
@@ -1,11 +1,9 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module Nanoc::Extra
4
-
5
4
  # A web server that will automatically compile items as they are requested.
6
5
  # It also serves static files such as stylesheets and images.
7
6
  class AutoCompiler
8
-
9
7
  # @return [Nanoc::Site] The site this autocompiler belongs to
10
8
  attr_reader :site
11
9
 
@@ -38,10 +36,10 @@ module Nanoc::Extra
38
36
 
39
37
  # Find rep
40
38
  path = Rack::Utils.unescape(env['PATH_INFO'])
41
- reps = site.items.map { |i| i.reps }.flatten
39
+ reps = site.items.map(&:reps).flatten
42
40
  rep = reps.find do |r|
43
41
  r.path == path ||
44
- r.raw_path == site.config[:output_dir] + path
42
+ r.raw_path == site.config[:output_dir] + path
45
43
  end
46
44
 
47
45
  # Recompile
@@ -97,7 +95,5 @@ module Nanoc::Extra
97
95
  def stack
98
96
  site.compiler.stack
99
97
  end
100
-
101
98
  end
102
-
103
99
  end
@@ -1,16 +1,12 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module Nanoc::Extra
4
-
5
4
  module Checking
6
-
7
5
  autoload 'Check', 'nanoc/extra/checking/check'
8
6
  autoload 'DSL', 'nanoc/extra/checking/dsl'
9
7
  autoload 'Runner', 'nanoc/extra/checking/runner.rb'
10
8
  autoload 'Issue', 'nanoc/extra/checking/issue'
11
-
12
9
  end
13
-
14
10
  end
15
11
 
16
12
  require 'nanoc/extra/checking/checks'
@@ -1,7 +1,6 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module Nanoc::Extra::Checking
4
-
5
4
  class OutputDirNotFoundError < Nanoc::Errors::Generic
6
5
  def initialize(directory_path)
7
6
  super("Unable to run check against output directory at “#{directory_path}”: directory does not exist.")
@@ -9,7 +8,6 @@ module Nanoc::Extra::Checking
9
8
  end
10
9
 
11
10
  class Check
12
-
13
11
  extend Nanoc::PluginRegistry::PluginMethods
14
12
 
15
13
  attr_reader :site
@@ -37,7 +35,5 @@ module Nanoc::Extra::Checking
37
35
  end
38
36
  Dir[output_dir + '/**/*'].select { |f| File.file?(f) }
39
37
  end
40
-
41
38
  end
42
-
43
39
  end