Class: TaskJuggler
- Includes:
- MessageHandler
- Defined in:
- lib/taskjuggler/Booking.rb,
lib/taskjuggler/Log.rb,
lib/taskjuggler/Task.rb,
lib/taskjuggler/Query.rb,
lib/taskjuggler/Shift.rb,
lib/taskjuggler/Charge.rb,
lib/taskjuggler/Limits.rb,
lib/taskjuggler/TjTime.rb,
lib/taskjuggler/Account.rb,
lib/taskjuggler/Journal.rb,
lib/taskjuggler/Painter.rb,
lib/taskjuggler/Project.rb,
lib/taskjuggler/FileList.rb,
lib/taskjuggler/Interval.rb,
lib/taskjuggler/PTNProxy.rb,
lib/taskjuggler/Resource.rb,
lib/taskjuggler/RichText.rb,
lib/taskjuggler/Scenario.rb,
lib/taskjuggler/apps/Tj3.rb,
lib/taskjuggler/ChargeSet.rb,
lib/taskjuggler/DataCache.rb,
lib/taskjuggler/ICalendar.rb,
lib/taskjuggler/LeaveList.rb,
lib/taskjuggler/VimSyntax.rb,
lib/taskjuggler/Allocation.rb,
lib/taskjuggler/Attributes.rb,
lib/taskjuggler/KateSyntax.rb,
lib/taskjuggler/RealFormat.rb,
lib/taskjuggler/Scoreboard.rb,
lib/taskjuggler/TextParser.rb,
lib/taskjuggler/TimeSheets.rb,
lib/taskjuggler/Tj3AppBase.rb,
lib/taskjuggler/TjpExample.rb,
lib/taskjuggler/UserManual.rb,
lib/taskjuggler/XMLElement.rb,
lib/taskjuggler/PropertySet.rb,
lib/taskjuggler/SheetSender.rb,
lib/taskjuggler/TaskJuggler.rb,
lib/taskjuggler/TjException.rb,
lib/taskjuggler/XMLDocument.rb,
lib/taskjuggler/apps/Tj3Man.rb,
lib/taskjuggler/HTMLDocument.rb,
lib/taskjuggler/HTMLElements.rb,
lib/taskjuggler/IntervalList.rb,
lib/taskjuggler/KeywordArray.rb,
lib/taskjuggler/Painter/Text.rb,
lib/taskjuggler/PropertyList.rb,
lib/taskjuggler/ScenarioData.rb,
lib/taskjuggler/StdIoWrapper.rb,
lib/taskjuggler/TaskScenario.rb,
lib/taskjuggler/URLParameter.rb,
lib/taskjuggler/WorkingHours.rb,
lib/taskjuggler/apps/Tj3WebD.rb,
lib/taskjuggler/AccountCredit.rb,
lib/taskjuggler/AttributeBase.rb,
lib/taskjuggler/Painter/Color.rb,
lib/taskjuggler/Painter/Group.rb,
lib/taskjuggler/RichText/Snip.rb,
lib/taskjuggler/SheetReceiver.rb,
lib/taskjuggler/ShiftScenario.rb,
lib/taskjuggler/TextFormatter.rb,
lib/taskjuggler/daemon/Daemon.rb,
lib/taskjuggler/BatchProcessor.rb,
lib/taskjuggler/MessageHandler.rb,
lib/taskjuggler/Painter/Points.rb,
lib/taskjuggler/TaskDependency.rb,
lib/taskjuggler/TjpSyntaxRules.rb,
lib/taskjuggler/apps/Tj3Client.rb,
lib/taskjuggler/apps/Tj3Daemon.rb,
lib/taskjuggler/reports/Report.rb,
lib/taskjuggler/AccountScenario.rb,
lib/taskjuggler/LogicalFunction.rb,
lib/taskjuggler/Painter/Element.rb,
lib/taskjuggler/RichText/Parser.rb,
lib/taskjuggler/SyntaxReference.rb,
lib/taskjuggler/TimeSheetSender.rb,
lib/taskjuggler/Tj3SheetAppBase.rb,
lib/taskjuggler/reports/CSVFile.rb,
lib/taskjuggler/reports/TagFile.rb,
lib/taskjuggler/LogicalOperation.rb,
lib/taskjuggler/Painter/FontData.rb,
lib/taskjuggler/PropertyTreeNode.rb,
lib/taskjuggler/ResourceScenario.rb,
lib/taskjuggler/RichText/Element.rb,
lib/taskjuggler/RichText/Scanner.rb,
lib/taskjuggler/SheetHandlerBase.rb,
lib/taskjuggler/ShiftAssignments.rb,
lib/taskjuggler/TimeSheetSummary.rb,
lib/taskjuggler/apps/Tj3SsSender.rb,
lib/taskjuggler/apps/Tj3TsSender.rb,
lib/taskjuggler/daemon/WebServer.rb,
lib/taskjuggler/reports/ExportRE.rb,
lib/taskjuggler/reports/MspXmlRE.rb,
lib/taskjuggler/LogicalExpression.rb,
lib/taskjuggler/ProjectFileParser.rb,
lib/taskjuggler/RichText/Document.rb,
lib/taskjuggler/RichText/RTFQuery.rb,
lib/taskjuggler/RichText/TOCEntry.rb,
lib/taskjuggler/StatusSheetSender.rb,
lib/taskjuggler/TableColumnSorter.rb,
lib/taskjuggler/TernarySearchTree.rb,
lib/taskjuggler/TimeSheetReceiver.rb,
lib/taskjuggler/apps/Tj3TsSummary.rb,
lib/taskjuggler/reports/GanttLine.rb,
lib/taskjuggler/reports/Navigator.rb,
lib/taskjuggler/Painter/Primitives.rb,
lib/taskjuggler/Painter/SVGSupport.rb,
lib/taskjuggler/ProjectFileScanner.rb,
lib/taskjuggler/RichText/RTFReport.rb,
lib/taskjuggler/apps/Tj3SsReceiver.rb,
lib/taskjuggler/apps/Tj3TsReceiver.rb,
lib/taskjuggler/daemon/WelcomePage.rb,
lib/taskjuggler/reports/GanttChart.rb,
lib/taskjuggler/reports/ICalReport.rb,
lib/taskjuggler/reports/NikuReport.rb,
lib/taskjuggler/reports/ReportBase.rb,
lib/taskjuggler/reports/TaskListRE.rb,
lib/taskjuggler/reports/TextReport.rb,
lib/taskjuggler/AttributeDefinition.rb,
lib/taskjuggler/Painter/BasicShapes.rb,
lib/taskjuggler/Painter/FontMetrics.rb,
lib/taskjuggler/SimpleQueryExpander.rb,
lib/taskjuggler/StatusSheetReceiver.rb,
lib/taskjuggler/daemon/ReportServer.rb,
lib/taskjuggler/reports/ColumnTable.rb,
lib/taskjuggler/reports/GanttHeader.rb,
lib/taskjuggler/reports/GanttRouter.rb,
lib/taskjuggler/reports/ReportTable.rb,
lib/taskjuggler/reports/TableReport.rb,
lib/taskjuggler/reports/TjpExportRE.rb,
lib/taskjuggler/reports/TraceReport.rb,
lib/taskjuggler/KeywordDocumentation.rb,
lib/taskjuggler/RichText/RTFHandlers.rb,
lib/taskjuggler/RichText/SyntaxRules.rb,
lib/taskjuggler/daemon/ProjectBroker.rb,
lib/taskjuggler/daemon/ProjectServer.rb,
lib/taskjuggler/daemon/ReportServlet.rb,
lib/taskjuggler/reports/ChartPlotter.rb,
lib/taskjuggler/reports/GanttTaskBar.rb,
lib/taskjuggler/reports/HTMLGraphics.rb,
lib/taskjuggler/AlertLevelDefinitions.rb,
lib/taskjuggler/RichText/RTFNavigator.rb,
lib/taskjuggler/TableColumnDefinition.rb,
lib/taskjuggler/reports/AccountListRE.rb,
lib/taskjuggler/reports/ReportContext.rb,
lib/taskjuggler/RichText/RTFReportLink.rb,
lib/taskjuggler/daemon/DaemonConnector.rb,
lib/taskjuggler/daemon/ProcessIntercom.rb,
lib/taskjuggler/reports/GanttContainer.rb,
lib/taskjuggler/reports/GanttLoadStack.rb,
lib/taskjuggler/reports/GanttMilestone.rb,
lib/taskjuggler/reports/ResourceListRE.rb,
lib/taskjuggler/Painter/FontMetricsData.rb,
lib/taskjuggler/reports/ReportTableCell.rb,
lib/taskjuggler/reports/ReportTableLine.rb,
lib/taskjuggler/reports/TimeSheetReport.rb,
lib/taskjuggler/RichText/FunctionExample.rb,
lib/taskjuggler/RichText/FunctionHandler.rb,
lib/taskjuggler/RichText/TableOfContents.rb,
lib/taskjuggler/TextParser/SourceFileInfo.rb,
lib/taskjuggler/reports/CollisionDetector.rb,
lib/taskjuggler/reports/ReportTableColumn.rb,
lib/taskjuggler/reports/ReportTableLegend.rb,
lib/taskjuggler/reports/StatusSheetReport.rb,
lib/taskjuggler/reports/TableReportColumn.rb,
lib/taskjuggler/RichText/RTFWithQuerySupport.rb,
lib/taskjuggler/reports/GanttHeaderScaleItem.rb
Overview
GanttHeaderScaleItem.rb – The TaskJuggler III Project Management Software
Copyright © 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014
by Chris Schlaeger <[email protected]>
This program is free software; you can redistribute it and/or modify it under the terms of version 2 of the GNU General Public License as published by the Free Software Foundation.
Defined Under Namespace
Modules: DaemonConnectorMixin, HTMLElements, HTMLGraphics, MessageHandler, ProcessIntercom, ProcessIntercomIface, RichTextSyntaxRules, StdIoWrapper, TjpSyntaxRules Classes: Account, AccountAttribute, AccountCredit, AccountCreditListAttribute, AccountListRE, AccountScenario, AlertLevelDefinition, AlertLevelDefinitions, Allocation, AllocationAttribute, AttributeBase, AttributeDefinition, AttributeOverwrite, BatchProcessor, Booking, BookingListAttribute, BooleanAttribute, CSVFile, CellSettingPattern, CellSettingPatternList, Charge, ChargeListAttribute, ChargeSet, ChargeSetListAttribute, ChartPlotter, ChartPlotterError, CollisionDetector, ColumnListAttribute, ColumnTable, Daemon, DaemonConnector, DataCache, DataCacheEntry, DateAttribute, DefinitionListAttribute, DependencyListAttribute, DurationAttribute, ExportRE, FileList, FileRecord, FlagListAttribute, FloatAttribute, FormatListAttribute, GanttChart, GanttContainer, GanttHeader, GanttHeaderScaleItem, GanttLine, GanttLoadStack, GanttMilestone, GanttRouter, GanttTaskBar, HTMLDocument, ICalReport, ICalendar, IntegerAttribute, Interval, IntervalList, JobInfo, Journal, JournalEntry, JournalEntryList, JournalSortListAttribute, KateSyntax, KeywordArray, KeywordDocumentation, Leave, LeaveAllowance, LeaveAllowanceList, LeaveAllowanceListAttribute, LeaveList, LeaveListAttribute, Limits, LimitsAttribute, ListAttributeBase, Log, LogicalAttribute, LogicalExpression, LogicalExpressionAttribute, LogicalExpressionListAttribute, LogicalFlag, LogicalFunction, LogicalOperation, ManagerResponsibilities, ManagerStatusRecord, Message, MessageHandlerInstance, MspXmlRE, Navigator, NavigatorElement, NikuProject, NikuReport, NikuResource, NodeListAttribute, PTNProxy, Painter, PlaceHolderCell, Project, ProjectBroker, ProjectBrokerIface, ProjectFileParser, ProjectFileScanner, ProjectRecord, ProjectServer, ProjectServerIface, PropertyAttribute, PropertyList, PropertySet, PropertyTreeNode, Query, RTFHandlers, RTFNavigator, RTFQuery, RTFReport, RTFReportLink, RTFWithQuerySupport, RealFormat, RealFormatAttribute, ReferenceAttribute, Report, ReportBase, ReportContext, ReportScenario, ReportServer, ReportServerIface, ReportServerRecord, ReportServlet, ReportTable, ReportTableCell, ReportTableColumn, ReportTableLegend, ReportTableLine, Resource, ResourceListAttribute, ResourceListRE, ResourceScenario, RichText, RichTextAttribute, RichTextDocument, RichTextElement, RichTextFunctionExample, RichTextFunctionHandler, RichTextImage, RichTextIntermediate, RichTextParser, RichTextScanner, RichTextSnip, Scenario, ScenarioData, ScenarioListAttribute, Scoreboard, ScoreboardInterval, SheetHandlerBase, SheetReceiver, SheetSender, Shift, ShiftAssignment, ShiftAssignments, ShiftAssignmentsAttribute, ShiftScenario, SimpleQueryExpander, SortListAttribute, StatusSheetReceiver, StatusSheetReport, StatusSheetSender, StringAttribute, SymbolAttribute, SymbolListAttribute, SyntaxReference, TOCEntry, TSResourceRecord, TSTaskRecord, TableColumnDefinition, TableColumnSorter, TableOfContents, TableReport, TableReportColumn, TagFile, Task, TaskDepListAttribute, TaskDependency, TaskListAttribute, TaskListRE, TaskScenario, TernarySearchTree, TextFormatter, TextParser, TextReport, TimeInterval, TimeIntervalListAttribute, TimeSheet, TimeSheetReceiver, TimeSheetRecord, TimeSheetReport, TimeSheetSender, TimeSheetSummary, TimeSheets, Tj3, Tj3AppBase, Tj3Client, Tj3Daemon, Tj3Man, Tj3SheetAppBase, Tj3SsReceiver, Tj3SsSender, Tj3TsReceiver, Tj3TsSender, Tj3TsSummary, Tj3WebD, TjException, TjRuntimeError, TjTime, TjpExample, TjpExportRE, TraceReport, URLParameter, UserManual, VimSyntax, WebServer, WelcomePage, WorkingHours, WorkingHoursAttribute, XMLBlob, XMLComment, XMLDocument, XMLElement, XMLNamedText, XMLText
Instance Attribute Summary collapse
-
#generateTraces ⇒ Object
Returns the value of attribute generateTraces.
-
#maxCpuCores ⇒ Object
Returns the value of attribute maxCpuCores.
-
#project ⇒ Object
readonly
Returns the value of attribute project.
-
#warnTsDeltas ⇒ Object
Returns the value of attribute warnTsDeltas.
Instance Method Summary collapse
-
#checkStatusSheet(fileName) ⇒ Object
Check the content of the file fileName and interpret it as a status sheet.
-
#checkTimeSheet(fileName) ⇒ Object
Check the content of the file fileName and interpret it as a time sheet.
-
#errors ⇒ Object
Return the number of errors that had been reported during processing.
-
#freeze(freezeDate, taskBookings) ⇒ Object
Generate an export report definition for bookings up to the freezeDate.
-
#generateReport(reportId, regExpMode, formats = nil, dynamicAttributes = nil) ⇒ Object
Generate the report with the ID reportId.
-
#generateReports(outputDir = nil) ⇒ Object
Generate all specified reports.
-
#initialize ⇒ TaskJuggler
constructor
Create a new TaskJuggler object.
-
#listReports(reportId, regExpMode) ⇒ Object
List the details of the report with reportId or if regExpMode the reports that match the regular expression in reportId.
-
#parse(files, keepParser = false) ⇒ Object
Read in the files passed as file names in files, parse them and construct a Project object.
-
#parseFile(fileName, rule) ⇒ Object
Parse a file and add the content to the existing project.
-
#projectId ⇒ Object
Return the ID of the project or nil if no project has been loaded yet.
-
#projectName ⇒ Object
Return the name of the project or nil if no project has been loaded yet.
-
#schedule ⇒ Object
Schedule all scenarios in the project.
Methods included from MessageHandler
#critical, #debug, #error, #fatal, #info, #warning
Constructor Details
#initialize ⇒ TaskJuggler
Create a new TaskJuggler object. console is a boolean that determines whether or not messages can be written to $stderr.
33 34 35 36 37 38 39 40 |
# File 'lib/taskjuggler/TaskJuggler.rb', line 33 def initialize @project = nil @parser = nil @maxCpuCores = 1 @warnTsDeltas = false @generateTraces = false TjTime.setTimeZone('UTC') end |
Instance Attribute Details
#generateTraces ⇒ Object
Returns the value of attribute generateTraces.
29 30 31 |
# File 'lib/taskjuggler/TaskJuggler.rb', line 29 def generateTraces @generateTraces end |
#maxCpuCores ⇒ Object
Returns the value of attribute maxCpuCores.
29 30 31 |
# File 'lib/taskjuggler/TaskJuggler.rb', line 29 def maxCpuCores @maxCpuCores end |
#project ⇒ Object (readonly)
Returns the value of attribute project.
28 29 30 |
# File 'lib/taskjuggler/TaskJuggler.rb', line 28 def project @project end |
#warnTsDeltas ⇒ Object
Returns the value of attribute warnTsDeltas.
29 30 31 |
# File 'lib/taskjuggler/TaskJuggler.rb', line 29 def warnTsDeltas @warnTsDeltas end |
Instance Method Details
#checkStatusSheet(fileName) ⇒ Object
Check the content of the file fileName and interpret it as a status sheet. If the sheet is syntactically correct and matches the loaded project, true is returned. Otherwise false.
338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 |
# File 'lib/taskjuggler/TaskJuggler.rb', line 338 def checkStatusSheet(fileName) begin Log.enter('checkStatusSheet', 'Parsing #{fileName} ...') # To use this feature, the user must have specified which scenario is # the tracking scenario. unless @project['trackingScenarioIdx'] raise TjException.new, 'No trackingscenario defined' end return false unless (ss = parseFile(fileName, :statusSheetFile)) queryAttrs = { 'project' => @project, 'property' => ss[0], 'scopeProperty' => nil, 'scenarioIdx' => @project['trackingScenarioIdx'], 'start' => ss[1], 'end' => ss[2], 'timeFormat' => '%Y-%m-%d', 'selfContained' => true } query = Query.new(queryAttrs) puts ss[0].query_dashboard(query).richText.inputText rescue TjException => msg if msg. && !msg..empty? critical('check_status_sheet', msg.) end Log.exit('checkStatusSheet') return false end Log.exit('checkStatusSheet') true end |
#checkTimeSheet(fileName) ⇒ Object
Check the content of the file fileName and interpret it as a time sheet. If the sheet is syntactically correct and matches the loaded project, true is returned. Otherwise false.
294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 |
# File 'lib/taskjuggler/TaskJuggler.rb', line 294 def checkTimeSheet(fileName) begin Log.enter('checkTimeSheet', 'Parsing #{fileName} ...') # To use this feature, the user must have specified which scenario is # the tracking scenario. unless @project['trackingScenarioIdx'] raise TjException.new, 'No trackingscenario defined' end # Make sure we don't use data from old time sheets or Journal entries. @project.timeSheets.clear @project['journal'] = Journal.new return false unless (ts = parseFile(fileName, :timeSheetFile)) return false unless @project.checkTimeSheets queryAttrs = { 'project' => @project, 'property' => ts.resource, 'scopeProperty' => nil, 'scenarioIdx' => @project['trackingScenarioIdx'], 'start' => ts.interval.start, 'end' => ts.interval.end, 'journalMode' => :journal, 'journalAttributes' => %w( alert property propertyid headline flags timesheet summary details ), 'sortJournalEntries' => [ [ :seqno, 1 ] ], 'timeFormat' => '%Y-%m-%d', 'selfContained' => true } query = Query.new(queryAttrs) puts ts.resource.query_journal(query).richText.inputText rescue TjException => msg if msg. && !msg..empty? critical('check_time_sheet', msg.) end Log.exit('checkTimeSheet') return false end Log.exit('checkTimeSheet') true end |
#errors ⇒ Object
Return the number of errors that had been reported during processing.
383 384 385 |
# File 'lib/taskjuggler/TaskJuggler.rb', line 383 def errors MessageHandlerInstance.instance.errors end |
#freeze(freezeDate, taskBookings) ⇒ Object
Generate an export report definition for bookings up to the freezeDate.
219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 |
# File 'lib/taskjuggler/TaskJuggler.rb', line 219 def freeze(freezeDate, taskBookings) begin # Check the master file is really a file and not stdin. unless (masterFile = @project.inputFiles.masterFile) error('cannot_freeze_stdin', "The project freeze feature can only be used when the " + "master file is a real file, not standard input.") end # Derive the file names for the header and bookings file from the base # name of the master file. masterFileBase = Dir.pwd + '/' + File.basename(masterFile, '.tjp') headerFile = masterFileBase + '-header.tji' bookingsFileBase = masterFileBase + '-bookings' bookingsFile = bookingsFileBase + '.tji' if !File.exist?(bookingsFile) || !File.exist?(headerFile) info('incl_freeze_files', "Please make sure you include #{headerFile} at " + "the end of the project header and " + "#{bookingsFile} at the end of #{masterFile}.") end # Generate the project header include file with the new 'now' date. begin File.open(headerFile, 'w') do |f| f.puts("now #{freezeDate}") end rescue error('write_header_incl', "Cannote write header include file " + "#{headerFile}") end # Generate an export report for the bookings. report = Report.new(@project, '_bookings_', bookingsFileBase, nil) report.typeSpec = :export report.set('formats', [ :tjp ]) report.inheritAttributes # We export only the tracking scenario. unless (trackingScenarioIdx = @project['trackingScenarioIdx']) error('no_tracking_scen', 'No trackingscenario defined') end report.set('scenarios', [ trackingScenarioIdx ]) # Only generate bookings up to the freeze date. report.set('end', freezeDate) # Show all tasks, sorted by seqno-up. report.set('hideTask', LogicalExpression.new(LogicalOperation.new(0))) report.set('sortTasks', [ [ 'seqno', true, -1 ] ]) # Show all resources, sorted by seqno-up. report.set('hideResource', LogicalExpression.new(LogicalOperation.new(0))) report.set('sortResources', [ [ 'seqno', true, -1 ] ]) # Only generate bookings, no other attributes or definitions. report.set('definitions', []) # We group the bookings by task or by resource depending on the user # request. if taskBookings report.set('taskAttributes', [ 'booking' ]) report.set('resourceAttributes', []) else report.set('taskAttributes', []) report.set('resourceAttributes', [ 'booking' ]) end rescue TjException return false end true end |
#generateReport(reportId, regExpMode, formats = nil, dynamicAttributes = nil) ⇒ Object
Generate the report with the ID reportId. If regExpMode is true, reportId is interpreted as a Regular Expression and all reports with matching IDs are generated. formats is a list of formats (e. g. :html, :csv, etc.). dynamicAtributes is a String that may contain attributes to supplement the report definition. The String must be in TJP format and may be nil if no additional attributes are provided.
185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 |
# File 'lib/taskjuggler/TaskJuggler.rb', line 185 def generateReport(reportId, regExpMode, formats = nil, dynamicAttributes = nil) begin Log.enter('generateReport', 'Generating report #{reportId} ...') @project.generateReport(reportId, regExpMode, formats, dynamicAttributes) rescue TjException => msg if msg. && !msg..empty? critical('generate_report', msg.) end Log.exit('generateReport') return false end Log.exit('generateReport') true end |
#generateReports(outputDir = nil) ⇒ Object
Generate all specified reports. The project must have been scheduled before this method can be called. It returns true if no error occured, false otherwise.
147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 |
# File 'lib/taskjuggler/TaskJuggler.rb', line 147 def generateReports(outputDir = nil) @project.checkReports if outputDir # Make sure the output directory path always ends with a '/' unless empty. outputDir += '/' unless outputDir.empty? || outputDir[-1] == '/' @project.outputDir = outputDir end Log.enter('reports', 'Generating reports ...') begin #RubyProf.start @project.generateReports(@maxCpuCores) #profile = RubyProf.stop #printer = RubyProf::GraphHtmlPrinter.new(profile) #File.open("profile.html", "w") do |file| # printer.print(file) #end #printer = RubyProf::CallTreePrinter.new(profile) #File.open("profile.clt", "w") do |file| # printer.print(file) #end rescue TjException => msg if msg. && !msg..empty? critical('generate_reports', msg.) end return false end Log.exit('reports') true end |
#listReports(reportId, regExpMode) ⇒ Object
List the details of the report with reportId or if regExpMode the reports that match the regular expression in reportId.
203 204 205 206 207 208 209 210 211 212 213 214 215 216 |
# File 'lib/taskjuggler/TaskJuggler.rb', line 203 def listReports(reportId, regExpMode) begin Log.enter('listReports', 'Generating report list for #{reportId} ...') @project.listReports(reportId, regExpMode) rescue TjException => msg if msg. && !msg..empty? critical('list_reports', msg.) end Log.exit('listReports') return false end Log.exit('listReports') true end |
#parse(files, keepParser = false) ⇒ Object
Read in the files passed as file names in files, parse them and construct a Project object. In case of success true is returned. Otherwise false.
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/taskjuggler/TaskJuggler.rb', line 45 def parse(files, keepParser = false) # Reset the MessageHandler to clear all errors. MessageHandlerInstance.instance.clear Log.enter('parser', 'Parsing files ...') master = true @project = nil #RubyProf.start @parser = ProjectFileParser.new files.each do |file| begin @parser.open(file, master) rescue TjException => msg if msg. && !msg..empty? critical('parse', msg.) end Log.exit('parser') return false end if master # The first file is considered the master file. if (@project = @parser.parse(:project)) == false Log.exit('parser') return false end master = false else # All other files. @parser.setGlobalMacros if @parser.parse(:propertiesFile) == false Log.exit('parser') return false end end @project.inputFiles << file @parser.close end #profile = RubyProf.stop #printer = RubyProf::GraphHtmlPrinter.new(profile) #File.open("profile.html", "w") do |file| # printer.print(file) #end #printer = RubyProf::CallTreePrinter.new(profile) #File.open("profile.clt", "w") do |file| # printer.print(file) #end # For the report server mode we may need to keep the parser. Otherwise, # destroy it. @parser = nil unless keepParser Log.exit('parser') MessageHandlerInstance.instance.errors == 0 end |
#parseFile(fileName, rule) ⇒ Object
Parse a file and add the content to the existing project. fileName is the name of the file. rule is the TextParser::Rule to start with.
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
# File 'lib/taskjuggler/TaskJuggler.rb', line 104 def parseFile(fileName, rule) begin @parser.open(fileName, false) @project.inputFiles << fileName rescue TjException => msg if msg. && !msg..empty? critical('parse_file', msg.) end return nil end @parser.setGlobalMacros return nil if (res = @parser.parse(rule)) == false @parser.close res end |
#projectId ⇒ Object
Return the ID of the project or nil if no project has been loaded yet.
371 372 373 374 |
# File 'lib/taskjuggler/TaskJuggler.rb', line 371 def projectId return nil if @project.nil? @project['projectid'] end |
#projectName ⇒ Object
Return the name of the project or nil if no project has been loaded yet.
377 378 379 380 |
# File 'lib/taskjuggler/TaskJuggler.rb', line 377 def projectName return nil if @project.nil? @project['name'] end |
#schedule ⇒ Object
Schedule all scenarios in the project. Return true if no error was detected, false otherwise.
124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 |
# File 'lib/taskjuggler/TaskJuggler.rb', line 124 def schedule Log.enter('scheduler', 'Scheduling project ...') #puts @project.to_s @project.warnTsDeltas = @warnTsDeltas begin res = @project.schedule rescue TjException => msg if msg. && !msg..empty? critical('scheduling_error', msg.) end return false end @project.enableTraceReports(@generateTraces) Log.exit('scheduler') res end |