mirror of
https://github.com/fmap/muflax65ngodyewp.onion
synced 2024-07-01 10:46:49 +02:00
* multiple styles, layouts * shared content * central pigs * conditional htaccess * first half of multiple configs
37 lines
906 B
Ruby
37 lines
906 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] || [])
|
|
@dtstart = Time.now
|
|
end
|
|
def down
|
|
@dtend = Time.now
|
|
puts "Data loaded in #{format('%.2f', @dtend - @dtstart)}s."
|
|
end
|
|
end
|
|
end
|