def metadata_field(file, field)
      until (file.split(File::SEPARATOR) & standard_cookbook_subdirs).empty?
        file = File.absolute_path(File.dirname(file.to_s))
      end
      file = File.dirname(file) unless File.extname(file).empty?

      md_path = File.join(file, "metadata.rb")
      if File.exist?(md_path)
        value = read_ast(md_path).xpath("//stmts_add/
          command[ident/@value='#{field}']/
          descendant::tstring_content/@value").to_s
        raise "Cant read #{field} from #{md_path}" if value.to_s.empty?
        return value
      else
        raise "Cant find #{md_path}"
      end
    end
def metadata_field(file, field)
      until (file.split(File::SEPARATOR) & standard_cookbook_subdirs).empty?
        file = File.absolute_path(File.dirname(file.to_s))
      end
      file = File.dirname(file) unless File.extname(file).empty?

      md_path = File.join(file, "metadata.rb")
      if File.exist?(md_path)
        value = read_ast(md_path).xpath("//stmts_add/
          command[ident/@value='#{field}']/
          descendant::tstring_content/@value").to_s
        raise "Cant read #{field} from #{md_path}" if value.to_s.empty?
        return value
      else
        raise "Cant find #{md_path}"
      end
    end
Retrieves a value of a metadata field.

 @author Miguel Fonseca
 @since 7.0.0
 @return [String] the value of the metadata field