lib/docman/docroot_config.rb in docman-0.0.4 vs lib/docman/docroot_config.rb in docman-0.0.5
- old
+ new
@@ -21,37 +21,39 @@
end
def structure_build(path, prefix = '', parent = nil)
return unless File.file? File.join(path, 'info.yaml')
+ children = []
info = YAML::load_file(File.join(path, 'info.yaml'))
name = File.basename path
prefix = prefix.size > 0 ? File.join(prefix, name) : name
info['full_path'] = path
info['docroot_config'] = self
info['build_path'] = prefix
info['full_build_path'] = File.join(@docroot_dir, prefix)
info['temp_path'] = File.join(@docroot_dir, 'tmp', info['build_path'])
info['name'] = name
info['parent'] = parent
+ info['children'] = children
i = Docman::Info.new(info)
@names[name.to_s] = i
- data = {:data => info, :info => i}
- data[:children] = children = []
+ data = [i]
+ # data[:children] = children
Dir.foreach(path) do |entry|
next if (entry == '..' || entry == '.')
full_path = File.join(path, entry)
if File.directory?(full_path)
dir_hash = structure_build(full_path, prefix, i)
unless dir_hash == nil
children << dir_hash
end
end
end
- data
+ i
end
def chain(info)
chain = {}
\ No newline at end of file