lib/nanoc/data_sources/filesystem.rb in nanoc-2.1.6 vs lib/nanoc/data_sources/filesystem.rb in nanoc-2.2

- old
+ new

@@ -118,11 +118,10 @@ end def update # :nodoc: update_page_defaults update_pages - update_layouts update_templates end ########## Pages ########## @@ -366,12 +365,13 @@ is_old_school = (Dir['layouts/*'].select { |f| File.file?(f) }.size > 0) if is_old_school # Warn about deprecation warn( - 'nanoc 2.1 changes the way layouts are stored. Future versions will not support these outdated sites. To update your site, issue \'nanoc update\'.', - 'DEPRECATION WARNING' + 'DEPRECATION WARNING: nanoc 2.1 changes the way layouts are ' + + 'stored. Future versions will not support these outdated sites. ' + + 'To update your site, issue \'nanoc update\'.' ) Dir[File.join('layouts', '*')].reject { |f| f =~ /~$/ }.map do |filename| # Get content content = File.read(filename) @@ -674,44 +674,9 @@ new_filename = old_filename.sub(/([^\/]+)\/meta.yaml$/, '\1/\1.yaml') end # Move vcs.move(old_filename, new_filename) - end - end - - # Updates outdated layouts. - def update_layouts - # layouts/abc.ext -> layouts/abc/abc.{html,yaml} - Dir[File.join('layouts', '*')].select { |f| File.file?(f) }.each do |filename| - # Get filter class - filter_class = Nanoc::Filter.with_extension(File.extname(filename)) - - # Get data - content = File.read(filename) - attributes = { :filter => filter_class.identifier.to_s } - path = File.basename(filename, File.extname(filename)) - - # Get layout - tmp_layout = Nanoc::Layout.new(content, attributes, path) - - # Get filenames - last_component = tmp_layout.path.split('/')[-1] - dir_path = 'layouts' + tmp_layout.path - meta_filename = dir_path + last_component + '.yaml' - content_filename = dir_path + last_component + File.extname(filename) - - # Create new files - FileUtils.mkdir_p(dir_path) - File.open(meta_filename, 'w') { |io| io.write(tmp_layout.attributes.to_split_yaml) } - File.open(content_filename, 'w') { |io| io.write(tmp_layout.content) } - - # Add - vcs.add(meta_filename) - vcs.add(content_filename) - - # Delete old files - vcs.remove(filename) end end # Updates outdated templates (both content and meta file names). def update_templates