In Files

Class Index [+]

Quicksearch

TaskJuggler::Tj3Daemon

Public Class Methods

new() click to toggle source
    # File lib/tj3d.rb, line 25
25:     def initialize
26:       super
27:       @mandatoryArgs = '[<tjp file> [<tji file> ...] ...]'
28: 
29:       @log = LogFile.instance
30:       @log.logFile = Dir.getwd + "/#{AppConfig.appName}.log"
31:       @log.appName = AppConfig.appName
32:       @daemonize = true
33:       @port = nil
34:       @webServer = false
35:       @webServerPort = nil
36:     end

Public Instance Methods

error(message) click to toggle source
    # File lib/tj3d.rb, line 87
87:     def error(message)
88:       $stderr.puts "ERROR: #{message}"
89:       exit 1
90:     end
main() click to toggle source
    # File lib/tj3d.rb, line 68
68:     def main
69:       files = super
70:       broker = ProjectBroker.new
71:       @rc.configure(self, 'global')
72:       @rc.configure(@log, 'global.log')
73:       @rc.configure(broker, 'global')
74:       @rc.configure(broker, 'daemon')
75: 
76:       # Set some config variables if corresponding data was provided via the
77:       # command line.
78:       broker.port = @port if @port
79:       broker.enableWebServer = @webServer
80:       broker.webServerPort = @webServerPort if @webServerPort
81:       broker.projectFiles = sortInputFiles(files) unless files.empty?
82:       broker.daemonize = @daemonize
83: 
84:       broker.start
85:     end
processArguments(argv) click to toggle source
    # File lib/tj3d.rb, line 38
38:     def processArguments(argv)
39:       super do
40:         @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.
41:         @opts.on('-d', '--dont-daemonize',
42:                  format("Don't put program into daemon mode. Keep it " +
43:                         'connected to the terminal and show debug output.')) do
44:           @daemonize = false
45:         end
46:         @opts.on('-p', '--port <NUMBER>', Integer,
47:                  format('Use the specified TCP/IP port to serve tj3client ' +
48:                         'requests (Default: 8474).')) do |arg|
49:           @port = arg
50:         end
51:         @opts.on('-w', '--webserver',
52:                  format('Start a web server that serves the reports of ' +
53:                         'the loaded projects.')) do
54:           @webServer = true
55:         end
56:         @opts.on('--webserver-port <NUMBER>', Integer,
57:                  format('Use the specified TCP/IP port to serve web browser ' +
58:                         'requests (Default: 8080).')) do |arg|
59:           @webServerPort = arg
60:         end
61:       end
62:     end

Private Instance Methods

sortInputFiles(files) click to toggle source

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/tj3d.rb, line 98
 98:     def sortInputFiles(files)
 99:       projects = []
100:       project = nil
101:       files.each do |file|
102:         if file[4..1] == '.tjp'
103:           # The project master file determines the working directory. If it's
104:           # an absolute file name, that directory will become the working
105:           # directory. If it's a relative file name, the current working
106:           # directory will be kept.
107:           if file[0] == '/'
108:             # Absolute file name
109:             workingDir = File.dirname(file)
110:             fileName = File.basename(file)
111:           else
112:             # Relative file name
113:             workingDir = Dir.getwd
114:             fileName = file
115:           end
116:           project = [ workingDir, fileName ]
117:           projects << project
118:         elsif file[4..1] == '.tji'
119:           # .tji files are optional. But if they are specified, they must
120:           # always follow the master file in the list.
121:           if project.nil?
122:             error("You must specify a '.tjp' file before the '.tji' files")
123:           end
124:           project << file
125:         else
126:           error("Project files must have a '.tjp' or '.tji' extension")
127:         end
128:       end
129: 
130:       projects
131:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.