# File lib/taskjuggler/apps/Tj3Daemon.rb, line 26 26: def initialize 27: super 28: @mandatoryArgs = '[<tjp file> [<tji file> ...] ...]' 29: 30: @log = LogFile.instance 31: @log.logFile = File.join(Dir.getwd, "/#{AppConfig.appName}.log") 32: @log.appName = AppConfig.appName 33: @daemonize = true 34: @uriFile = File.join(Dir.getwd, '.tj3d.uri') 35: @port = nil 36: @webServer = false 37: @webServerPort = nil 38: end
# File lib/taskjuggler/apps/Tj3Daemon.rb, line 75 75: def appMain(files) 76: begin 77: broker = ProjectBroker.new 78: @rc.configure(self, 'global') 79: @rc.configure(@log, 'global.log') 80: @rc.configure(broker, 'global') 81: @rc.configure(broker, 'daemon') 82: 83: # Set some config variables if corresponding data was provided via the 84: # command line. 85: broker.port = @port if @port 86: broker.uriFile = @uriFile.untaint 87: broker.enableWebServer = @webServer 88: broker.webServerPort = @webServerPort if @webServerPort 89: broker.projectFiles = sortInputFiles(files) unless files.empty? 90: broker.daemonize = @daemonize 91: # Create log files for standard IO for each child process if the daemon 92: # is not disconnected from the terminal. 93: broker.logStdIO = !@daemonize 94: 95: return broker.start 96: rescue TjRuntimeError 97: return 1 98: end 99: end
# File lib/taskjuggler/apps/Tj3Daemon.rb, line 40 40: def processArguments(argv) 41: super do 42: @opts.banner += The TaskJuggler daemon can be used to quickly generate reports for a numberof scheduled projects that are resident in memory. Once the daemon has beenstarted tj3client can be used to control it. 43: @opts.on('-d', '--dont-daemonize', 44: format("Don't put program into daemon mode. Keep it " + 45: 'connected to the terminal and show debug output.')) do 46: @daemonize = false 47: end 48: @opts.on('-p', '--port <NUMBER>', Integer, 49: format('Use the specified TCP/IP port to serve tj3client ' + 50: 'requests (Default: 8474).')) do |arg| 51: @port = arg 52: end 53: @opts.on('--urifile', String, 54: format('If the port is 0, use this file to store the URI ' + 55: 'of the server.')) do |arg| 56: @uriFile = arg 57: end 58: @opts.on('-w', '--webserver', 59: format('Start a web server that serves the reports of ' + 60: 'the loaded projects.')) do 61: @webServer = true 62: end 63: @opts.on('--webserver-port <NUMBER>', Integer, 64: format('Use the specified TCP/IP port to serve web browser ' + 65: 'requests (Default: 8080).')) do |arg| 66: @webServerPort = arg 67: end 68: end 69: end
Sort the provided input files into groups of projects. Each *.tjp file
starts a new project. A *.tjp file may be followed by any number of *.tji
files. The result is an Array of projects. Each consists of an Array like
this: [
# File lib/taskjuggler/apps/Tj3Daemon.rb, line 107 107: def sortInputFiles(files) 108: projects = [] 109: project = nil 110: files.each do |file| 111: if file[4..1] == '.tjp' 112: # The project master file determines the working directory. If it's 113: # an absolute file name, that directory will become the working 114: # directory. If it's a relative file name, the current working 115: # directory will be kept. 116: if file[0] == '/' 117: # Absolute file name 118: workingDir = File.dirname(file) 119: fileName = File.basename(file) 120: else 121: # Relative file name 122: workingDir = Dir.getwd 123: fileName = file 124: end 125: project = [ workingDir, fileName ] 126: projects << project 127: elsif file[4..1] == '.tji' 128: # .tji files are optional. But if they are specified, they must 129: # always follow the master file in the list. 130: if project.nil? 131: error("You must specify a '.tjp' file before the '.tji' files") 132: end 133: project << file 134: else 135: error("Project files must have a '.tjp' or '.tji' extension") 136: end 137: end 138: 139: projects 140: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.