module Eighty def self.source(source) Source.load_dir(source) end module Source def self.load_dir(source) source = File.expand_path(source) files = Dir.glob("#{source}/**/*").select { |f| File.file?(f) } files.each do |file| item = Item.new item.content = File.read(file) item.source_path = Pathname.new(file).relative_path_from(source).to_s item.source_absolute_path = file item.source_base = source item.extname = File.extname(file) item.path = item.source_path Eighty.metadata.items.push(item) end end end end