Class TaskJuggler::TagFile
In: lib/taskjuggler/reports/TagFile.rb
Parent: ReportBase

This class specializes ReportBase to generate tag files used by editors such as vim.

Methods

Classes and Modules

Class TaskJuggler::TagFile::TagFileEntry

Public Class methods

[Source]

# File lib/taskjuggler/reports/TagFile.rb, line 54
    def initialize(report)
      super
    end

Public Instance methods

[Source]

# File lib/taskjuggler/reports/TagFile.rb, line 58
    def generateIntermediateFormat
      super

      @tags = []

      # Add the resources.
      @resourceList = PropertyList.new(@project.resources)
      @resourceList.setSorting(a('sortResources'))
      @resourceList = filterResourceList(@resourceList, nil, a('hideResource'),
                                         a('rollupResource'), a('openNodes'))
      @resourceList.each do |resource|
        next unless resource.sourceFileInfo
        @tags << TagFileEntry.new(resource.fullId,
                                  resource.sourceFileInfo.fileName,
                                  resource.sourceFileInfo.lineNo, 'r')
      end

      # Add the tasks.
      @taskList = PropertyList.new(@project.tasks)
      @taskList.setSorting(a('sortTasks'))
      @taskList = filterTaskList(@taskList, nil, a('hideTask'), a('rollupTask'),
                                 a('openNodes'))
      @taskList.each do |task|
        next unless task.sourceFileInfo
        @tags << TagFileEntry.new(task.fullId,
                                  task.sourceFileInfo.fileName,
                                  task.sourceFileInfo.lineNo, 't')
      end

      # Add the reports.
      @project.reports.each do |report|
        next unless report.sourceFileInfo
        @tags << TagFileEntry.new(report.fullId,
                                  report.sourceFileInfo.fileName,
                                  report.sourceFileInfo.lineNo, 'p')
      end
    end

Returns a String that contains the content of the ctags file. See vimdoc.sourceforge.net/htmldoc/tagsrch.html for the spec.

[Source]

# File lib/taskjuggler/reports/TagFile.rb, line 98
    def to_ctags
      # The ctags header. Not used if this is really needed.
      s = "!_TAG_FILE_FORMAT       2     /extended format; --format=1 will not append ;\" to lines/\n!_TAG_FILE_SORTED       1     /0=unsorted, 1=sorted, 2=foldcase/\n!_TAG_PROGRAM_AUTHOR    \#{AppConfig.authors.join(';')}     //\n!_TAG_PROGRAM_NAME      \#{AppConfig.softwareName}    //\n!_TAG_PROGRAM_URL       \#{AppConfig.contact}  /official site/\n!_TAG_PROGRAM_VERSION   \#{AppConfig.version}      //\n"

      # Turn the list of Tags into ctags lines.
      @tags.sort.each do |tag|
        s << tag.to_ctags
      end

      s
    end

[Validate]