1
0
Fork 0
mirror of https://github.com/fmap/muflax65ngodyewp.onion synced 2024-06-26 10:26:48 +02:00
muflax65ngodyewp.onion/lib/filesystem_customizable.rb
muflax a6d7f7014a better reference handling
* split reference file
* internal links are cached and shared between sites
* find duplicates with "nanoc dups"
* minor clean-ups
2012-04-15 22:45:39 +02:00

32 lines
768 B
Ruby

module DataSources
# data_sources:
# -
# type: filesystem_customizable
# config:
# source_dir: ["src"]
# layout_dir: ["layouts", "other_layouts"]
class FilesystemCustomizable < Nanoc::DataSources::FilesystemUnified
identifier :filesystem_customizable
def setup
# Create directories
(@sources + @layouts).each { |dir| FileUtils.mkdir_p dir }
end
def items
@sources.map do |dir|
load_objects(dir, 'item', Nanoc::Item)
end.flatten
end
def layouts
@layouts.map do |dir|
load_objects(dir, 'layout', Nanoc::Layout)
end.flatten
end
def up
@sources = ['content'] + (config[:source_dir] || [])
@layouts = ['layouts'] + (config[:layout_dir] || [])
end
end
end