class TaskJuggler::TagFile

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

Public Class Methods

new(report) click to toggle source
Calls superclass method TaskJuggler::ReportBase.new
# File lib/taskjuggler/reports/TagFile.rb, line 53
def initialize(report)
  super
end

Public Instance Methods

generateIntermediateFormat() click to toggle source
# File lib/taskjuggler/reports/TagFile.rb, line 57
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
to_ctags() click to toggle source

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

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

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

      s
    end