lib/plans/publish.rb
def get_doctype(path)
      doc_type = nil
      begin
        metadata = YAML.load_file(path + 'template.yml')
        doc_type = metadata['type']
        if doc_type.nil?
          say 'Type value not found. Check template.yml in the document directory', :red
          say 'Make sure there is an entry `type: DOC_TYPE` in the file.'
          say "  #{path}"
          raise_error('DOC_TYPE not found in template.yml')
        end
      rescue Errno::ENOENT # File not found
        say 'No template.yml found in the document directory. Did you forget to add it?', :red
        say 'Did you run the command in the directory where the document is located?'
        say "  #{path}"
        raise_error('template.yml not found')
      end
      return doc_type
    end
def get_doctype(path)
      doc_type = nil
      begin
        metadata = YAML.load_file(path + 'template.yml')
        doc_type = metadata['type']
        if doc_type.nil?
          say 'Type value not found. Check template.yml in the document directory', :red
          say 'Make sure there is an entry `type: DOC_TYPE` in the file.'
          say "  #{path}"
          raise_error('DOC_TYPE not found in template.yml')
        end
      rescue Errno::ENOENT # File not found
        say 'No template.yml found in the document directory. Did you forget to add it?', :red
        say 'Did you run the command in the directory where the document is located?'
        say "  #{path}"
        raise_error('template.yml not found')
      end
      return doc_type
    end
Get the document type from the YAML file next to the document.

 @param [Pathname] The path to the location of the template.yml file.
 @return [String] the type of the document found in the YAML file.