lib/docman/docroot_config.rb in docman-0.0.6 vs lib/docman/docroot_config.rb in docman-0.0.7

- old
+ new

@@ -3,21 +3,22 @@ module Docman class DocrootConfig - attr_reader :structure, :deploy_target, :docroot_dir, :root + attr_reader :structure, :deploy_target, :docroot_dir, :root, :raw_infos + def initialize(docroot_dir, deploy_target) @docroot_dir = docroot_dir @deploy_target = deploy_target @docroot_config_dir = File.join(docroot_dir, 'config') update if File.file? File.join(@docroot_config_dir, 'config.yaml') Docman::Application.instance.config.merge_config_from_file(File.join(@docroot_config_dir, 'config.yaml')) end @names = {} - @raw_infos = [] + @raw_infos = {} @structure = structure_build File.join(@docroot_config_dir, 'master') end def update GitUtil.update @docroot_config_dir @@ -26,11 +27,11 @@ 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')) - @raw_infos << YAML::load_file(File.join(path, 'info.yaml')) + @raw_infos[File.basename path] = YAML::load_file(File.join(path, 'info.yaml')) unless info['status'].nil? return if info['status'] == 'disabled' end name = File.basename path prefix = prefix.size > 0 ? File.join(prefix, name) : name @@ -84,9 +85,13 @@ states end def config_hash Digest::MD5.hexdigest(Marshal::dump(@raw_infos)) + end + + def root_path + @root['fuil_build_path'] end end end \ No newline at end of file