class TaskJuggler::TjpExportRE

This specialization of ReportBase implements an export of the project data in the TJP syntax format.

Public Class Methods

new(report) click to toggle source

Create a new object and set some default values.

Calls superclass method TaskJuggler::ReportBase::new
# File lib/taskjuggler/reports/TjpExportRE.rb, line 23
def initialize(report)
  super(report)

  @supportedTaskAttrs = %w( booking complete depends flags maxend
                            maxstart minend minstart note priority
                            projectid responsible )
  @supportedResourceAttrs = %w( booking flags shifts vacation workinghours )
end

Public Instance Methods

generateIntermediateFormat() click to toggle source
# File lib/taskjuggler/reports/TjpExportRE.rb, line 32
def generateIntermediateFormat
  super
end
to_tjp() click to toggle source

Return the project data in TJP syntax format.

# File lib/taskjuggler/reports/TjpExportRE.rb, line 37
def to_tjp
  # Prepare the resource list.
  @resourceList = PropertyList.new(@project.resources)
  @resourceList.setSorting(a('sortResources'))
  @resourceList = filterResourceList(@resourceList, nil, a('hideResource'),
                                     a('rollupResource'), a('openNodes'))
  @resourceList.sort!

  # Prepare the task list.
  @taskList = PropertyList.new(@project.tasks)
  @taskList.setSorting(a('sortTasks'))
  @taskList = filterTaskList(@taskList, nil, a('hideTask'), a('rollupTask'),
                             a('openNodes'))
  @taskList.sort!

  getBookings

  @file = ''

  generateProjectProperty if a('definitions').include?('project')

  generateFlagDeclaration if a('definitions').include?('flags')
  generateProjectIDs if a('definitions').include?('projectids')

  generateShiftList if a('definitions').include?('shifts')

  generateResourceList if a('definitions').include?('resources')
  generateTaskList if a('definitions').include?('tasks')

  generateTaskAttributes unless a('taskAttributes').empty?
  generateResourceAttributes unless a('resourceAttributes').empty?

  @file
end