encoding: UTF-8
Copyright © 2006, 2007, 2008, 2009, 2010, 2011
by Chris Schlaeger <chris@linux.com>
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.
encoding: UTF-8
Copyright © 2006, 2007, 2008, 2009, 2010, 2011
by Chris Schlaeger <chris@linux.com>
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.
encoding: UTF-8
Copyright © 2006, 2007, 2008, 2009, 2010, 2011
by Chris Schlaeger <chris@linux.com>
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.
encoding: UTF-8
Copyright © 2006, 2007, 2008, 2009, 2010, 2011
by Chris Schlaeger <chris@linux.com>
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.
encoding: UTF-8
Copyright © 2006, 2007, 2008, 2009, 2010, 2011
by Chris Schlaeger <chris@linux.com>
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.
encoding: UTF-8
Copyright © 2006, 2007, 2008, 2009, 2010, 2011
by Chris Schlaeger <chris@linux.com>
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.
encoding: UTF-8
Copyright © 2006, 2007, 2008, 2009, 2010, 2011
by Chris Schlaeger <chris@linux.com>
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.
encoding: UTF-8
Copyright © 2006, 2007, 2008, 2009, 2010, 2011
by Chris Schlaeger <chris@linux.com>
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.
encoding: UTF-8
Copyright © 2006, 2007, 2008, 2009, 2010, 2011
by Chris Schlaeger <chris@linux.com>
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.
encoding: UTF-8
Copyright © 2006, 2007, 2008, 2009, 2010, 2011
by Chris Schlaeger <chris@linux.com>
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.
encoding: UTF-8
Copyright © 2006, 2007, 2008, 2009, 2010, 2011
by Chris Schlaeger <chris@linux.com>
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.
encoding: UTF-8
Copyright © 2006, 2007, 2008, 2009, 2010, 2011
by Chris Schlaeger <chris@linux.com>
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.
encoding: UTF-8
Copyright © 2006, 2007, 2008, 2009, 2010, 2011
by Chris Schlaeger <chris@linux.com>
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.
encoding: UTF-8
Copyright © 2006, 2007, 2008, 2009, 2010, 2011
by Chris Schlaeger <chris@linux.com>
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.
encoding: UTF-8
Copyright © 2006, 2007, 2008, 2009, 2010, 2011
by Chris Schlaeger <chris@linux.com>
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.
encoding: UTF-8
Copyright © 2006, 2007, 2008, 2009, 2010, 2011
by Chris Schlaeger <chris@linux.com>
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.
encoding: UTF-8
Copyright © 2006, 2007, 2008, 2009, 2010, 2011
by Chris Schlaeger <chris@linux.com>
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.
encoding: UTF-8
Copyright © 2006, 2007, 2008, 2009, 2010, 2011
by Chris Schlaeger <chris@linux.com>
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.
encoding: UTF-8
Copyright © 2006, 2007, 2008, 2009, 2010, 2011
by Chris Schlaeger <chris@linux.com>
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.
encoding: UTF-8
Copyright © 2006, 2007, 2008, 2009, 2010, 2011
by Chris Schlaeger <chris@linux.com>
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.
encoding: UTF-8
Copyright © 2006, 2007, 2008, 2009, 2010, 2011
by Chris Schlaeger <chris@linux.com>
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.
encoding: UTF-8
Copyright © 2006, 2007, 2008, 2009, 2010, 2011
by Chris Schlaeger <chris@linux.com>
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.
The TaskJuggler class models the object that provides access to the fundamental features of the TaskJuggler software. It can read project files, schedule them and generate the reports.
encoding: UTF-8
Copyright © 2006, 2007, 2008, 2009, 2010, 2011
by Chris Schlaeger <chris@linux.com>
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.
encoding: UTF-8
Copyright © 2006, 2007, 2008, 2009, 2010, 2011
by Chris Schlaeger <chris@linux.com>
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.
Create a new TaskJuggler object. console is a boolean that determines whether or not messsages can be written to $stderr.
# File lib/TaskJuggler.rb, line 31 31: def initialize(console) 32: @project = nil 33: @parser = nil 34: @messageHandler = MessageHandler.new(console) 35: @maxCpuCores = 1 36: @warnTsDeltas = false 37: end
Check the content of the file fileName and interpret it as a status sheet. If the sheet is syntaxtically correct and matches the loaded project, true is returned. Otherwise false.
# File lib/TaskJuggler.rb, line 241 241: def checkStatusSheet(fileName) 242: begin 243: Log.enter('checkStatusSheet', 'Parsing #{fileName} ...') 244: return false unless (ss = parseFile(fileName, :statusSheetFile)) 245: queryAttrs = { 'project' => @project, 246: 'property' => ss[0], 247: 'scopeProperty' => nil, 248: 'scenarioIdx' => @project['trackingScenarioIdx'], 249: 'timeFormat' => '%Y-%m-%d', 250: 'start' => ss[1], 251: 'end' => ss[2], 252: 'timeFormat' => '%Y-%m-%d', 253: 'selfContained' => true } 254: query = Query.new(queryAttrs) 255: puts ss[0].query_dashboard(query).richText.inputText 256: rescue TjException => msg 257: if msg.message && !msg.message.empty? 258: @messageHandler.critical('check_status_sheet', msg.message) 259: end 260: Log.exit('checkStatusSheet') 261: return false 262: end 263: Log.exit('checkStatusSheet') 264: true 265: end
Check the content of the file fileName and interpret it as a time sheet. If the sheet is syntaxtically correct and matches the loaded project, true is returned. Otherwise false.
# File lib/TaskJuggler.rb, line 209 209: def checkTimeSheet(fileName) 210: begin 211: Log.enter('checkTimeSheet', 'Parsing #{fileName} ...') 212: # Make sure we don't use data from old time sheets or Journal entries. 213: @project.timeSheets.clear 214: @project['journal'] = Journal.new 215: return false unless (ts = parseFile(fileName, :timeSheetFile)) 216: return false unless @project.checkTimeSheets 217: queryAttrs = { 'project' => @project, 218: 'property' => ts.resource, 219: 'scopeProperty' => nil, 220: 'scenarioIdx' => @project['trackingScenarioIdx'], 221: 'start' => ts.interval.start, 222: 'end' => ts.interval.end, 223: 'timeFormat' => '%Y-%m-%d', 224: 'selfContained' => true } 225: query = Query.new(queryAttrs) 226: puts ts.resource.query_journal(query).richText.inputText 227: rescue TjException => msg 228: if msg.message && !msg.message.empty? 229: @messageHandler.critical('check_time_sheet', msg.message) 230: end 231: Log.exit('checkTimeSheet') 232: return false 233: end 234: Log.exit('checkTimeSheet') 235: true 236: end
Return the number of errors that had been reported during processing.
# File lib/TaskJuggler.rb, line 280 280: def errors 281: @project.messageHandler.errors 282: end
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.
# File lib/TaskJuggler.rb, line 174 174: def generateReport(reportId, regExpMode, formats, dynamicAttributes = nil) 175: begin 176: Log.enter('generateReport', 'Generating report #{reportId} ...') 177: @project.generateReport(reportId, regExpMode, formats, dynamicAttributes) 178: rescue TjException => msg 179: if msg.message && !msg.message.empty? 180: @messageHandler.critical('generate_report', msg.message) 181: end 182: Log.exit('generateReport') 183: return false 184: end 185: Log.exit('generateReport') 186: true 187: end
Generate all specified reports. The project must have be scheduled before this method can be called. It returns true if no error occured, false otherwise.
# File lib/TaskJuggler.rb, line 139 139: def generateReports(outputDir = './') 140: @project.checkReports 141: outputDir += '/' unless outputDir.empty? || outputDir[1] == '/' 142: @project.outputDir = outputDir 143: Log.enter('reports', 'Generating reports ...') 144: 145: begin 146: #RubyProf.start 147: @project.generateReports(@maxCpuCores) 148: #profile = RubyProf.stop 149: #printer = RubyProf::GraphHtmlPrinter.new(profile) 150: #File.open("profile.html", "w") do |file| 151: # printer.print(file) 152: #end 153: #printer = RubyProf::CallTreePrinter.new(profile) 154: #File.open("profile.clt", "w") do |file| 155: # printer.print(file) 156: #end 157: rescue TjException => msg 158: if msg.message && !msg.message.empty? 159: @messageHandler.critical('generate_reports', msg.message) 160: end 161: return false 162: end 163: 164: Log.exit('reports') 165: true 166: end
List the details of the report with reportId or if regExpMode the reports that match the regular expression in reportId.
# File lib/TaskJuggler.rb, line 191 191: def listReports(reportId, regExpMode) 192: begin 193: Log.enter('listReports', 'Generating report list for #{reportId} ...') 194: @project.listReports(reportId, regExpMode) 195: rescue TjException => msg 196: if msg.message && !msg.message.empty? 197: @messageHandler.critical('list_reports', msg.message) 198: end 199: Log.exit('listReports') 200: return false 201: end 202: Log.exit('listReports') 203: true 204: end
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.
# File lib/TaskJuggler.rb, line 42 42: def parse(files, keepParser = false) 43: Log.enter('parser', 'Parsing files ...') 44: master = true 45: @project = nil 46: 47: #RubyProf.start 48: @parser = ProjectFileParser.new(@messageHandler) 49: files.each do |file| 50: begin 51: @parser.open(file, master) 52: rescue TjException => msg 53: if msg.message && !msg.message.empty? 54: @messageHandler.critical('parse', msg.message) 55: end 56: Log.exit('parser') 57: return false 58: end 59: if master 60: # The first file is considered the master file. 61: if (@project = @parser.parse(:project)) == false 62: Log.exit('parser') 63: return false 64: end 65: master = false 66: else 67: # All other files. 68: @parser.setGlobalMacros 69: if @parser.parse(:propertiesFile) == false 70: Log.exit('parser') 71: return false 72: end 73: end 74: @project.inputFiles << file 75: @parser.close 76: end 77: 78: #profile = RubyProf.stop 79: #printer = RubyProf::GraphHtmlPrinter.new(profile) 80: #File.open("profile.html", "w") do |file| 81: # printer.print(file) 82: #end 83: #printer = RubyProf::CallTreePrinter.new(profile) 84: #File.open("profile.clt", "w") do |file| 85: # printer.print(file) 86: #end 87: 88: # For the report server mode we may need to keep the parser. Otherwise, 89: # destroy it. 90: @parser = nil unless keepParser 91: 92: Log.exit('parser') 93: @messageHandler.errors == 0 94: end
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.
# File lib/TaskJuggler.rb, line 98 98: def parseFile(fileName, rule) 99: begin 100: @parser.open(fileName, false) 101: @project.inputFiles << fileName 102: rescue TjException => msg 103: if msg.message && !msg.message.empty? 104: @messageHandler.critical('parse_file', msg.message) 105: end 106: return nil 107: end 108: 109: @parser.setGlobalMacros 110: return nil if (res = @parser.parse(rule)) == false 111: 112: @parser.close 113: res 114: end
Return the ID of the project or nil if no project has been loaded yet.
# File lib/TaskJuggler.rb, line 268 268: def projectId 269: return nil if @project.nil? 270: @project['projectid'] 271: end
Return the name of the project or nil if no project has been loaded yet.
# File lib/TaskJuggler.rb, line 274 274: def projectName 275: return nil if @project.nil? 276: @project['name'] 277: end
Schedule all scenarios in the project. Return true if no error was detected, false otherwise.
# File lib/TaskJuggler.rb, line 118 118: def schedule 119: Log.enter('scheduler', 'Scheduling project ...') 120: #puts @project.to_s 121: @project.warnTsDeltas = @warnTsDeltas 122: 123: begin 124: res = @project.schedule 125: rescue TjException => msg 126: if msg.message && !msg.message.empty? 127: @messageHandler.critical('scheduling_error', msg.message) 128: end 129: return false 130: end 131: 132: Log.exit('scheduler') 133: res 134: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.