Class: TaskJuggler::Tj3WebD
- Inherits:
-
Tj3AppBase
- Object
- Tj3AppBase
- TaskJuggler::Tj3WebD
- Defined in:
- lib/taskjuggler/apps/Tj3WebD.rb
Instance Method Summary collapse
- #appMain(files) ⇒ Object
-
#initialize ⇒ Tj3WebD
constructor
A new instance of Tj3WebD.
- #processArguments(argv) ⇒ Object
Methods inherited from Tj3AppBase
Methods included from MessageHandler
#critical, #debug, #error, #fatal, #info, #warning
Constructor Details
#initialize ⇒ Tj3WebD
Returns a new instance of Tj3WebD.
26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/taskjuggler/apps/Tj3WebD.rb', line 26 def initialize super @mhi = MessageHandlerInstance.instance @mhi.logFile = File.join(Dir.getwd, "/#{AppConfig.appName}.log") @mhi.appName = AppConfig.appName # By default show only warnings and more serious messages. @mhi.outputLevel = :warning @daemonize = true @uriFile = File.join(Dir.getwd, '.tj3d.uri') @port = nil @webServerPort = nil @pidFile = nil end |
Instance Method Details
#appMain(files) ⇒ Object
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/taskjuggler/apps/Tj3WebD.rb', line 82 def appMain(files) @rc.configure(self, 'global') @rc.configure(@mhi, 'global.log') webServer = WebServer.new @rc.configure(webServer, 'global') @rc.configure(webServer, 'webd') # Set some config variables if corresponding data was provided via the # command line. webServer.port = @port if @port webServer.uriFile = @uriFile.untaint webServer.webServerPort = @webServerPort if @webServerPort webServer.daemonize = @daemonize webServer.pidFile = @pidFile debug('', "pidFile 1: #{@pidFile}") webServer.start 0 end |
#processArguments(argv) ⇒ Object
41 42 43 44 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 |
# File 'lib/taskjuggler/apps/Tj3WebD.rb', line 41 def processArguments(argv) super do @opts..prepend(<<'EOT' The TaskJuggler web server can be used to serve the HTTP reports of TaskJuggler projects to be viewed by any HTML5 compliant web browser. It uses the TaskJuggler daemon (tj3d) for data hosting and report generation. EOT ) @opts.on('-d', '--dont-daemonize', format("Don't put program into daemon mode. Keep it " + 'connected to the terminal and show debug output.')) do @daemonize = false end @opts.on('-p', '--port <NUMBER>', Integer, format('Use the specified TCP/IP port to connect to the ' + 'TaskJuggler daemon (Default: 8474).')) do |arg| @port = arg end @opts.on('--pidfile <FILE NAME>', String, format('Write the process ID of the daemon to the ' + 'specified file.')) do |arg| @pidFile = arg end @opts.on('--logfile <FILE NAME>', String, format('Log daemon messages to the specified file.')) do |arg| @mhi.logFile = arg end @opts.on('--urifile <FILE NAME>', String, format('If the port is 0, use this file to read the URI ' + 'of the TaskJuggler daemon.')) do |arg| @uriFile = arg end @opts.on('--webserver-port <NUMBER>', Integer, format('Use the specified TCP/IP port to serve web browser ' + 'requests (Default: 8080).')) do |arg| @webServerPort = arg end end end |