lib/nanoc/data_sources/filesystem.rb in nanoc-2.1.4 vs lib/nanoc/data_sources/filesystem.rb in nanoc-2.1.5
- old
+ new
@@ -218,11 +218,11 @@
# Get content file
content_filename = content_filename_for_dir(File.dirname(meta_filename))
content_file = File.new(content_filename)
# Get attributes
- attributes = meta.merge(:extension => File.extname(content_filename)[1..-1])
+ attributes = { 'extension' => File.extname(content_filename)[1..-1] }.merge(meta)
# Get path
path = meta_filename.sub(/^assets/, '').sub(/[^\/]+\.yaml$/, '')
# Get modification times
@@ -361,12 +361,11 @@
########## Layouts ##########
def layouts # :nodoc:
# Determine what layout directory structure is being used
- dir_count = Dir[File.join('layouts', '*')].select { |f| File.directory?(f) }.size
- is_old_school = (dir_count == 0)
+ 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\'.',
@@ -412,11 +411,11 @@
end
end
def save_layout(layout) # :nodoc:
# Determine what layout directory structure is being used
- layout_file_count = Dir[File.join('layouts', '*')].select { |f| File.file?(f) }.size
- error_outdated if layout_file_count > 0
+ is_old_school = (Dir['layouts/*'].select { |f| File.file?(f) }.size > 0)
+ error_outdated if is_old_school
# Get paths
last_component = layout.path.split('/')[-1]
dir_path = 'layouts' + layout.path
meta_filename = dir_path + last_component + '.yaml'