forked from taskjuggler/TaskJuggler
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New: Web server is now a separate program: tj3webd
- Loading branch information
Showing
16 changed files
with
419 additions
and
168 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/usr/bin/env ruby | ||
|
||
$:.unshift File.join(File.dirname(__FILE__), '..', 'lib') | ||
require File.basename(__FILE__) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
#!/usr/bin/env ruby -w | ||
# encoding: UTF-8 | ||
# | ||
# = Tj3Daemon.rb -- The TaskJuggler III Project Management Software | ||
# | ||
# Copyright (c) 2006, 2007, 2008, 2009, 2010, 2011, 2012 | ||
# 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. | ||
# | ||
|
||
require 'drb' | ||
require 'taskjuggler/Tj3AppBase' | ||
require 'taskjuggler/MessageHandler' | ||
require 'taskjuggler/daemon/WebServer' | ||
|
||
# Name of the application | ||
AppConfig.appName = 'tj3webd' | ||
|
||
class TaskJuggler | ||
|
||
class Tj3WebD < Tj3AppBase | ||
|
||
def initialize | ||
super | ||
@mandatoryArgs = '[<tjp file> [<tji file> ...] ...]' | ||
|
||
@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 | ||
end | ||
|
||
def processArguments(argv) | ||
super do | ||
@opts.banner += <<'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('--urifile', 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 | ||
|
||
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.projectFiles = sortInputFiles(files) unless files.empty? | ||
webServer.daemonize = @daemonize | ||
|
||
webServer.start | ||
0 | ||
end | ||
|
||
end | ||
|
||
end | ||
|
Oops, something went wrong.