module Docman class Info < Hash def initialize(hash = {}) super hash.each_pair do |k, v| self[k] = v end set_build_type # self['rebuild'] = need_rebuild? end def version(state) self['states'][state].nil? ? nil : self['states'][state]['version'] end def version_type(state) self['states'][state].nil? ? nil : self['states'][state]['type'] end def need_rebuild? return TRUE if Docman::Application.instance.options[:force] return TRUE unless File.directory? self['full_build_path'] info_filename = File.join(self['full_build_path'], 'info.yaml') return TRUE unless File.file?(info_filename) version = YAML::load_file(info_filename) return TRUE if version['type'] != self['type'] return TRUE if version['build_type'] != self['build_type'] false end def set_build_type Docman::Application.instance.deploy_target['builders'][self['type']]['type'] end end end