Package: tj3
Followup-For: Bug #836810

Dear Maintainer,

Please find a patch providing the missing man pages attached.

Thank you.

Christopher Hoskin
>From 52e08ac9e83300aabbeee88714572cec4ff7b85b Mon Sep 17 00:00:00 2001
From: Christopher Hoskin <christopher.hos...@gmail.com>
Date: Tue, 6 Sep 2016 08:37:13 +0100
Subject: [PATCH] Non-maintainer upload.

* Non-maintainer upload.
* Fix "man pages for TaskJuggler" (Closes: #836810)
  + Add a new rake task (debian/tasks/help2man.rake) which uses GNU help2man
    to generate man pages (quilt patch rakefile).
  + The pages are enhanced with include files from debian/h2m/
  + Some modifications to the code (provided in the quilt patch man-code) are
    necessary to format output in the form help2man expects.
  + A spelling mistake in tj3man's --help output is corrected (quilt patch
    man-spelling)
  + The rake tasks are modifified so that 'rake clobber' cleans the build
    products (quilt patch clobber-clean). This is used in debian/rules.
  (Closes: #836810)
---
 debian/changelog                   |  17 +++
 debian/control                     |   3 +-
 debian/h2m/tj3.h2m                 |  25 ++++
 debian/h2m/tj3client.h2m           |  43 +++++++
 debian/h2m/tj3d.h2m                |  33 +++++
 debian/h2m/tj3man.h2m              |  22 ++++
 debian/h2m/tj3ss_receiver.h2m      |  41 ++++++
 debian/h2m/tj3ss_sender.h2m        |  38 ++++++
 debian/h2m/tj3ts_receiver.h2m      |  41 ++++++
 debian/h2m/tj3ts_sender.h2m        |  37 ++++++
 debian/h2m/tj3ts_summary.h2m       |  42 ++++++
 debian/h2m/tj3webd.h2m             |  24 ++++
 debian/patches/clobber-clean.patch |  87 +++++++++++++
 debian/patches/man-code.patch      | 258 +++++++++++++++++++++++++++++++++++++
 debian/patches/man-spelling.patch  |  17 +++
 debian/patches/rakefile.patch      |  17 +++
 debian/patches/series              |   4 +
 debian/rules                       |   5 +-
 debian/tasks/help2man.rake         |  16 +++
 debian/tj3.manpages                |   1 +
 20 files changed, 768 insertions(+), 3 deletions(-)
 create mode 100644 debian/h2m/tj3.h2m
 create mode 100644 debian/h2m/tj3client.h2m
 create mode 100644 debian/h2m/tj3d.h2m
 create mode 100644 debian/h2m/tj3man.h2m
 create mode 100644 debian/h2m/tj3ss_receiver.h2m
 create mode 100644 debian/h2m/tj3ss_sender.h2m
 create mode 100644 debian/h2m/tj3ts_receiver.h2m
 create mode 100644 debian/h2m/tj3ts_sender.h2m
 create mode 100644 debian/h2m/tj3ts_summary.h2m
 create mode 100644 debian/h2m/tj3webd.h2m
 create mode 100644 debian/patches/clobber-clean.patch
 create mode 100644 debian/patches/man-code.patch
 create mode 100644 debian/patches/man-spelling.patch
 create mode 100644 debian/patches/rakefile.patch
 create mode 100644 debian/tasks/help2man.rake
 create mode 100644 debian/tj3.manpages

diff --git a/debian/changelog b/debian/changelog
index b501207..2c6df15 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,20 @@
+tj3 (3.6.0-3.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Fix "man pages for TaskJuggler" (Closes: #836810)
+    + Add a new rake task (debian/tasks/help2man.rake) which uses GNU help2man
+      to generate man pages (quilt patch rakefile).
+    + The pages are enhanced with include files from debian/h2m/
+    + Some modifications to the code (provided in the quilt patch man-code) are
+      necessary to format output in the form help2man expects.
+    + A spelling mistake in tj3man's --help output is corrected (quilt patch 
+      man-spelling)
+    + The rake tasks are modifified so that 'rake clobber' cleans the build 
+      products (quilt patch clobber-clean). This is used in debian/rules.
+    (Closes: #836810)
+
+ -- Christopher Hoskin <christopher.hos...@gmail.com>  Tue, 06 Sep 2016 07:12:39 +0100
+
 tj3 (3.6.0-3) unstable; urgency=medium
 
   * Add package for vim syntax highlighting. Thanks to Christopher Hoskin
diff --git a/debian/control b/debian/control
index 7f559a1..d691c3f 100644
--- a/debian/control
+++ b/debian/control
@@ -8,7 +8,8 @@ Build-Depends: debhelper (>= 9~),
                ruby-mail (>= 2.4.3),
                ruby-rspec,
                ruby-term-ansicolor (>= 1.0.7),
-               localehelper
+               localehelper,
+               help2man
 Standards-Version: 3.9.8
 Vcs-Browser: https://anonscm.debian.org/gitweb/?p=collab-maint/tj3.git
 Vcs-Git: https://anonscm.debian.org/git/collab-maint/tj3.git
diff --git a/debian/h2m/tj3.h2m b/debian/h2m/tj3.h2m
new file mode 100644
index 0000000..cf03a12
--- /dev/null
+++ b/debian/h2m/tj3.h2m
@@ -0,0 +1,25 @@
+[NAME]
+tj3 \- schedules tj3 projects and generates reports
+
+[ENVIRONMENT]
+
+.TP
+\fBTASKJUGGLER_DATA_PATH\fR
+Override the path to the TaskJuggler data folder.
+The data folder contains the css, icons and scripts
+for TaskJuggler reports.
+
+.TP
+\fBTZ\fR
+The POSIX Time Zone environment variable.
+
+Any environment variable may be used in a TaskJuggler file using the expression $(VAR_NAME).
+
+[EXAMPLES]
+
+tj3 tutorial.tjp
+
+[SEE ALSO]
+tj3client(1), tj3d(1), tj3man(1), tj3ss_receiver(1), tj3ss_sender(1), tj3ts_receiver(1), tj3ts_sender(1), tj3ts_summary(1), tj3webd(1)
+
+The full TaskJuggler manual is available online at http://www.taskjuggler.org/tj3/manual/, or via the tj3man command.
diff --git a/debian/h2m/tj3client.h2m b/debian/h2m/tj3client.h2m
new file mode 100644
index 0000000..81bd04f
--- /dev/null
+++ b/debian/h2m/tj3client.h2m
@@ -0,0 +1,43 @@
+[NAME]
+tj3client \- send commands and data to the TaskJuggler daemon
+
+[ENVIRONMENT]
+
+.TP
+\fBHOME\fR
+The user's home folder. Used to search for configuration file if not specified.
+
+[FILES]
+
+.TP
+\fB.taskjugglerrc\fR or \fBtaskjuggler.rc\fR
+tj3d searches for a config file named .taskjugglerrc or taskjuggler.rc in the current path, the user's home path as specified by the HOME environment variable or /etc/. At a minimum the file must contain:
+
+_global:
+  authKey: ********
+
+(the user should specify their own auth key and set file permissions accordingly). An alternative config file location may be specified using the -c, --config FILE option.
+
+[EXAMPLES]
+.TP
+Load a project:
+tj3client add yourproject.tjp
+.PP
+.TP
+List available reports for a project:
+tj3client list-reports <project_id>
+.PP
+.TP
+Generate a report:
+tj3client report <project_id> <report_id>
+.PP
+.TP
+Terminate a running instance of the server:
+tj3client terminate
+
+
+
+[SEE ALSO]
+tj3d(1)
+
+The full TaskJuggler manual is available online at http://www.taskjuggler.org/tj3/manual/, or via the tj3man command.
diff --git a/debian/h2m/tj3d.h2m b/debian/h2m/tj3d.h2m
new file mode 100644
index 0000000..e105d95
--- /dev/null
+++ b/debian/h2m/tj3d.h2m
@@ -0,0 +1,33 @@
+[NAME]
+tjd3 \- the TaskJuggler daemon
+
+[ENVIRONMENT]
+
+.TP
+\fBHOME\fR
+The user's home folder. Used to search for configuration file if not specified.
+
+[FILES]
+
+.TP
+\fB.taskjugglerrc\fR or \fBtaskjuggler.rc\fR
+tj3d searches for a config file named .taskjugglerrc or taskjuggler.rc in the current path, the user's home path as specified by the HOME environment variable or /etc/. At a minimum the file must contain:
+
+_global:
+  authKey: ********
+
+(the user should specify their own auth key and set file permissions accordingly). An alternative config file location may be specified using the -c, --config FILE option.
+
+.TP
+\fBtj3d.log\fR
+
+The tj3d log file, created in the working directory. Location can be overridden using the --logfile FILE option.
+
+[SECURITY]
+The author advises: "the daemon has not received any kind of security review ... only use the daemon in a trusted environment with only trusted users!"
+
+
+[SEE ALSO]
+tj3client(1)
+
+The full TaskJuggler manual is available online at http://www.taskjuggler.org/tj3/manual/, or via the tj3man command.
diff --git a/debian/h2m/tj3man.h2m b/debian/h2m/tj3man.h2m
new file mode 100644
index 0000000..3c1bedc
--- /dev/null
+++ b/debian/h2m/tj3man.h2m
@@ -0,0 +1,22 @@
+[NAME]
+tj3man \- get documentation for TaskJuggler keywords or generate user manual
+
+[ENVIRONMENT]
+
+.TP
+\fBBROWSER\fR
+The web browser used to display the user manual as HTML.
+
+[EXAMPLES]
+
+tj3man shift
+.br
+tj3man --html shift.timesheet
+.br
+tj3man --html
+
+[SEE ALSO]
+
+tj3(1)
+
+The TaskJuggler manual is also available online at http://www.taskjuggler.org/tj3/manual/.
diff --git a/debian/h2m/tj3ss_receiver.h2m b/debian/h2m/tj3ss_receiver.h2m
new file mode 100644
index 0000000..227d5a6
--- /dev/null
+++ b/debian/h2m/tj3ss_receiver.h2m
@@ -0,0 +1,41 @@
+[NAME]
+tj3ss_receiver \- receive filled-out status sheets via email
+
+[ENVIRONMENT]
+
+.TP
+\fBHOME\fR
+The user's home folder. Used to search for configuration file if not specified.
+
+
+[FILES]
+.TP
+\fB.taskjugglerrc\fR or \fBtaskjuggler.rc\fR
+tj3d searches for a config file named .taskjugglerrc or taskjuggler.rc in the current path, the user's home path as specified by the HOME environment variable or /etc/. At a minimum the file must configure an e-mail delivery method and sender e-mail e.g.:
+
+_global:
+   emailDeliveryMethod: smtp
+   smtpServer: smtp.your_company.com
+.br
+_statussheets:
+   senderEmail: 'TaskJuggler <statusshe...@taskjuggler.amd.com>'
+
+An alternative config file location may be specified using the -c, --config FILE option.
+
+.TP
+\fBstatussheets.log\fR
+The statussheets log file, created in the working directory.
+
+.TP
+\fBStatusSheets/FailedMails/\fR
+Directory created in the working directory to store the failed emails.
+
+.TP
+\fBStatusSheets/FailedSheets/\fR
+Directory created in the working directory to store the failed status sheets.
+
+
+[SEE ALSO]
+tj3ss_sender(1)
+
+The full TaskJuggler manual is available online at http://www.taskjuggler.org/tj3/manual/, or via the tj3man command.
diff --git a/debian/h2m/tj3ss_sender.h2m b/debian/h2m/tj3ss_sender.h2m
new file mode 100644
index 0000000..32ab384
--- /dev/null
+++ b/debian/h2m/tj3ss_sender.h2m
@@ -0,0 +1,38 @@
+[NAME]
+tj3ss_sender \- send out status sheets templates via email
+
+[ENVIRONMENT]
+
+.TP
+\fBHOME\fR
+The user's home folder. Used to search for configuration file if not specified.
+
+
+[FILES]
+
+\fB.taskjugglerrc\fR or \fBtaskjuggler.rc\fR
+tj3d searches for a config file named .taskjugglerrc or taskjuggler.rc in the current path, the user's home path as specified by the HOME environment variable or /etc/. At a minimum the file must configure an authentication key, an e-mail delivery method and sender e-mail e.g.:
+
+_global:
+   authKey: ********
+   smtpServer: smtp.your_company.com
+.br
+_statussheets:
+   senderEmail: 'TaskJuggler <statusshe...@taskjuggler.amd.com>'
+
+(the user should specify their own auth key and set file permissions accordingly). An alternative config file location may be specified using the -c, --config FILE option.
+
+.TP
+\fBstatussheets.log\fR
+The statussheets log file, created in the working directory.
+
+.TP
+\fBStatusSheetTemplates\fR
+Base directory of the sheet templates, created in the working directory.
+
+
+[SEE ALSO]
+
+tj3ss_receiver(1), tj3d(1)
+
+The full TaskJuggler manual is available online at http://www.taskjuggler.org/tj3/manual/, or via the tj3man command.
diff --git a/debian/h2m/tj3ts_receiver.h2m b/debian/h2m/tj3ts_receiver.h2m
new file mode 100644
index 0000000..126bfb8
--- /dev/null
+++ b/debian/h2m/tj3ts_receiver.h2m
@@ -0,0 +1,41 @@
+[NAME]
+tj3ts_receiver \- receive filled-out time sheets via email
+
+[ENVIRONMENT]
+
+.TP
+\fBHOME\fR
+The user's home folder. Used to search for configuration file if not specified.
+
+
+[FILES]
+.TP
+\fB.taskjugglerrc\fR or \fBtaskjuggler.rc\fR
+tj3d searches for a config file named .taskjugglerrc or taskjuggler.rc in the current path, the user's home path as specified by the HOME environment variable or /etc/. At a minimum the file must configure an authentication key, an e-mail delivery method and sender e-mail e.g.:
+
+_global:
+   authKey: ********
+   smtpServer: smtp.your_company.com
+_timesheets:
+   senderEmail: 'TaskJuggler <timeshe...@taskjuggler.amd.com>'
+
+(the user should specify their own auth key and set file permissions accordingly). An alternative config file location may be specified using the -c, --config FILE option.
+
+.TP
+\fBtimesheets.log\fR
+The statussheets log file, created in the working directory.
+
+.TP
+\fBTimeSheets/FailedMails/\fR
+Directory created in the working directory to store the failed emails.
+
+.TP
+\fBTimeSheets/FailedSheets/\fR
+Directory created in the working directory to store the failed status sheets.
+
+
+[SEE ALSO]
+
+tj3ts_sender(1)
+
+The full TaskJuggler manual is available online at http://www.taskjuggler.org/tj3/manual/, or via the tj3man command.
diff --git a/debian/h2m/tj3ts_sender.h2m b/debian/h2m/tj3ts_sender.h2m
new file mode 100644
index 0000000..be3d729
--- /dev/null
+++ b/debian/h2m/tj3ts_sender.h2m
@@ -0,0 +1,37 @@
+[NAME]
+tj3ts_sender \- send out time sheets templates via email
+
+[ENVIRONMENT]
+
+.TP
+\fBHOME\fR
+The user's home folder. Used to search for configuration file if not specified.
+
+[FILES]
+
+\fB.taskjugglerrc\fR or \fBtaskjuggler.rc\fR
+tj3d searches for a config file named .taskjugglerrc or taskjuggler.rc in the current path, the user's home path as specified by the HOME environment variable or /etc/. At a minimum the file must configure an authentication key, an e-mail delivery method and sender e-mail e.g.:
+
+_global:
+   authKey: ********
+   smtpServer: smtp.your_company.com
+   projectId: acso
+.br
+_timesheets:
+   senderEmail: 'TaskJuggler <statusshe...@taskjuggler.amd.com>'
+
+(the user should specify their own auth key and set file permissions accordingly). An alternative config file location may be specified using the -c, --config FILE option.
+
+.TP
+\fBtimesheets.log\fR
+The timesheets log file, created in the working directory.
+
+.TP
+\fBTimeSheetTemplates\fR
+Base directory of the sheet templates, created in the working directory.
+
+
+[SEE ALSO]
+tj3ts_receiver(1)
+
+The full TaskJuggler manual is available online at http://www.taskjuggler.org/tj3/manual/, or via the tj3man command.
diff --git a/debian/h2m/tj3ts_summary.h2m b/debian/h2m/tj3ts_summary.h2m
new file mode 100644
index 0000000..a89a581
--- /dev/null
+++ b/debian/h2m/tj3ts_summary.h2m
@@ -0,0 +1,42 @@
+[NAME]
+tj3ts_summary \- send out individual copies and a summary of accepted time sheets
+
+[ENVIRONMENT]
+
+.TP
+\fBHOME\fR
+The user's home folder. Used to search for configuration file if not specified.
+
+
+[FILES]
+
+\fB.taskjugglerrc\fR or \fBtaskjuggler.rc\fR
+tj3d searches for a config file named .taskjugglerrc or taskjuggler.rc in the current path, the user's home path as specified by the HOME environment variable or /etc/. At a minimum the file must configure an authentication key, an e-mail delivery method, project id, sender e-mail and receipients e.g.:
+
+_global:
+   authKey: ********
+   smtpServer: smtp.your_company.com
+   projectId: acso
+.br
+_timesheets:
+   senderEmail: 'TaskJuggler <statusshe...@taskjuggler.amd.com>'
+  _summary:
+    sheetRecipients:
+      - team@your_company.com
+
+(the user should specify their own auth key and set file permissions accordingly). An alternative config file location may be specified using the -c, --config FILE option.
+
+
+.TP
+\fBtimesheets.log\fR
+The timesheets log file, created in the working directory.
+
+.TP
+\fBTimeSheetTemplates\fR
+Base directory of the sheet templates, created in the working directory.
+
+
+[SEE ALSO]
+tj3ts_receiver(1)  tj3ts_sender(1)
+
+The full TaskJuggler manual is available online at http://www.taskjuggler.org/tj3/manual/, or via the tj3man command.
diff --git a/debian/h2m/tj3webd.h2m b/debian/h2m/tj3webd.h2m
new file mode 100644
index 0000000..619a4f6
--- /dev/null
+++ b/debian/h2m/tj3webd.h2m
@@ -0,0 +1,24 @@
+[NAME]
+tj3webd \- TaskJuggler reports web server
+
+[ENVIRONMENT]
+
+.TP
+\fBHOME\fR
+The user's home folder. Used to search for configuration file if not specified.
+
+[FILES]
+
+.TP
+\fB.taskjugglerrc\fR or \fBtaskjuggler.rc\fR
+tj3d searches for a config file named .taskjugglerrc or taskjuggler.rc in the current path, the user's home path as specified by the HOME environment variable or /etc/. At a minimum the file must contain:
+
+_global:
+  authKey: ********
+
+(the user should specify their own auth key and set file permissions accordingly). An alternative config file location may be specified using the -c, --config FILE option.
+
+[SEE ALSO]
+tj3d(1)
+
+The full TaskJuggler manual is available online at http://www.taskjuggler.org/tj3/manual/, or via the tj3man command.
diff --git a/debian/patches/clobber-clean.patch b/debian/patches/clobber-clean.patch
new file mode 100644
index 0000000..a62f93d
--- /dev/null
+++ b/debian/patches/clobber-clean.patch
@@ -0,0 +1,87 @@
+Subject: Clean the source tree using rake
+ Modify several rake tasks so that running 'rake clean' will remove any 
+ intermediate files and running 'rake clobber' will remove any final products.
+Forwarded: https://github.com/taskjuggler/TaskJuggler/pull/195
+Author: Christopher Hoskin <christopher.hos...@gmail.com>
+Last-Update: 2016-09-06
+
+diff --git a/tasks/changelog.rake b/tasks/changelog.rake
+index ec9a99f..4eadb56 100644
+--- a/tasks/changelog.rake
++++ b/tasks/changelog.rake
+@@ -1,5 +1,7 @@
+ require 'time'
+ 
++CLOBBER.include "CHANGELOG"
++
+ desc 'Generate the CHANGELOG file'
+ task :changelog do
+ 
+diff --git a/tasks/gem.rake b/tasks/gem.rake
+index 7f6f07c..df730d5 100644
+--- a/tasks/gem.rake
++++ b/tasks/gem.rake
+@@ -3,6 +3,8 @@ require 'find'
+ require 'rubygems'
+ require 'rubygems/package'
+ 
++CLOBBER.include "pkg/"
++
+ # Unfortunately Rake::GemPackageTest cannot deal with files that are generated
+ # by Rake targets. So we have to write our own packaging task.
+ desc 'Build the gem package'
+diff --git a/tasks/kate.rake b/tasks/kate.rake
+index ca3a0ed..d142269 100644
+--- a/tasks/kate.rake
++++ b/tasks/kate.rake
+@@ -2,6 +2,8 @@
+ 
+ require 'taskjuggler/KateSyntax'
+ 
++CLOBBER.include "data/kate-tjp.xml"
++
+ desc 'Generate kate-tjp.xml Kate syntax file'
+ task :kate do
+   TaskJuggler::KateSyntax.new.generate('data/kate-tjp.xml')
+diff --git a/tasks/manual.rake b/tasks/manual.rake
+index 7bec4cc..e2947da 100644
+--- a/tasks/manual.rake
++++ b/tasks/manual.rake
+@@ -2,6 +2,8 @@
+ 
+ require 'taskjuggler/apps/Tj3Man'
+ 
++CLOBBER.include "manual/html/"
++
+ desc 'Generate User Manual'
+ task :manual do
+   htmldir = 'manual/html'
+diff --git a/tasks/test.rake b/tasks/test.rake
+index f15d7ae..f521c7a 100644
+--- a/tasks/test.rake
++++ b/tasks/test.rake
+@@ -2,6 +2,11 @@ $:.unshift File.join(File.dirname(__FILE__), '..', 'test')
+ 
+ require 'rake/testtask'
+ 
++CLEAN.include "test/TestSuite/Export-Reports/refs/Leave.tjp"
++CLEAN.include "test/TestSuite/Export-Reports/refs/ListAttributes.tjp"
++CLEAN.include "test/TestSuite/Export-Reports/refs/Macro-4.tjp"
++CLEAN.include "test/TestSuite/Export-Reports/refs/TraceReport.tjp"
++
+ # TEST TASK
+ desc 'Run all unit tests in the test directory'
+ Rake::TestTask.new(:unittest) do |t|
+diff --git a/tasks/vim.rake b/tasks/vim.rake
+index 73afa49..ede600e 100644
+--- a/tasks/vim.rake
++++ b/tasks/vim.rake
+@@ -2,6 +2,8 @@
+ 
+ require 'taskjuggler/VimSyntax'
+ 
++CLOBBER.include "data/tjp.vim"
++
+ desc 'Generate vim.tjp Vim syntax file'
+ task :vim do
+   TaskJuggler::VimSyntax.new.generate('data/tjp.vim')
diff --git a/debian/patches/man-code.patch b/debian/patches/man-code.patch
new file mode 100644
index 0000000..33b4ca1
--- /dev/null
+++ b/debian/patches/man-code.patch
@@ -0,0 +1,258 @@
+Subject: man pages: Code modifications
+ Make minimal modifications to the Tj3 apps and Tj3AppBase in order that when 
+ the commands are called with --help the output is in the format help2man
+ expects.
+Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=836810
+Forwarded: https://github.com/taskjuggler/TaskJuggler/pull/196/commits/6edf55f7289de494204c5dae7e3b9b95ece78b28
+Author: Christopher Hoskin <christopher.hos...@gmail.com>
+Last-Update: 2016-09-06
+
+diff --git a/lib/taskjuggler/Tj3AppBase.rb b/lib/taskjuggler/Tj3AppBase.rb
+index df99d93..a9d570b 100644
+--- a/lib/taskjuggler/Tj3AppBase.rb
++++ b/lib/taskjuggler/Tj3AppBase.rb
+@@ -51,16 +51,15 @@ class TaskJuggler
+       @opts.summary_width = @optsSummaryWidth
+       @opts.summary_indent = ' ' * @optsSummaryIndent
+ 
+-      @opts.banner = "#{AppConfig.softwareName} v#{AppConfig.version} - " +
+-                     "#{AppConfig.packageInfo}\n\n" +
+-                     "Copyright (c) #{AppConfig.copyright.join(', ')}\n" +
++      @opts.banner = "Copyright (c) #{AppConfig.copyright.join(', ')}\n" +
+                      "              by #{AppConfig.authors.join(', ')}\n\n" +
+                      "#{AppConfig.license}\n" +
+                      "For more info about #{AppConfig.softwareName} see " +
+                      "#{AppConfig.contact}\n\n" +
+                      "Usage: #{AppConfig.appName} [options] " +
+                      "#{@mandatoryArgs}\n\n"
+-      @opts.separator ""
++
++      @opts.separator "\nOptions:"
+       @opts.on('-c', '--config <FILE>', String,
+                format('Use the specified YAML configuration file')) do |arg|
+          @configFile = arg
+@@ -91,8 +90,23 @@ EOT
+         quit
+       end
+       @opts.on_tail('--version', format('Show version info')) do
+-        puts "#{AppConfig.softwareName} v#{AppConfig.version} - " +
+-          "#{AppConfig.packageInfo}"
++# Display the software name and version in GNU format
++# as expected by help2man
++# https://www.gnu.org/prep/standards/standards.html#g_t_002d_002dversion
++        puts "#{AppConfig.appName} (#{AppConfig.softwareName}) #{AppConfig.version}\n"
++# To also display the copyright and license statements in GNU format
++# uncomment the following and remove the equivalent statements from
++# --help
++# +
++#<<'EOT'
++#Copyright (C) 2016 Chris Schlaeger <c...@taskjuggler.org>
++#License GPLv2: GNU GPL version 2 <http://gnu.org/licenses/gpl.html>
++#This 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.
++#
++#For more info about TaskJuggler see http://www.taskjuggler.org
++#EOT
+         quit
+       end
+ 
+diff --git a/lib/taskjuggler/apps/Tj3.rb b/lib/taskjuggler/apps/Tj3.rb
+index 464f0d2..c855fd3 100644
+--- a/lib/taskjuggler/apps/Tj3.rb
++++ b/lib/taskjuggler/apps/Tj3.rb
+@@ -68,10 +68,12 @@ class TaskJuggler
+ 
+     def processArguments(argv)
+       super do
+-        @opts.banner += <<'EOT'
++        @opts.banner.prepend(<<'EOT'
+ This is the main application. It reads in your project files, schedules the
+ project and generates the reports.
++
+ EOT
++	)
+         @opts.on('--debuglevel N', Integer,
+                  format("Verbosity of debug output")) do |arg|
+           TaskJuggler::Log.level = arg
+diff --git a/lib/taskjuggler/apps/Tj3Client.rb b/lib/taskjuggler/apps/Tj3Client.rb
+index 7e85a37..b75ae38 100644
+--- a/lib/taskjuggler/apps/Tj3Client.rb
++++ b/lib/taskjuggler/apps/Tj3Client.rb
+@@ -100,7 +100,7 @@ class TaskJuggler
+ 
+     def processArguments(argv)
+       super do
+-        @opts.banner += <<'EOT'
++        prebanner = <<'EOT'
+ The TaskJuggler client is used to send commands and data to the TaskJuggler
+ daemon. The communication is done via TCP/IP.
+ 
+@@ -125,9 +125,10 @@ EOT
+             end
+           end
+           args = args.join(' ')
+-          @opts.banner += "     #{cmd[:label] + ' ' + args + tail}" +
++          prebanner += "     #{cmd[:label] + ' ' + args + tail}" +
+                           "\n\n#{' ' * 10 + format(cmd[:descr], 10)}\n"
+         end
++	@opts.banner.prepend(prebanner)
+         @opts.on('-p', '--port <NUMBER>', Integer,
+                  format('Use the specified TCP/IP port')) do |arg|
+            @port = arg
+diff --git a/lib/taskjuggler/apps/Tj3Daemon.rb b/lib/taskjuggler/apps/Tj3Daemon.rb
+index 53e972f..fece5e4 100644
+--- a/lib/taskjuggler/apps/Tj3Daemon.rb
++++ b/lib/taskjuggler/apps/Tj3Daemon.rb
+@@ -42,11 +42,13 @@ class TaskJuggler
+ 
+     def processArguments(argv)
+       super do
+-        @opts.banner += <<'EOT'
++        @opts.banner.prepend(<<'EOT'
+ The TaskJuggler daemon can be used to quickly generate reports for a number
+ of scheduled projects that are resident in memory. Once the daemon has been
+ started tj3client can be used to control it.
++
+ 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
+diff --git a/lib/taskjuggler/apps/Tj3Man.rb b/lib/taskjuggler/apps/Tj3Man.rb
+index 5a1c4f0..a1d8d40 100644
+--- a/lib/taskjuggler/apps/Tj3Man.rb
++++ b/lib/taskjuggler/apps/Tj3Man.rb
+@@ -36,10 +36,12 @@ class TaskJuggler
+ 
+     def processArguments(argv)
+       super do
+-        @opts.banner += <<'EOT'
++        @opts.banner.prepend(<<'EOT'
+ This program can be used to generate the user manual in HTML format or to get
+ a textual help for individual keywords.
++
+ EOT
++	)
+         @opts.on('-d', '--dir <directory>', String,
+                 format('directory to put the manual')) do |dir|
+           @directory = dir
+diff --git a/lib/taskjuggler/apps/Tj3SsReceiver.rb b/lib/taskjuggler/apps/Tj3SsReceiver.rb
+index d7c20d9..6b8650b 100644
+--- a/lib/taskjuggler/apps/Tj3SsReceiver.rb
++++ b/lib/taskjuggler/apps/Tj3SsReceiver.rb
+@@ -27,13 +27,15 @@ class TaskJuggler
+ 
+     def processArguments(argv)
+       super do
+-        @opts.banner += <<'EOT'
++        @opts.banner.prepend(<<'EOT'
+ This program can be used to receive filled-out status sheets via email.
+ It reads the emails from STDIN and extracts the status sheet from the
+ attached files. The status sheet is checked for correctness. Good status
+ sheets are filed away. The sender be informed by email that the status
+ sheets was accepted or rejected.
++
+ EOT
++	)
+       end
+     end
+ 
+diff --git a/lib/taskjuggler/apps/Tj3SsSender.rb b/lib/taskjuggler/apps/Tj3SsSender.rb
+index 5adee07..331f855 100644
+--- a/lib/taskjuggler/apps/Tj3SsSender.rb
++++ b/lib/taskjuggler/apps/Tj3SsSender.rb
+@@ -38,11 +38,13 @@ class TaskJuggler
+ 
+     def processArguments(argv)
+       super do
+-        @opts.banner += <<'EOT'
++        @opts.banner.prepend(<<'EOT'
+ This program can be used to out status sheets templates via email. It will
+ generate status sheet templates for managers of the project. The project data
+ will be accesses via tj3client from a running TaskJuggler server process.
++
+ EOT
++	)
+         @opts.on('-r', '--resource <ID>', String,
+                  format('Only generate template for given resource')) do |arg|
+           @resourceList << arg
+diff --git a/lib/taskjuggler/apps/Tj3TsReceiver.rb b/lib/taskjuggler/apps/Tj3TsReceiver.rb
+index 15526c1..9f2a5aa 100644
+--- a/lib/taskjuggler/apps/Tj3TsReceiver.rb
++++ b/lib/taskjuggler/apps/Tj3TsReceiver.rb
+@@ -30,13 +30,15 @@ class TaskJuggler
+ 
+     def processArguments(argv)
+       super do
+-        @opts.banner += <<'EOT'
++        @opts.banner.prepend(<<'EOT'
+ This program can be used to receive filled-out time sheets via email.  It
+ reads the emails from STDIN and extracts the time sheet from the attached
+ files. The time sheet is checked for correctness. Good time sheets are filed
+ away. The sender will be informed by email that the time sheets was accepted
+ or rejected.
++
+ EOT
++	)
+       end
+     end
+ 
+diff --git a/lib/taskjuggler/apps/Tj3TsSender.rb b/lib/taskjuggler/apps/Tj3TsSender.rb
+index 004569c..3134c98 100644
+--- a/lib/taskjuggler/apps/Tj3TsSender.rb
++++ b/lib/taskjuggler/apps/Tj3TsSender.rb
+@@ -37,11 +37,13 @@ class TaskJuggler
+ 
+     def processArguments(argv)
+       super do
+-        @opts.banner += <<'EOT'
++        @opts.banner.prepend(<<'EOT'
+ This program can be used to send out time sheets templates via email. It will
+ generate time sheet templates for all resources of the project. The project
+ data will be accesses via tj3client from a running TaskJuggler server process.
++
+ EOT
++	)
+         @opts.on('-r', '--resource <ID>', String,
+                 format('Only generate template for given resource')) do |arg|
+           @resourceList << arg
+diff --git a/lib/taskjuggler/apps/Tj3TsSummary.rb b/lib/taskjuggler/apps/Tj3TsSummary.rb
+index 05c67e3..aec982d 100644
+--- a/lib/taskjuggler/apps/Tj3TsSummary.rb
++++ b/lib/taskjuggler/apps/Tj3TsSummary.rb
+@@ -36,12 +36,14 @@ class TaskJuggler
+ 
+     def processArguments(argv)
+       super do
+-        @opts.banner += <<'EOT'
++        @opts.banner.prepend(<<'EOT'
+ This program can be used to send out individual copies and a summary of all
+ accepted time sheets a list of email addresses. The directory structures for
+ templates and submitted time sheets must be present. The project data will be
+ accesses via tj3client from a running TaskJuggler server process.
++
+ EOT
++	)
+         @opts.on('-r', '--resource <ID>', String,
+                  format('Only generate summary for given resource')) do |arg|
+           @resourceList << arg
+diff --git a/lib/taskjuggler/apps/Tj3WebD.rb b/lib/taskjuggler/apps/Tj3WebD.rb
+index 77f00a0..8582ce6 100644
+--- a/lib/taskjuggler/apps/Tj3WebD.rb
++++ b/lib/taskjuggler/apps/Tj3WebD.rb
+@@ -40,11 +40,13 @@ class TaskJuggler
+ 
+     def processArguments(argv)
+       super do
+-        @opts.banner += <<'EOT'
++        @opts.banner.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
diff --git a/debian/patches/man-spelling.patch b/debian/patches/man-spelling.patch
new file mode 100644
index 0000000..ac12c16
--- /dev/null
+++ b/debian/patches/man-spelling.patch
@@ -0,0 +1,17 @@
+Description: Correct spelling mistake in lib/taskjuggler/apps/Tj3Man.rb
+Forwarded: https://github.com/taskjuggler/TaskJuggler/pull/196/commits/a3589f61fd820603c464745402629f9fc8c4e7e2
+Author: Christopher Hoskin <christopher.hos...@gmail.com>
+Last-Update: 2016-09-06
+diff --git a/lib/taskjuggler/apps/Tj3Man.rb b/lib/taskjuggler/apps/Tj3Man.rb
+index a1d8d40..861c21c 100644
+--- a/lib/taskjuggler/apps/Tj3Man.rb
++++ b/lib/taskjuggler/apps/Tj3Man.rb
+@@ -48,7 +48,7 @@ EOT
+         end
+         @opts.on('--html',
+                  format('Show the user manual in your local web browser. ' +
+-                        'By default, Firefox is used or the brower specified ' +
++                        'By default, Firefox is used or the browser specified ' +
+                         'with the $BROWSER environment variable.')) do
+           @showHtml = true
+         end
diff --git a/debian/patches/rakefile.patch b/debian/patches/rakefile.patch
new file mode 100644
index 0000000..4e919b0
--- /dev/null
+++ b/debian/patches/rakefile.patch
@@ -0,0 +1,17 @@
+Description: Add debian/tasks to rakefile as a source of tasks
+ The debian/tasks folder will be used to contain rake tasks written for the 
+ Debian package e.g. help2man.rake
+Forwarded: not-needed
+Author: Christopher Hoskin <christopher.hos...@gmail.com>
+Last-Update: 2016-09-06
+--- a/Rakefile
++++ b/Rakefile
+@@ -14,6 +14,8 @@
+   end
+ end
+ 
++Rake.add_rakelib 'debian/tasks'
++
+ task :default  => [ :test ]
+ 
+ desc 'Run all unit and spec tests'
diff --git a/debian/patches/series b/debian/patches/series
index e2c650f..90a89dd 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,3 +1,7 @@
+clobber-clean.patch
+man-spelling.patch
+man-code.patch
+rakefile.patch
 dont-require-git.patch
 data-search-dirs-debian.patch
 reproducible-build.patch
diff --git a/debian/rules b/debian/rules
index 9287874..ce4601d 100755
--- a/debian/rules
+++ b/debian/rules
@@ -6,11 +6,12 @@
 override_dh_auto_build:
 	dh_auto_build
 	localehelper LANG=en_US.UTF-8 rake manual
-	rake vim 
+	rake vim
+	rake help2man 
 
 override_dh_clean:
 	rm -rf manual/html
-	rm data/tjp.vim
+	rake clobber
 	dh_clean
 
 override_dh_auto_test:
diff --git a/debian/tasks/help2man.rake b/debian/tasks/help2man.rake
new file mode 100644
index 0000000..91ddb39
--- /dev/null
+++ b/debian/tasks/help2man.rake
@@ -0,0 +1,16 @@
+# TASK MAN GENERATE
+
+CLOBBER.include "man"
+
+directory "man"
+
+desc 'Generate man pages from help'
+task :help2man => 'man' do
+	help2man = %x{which help2man}
+	help2man.chomp!
+	Dir.foreach('bin') do |prog|
+		next if prog == '.' or prog == '..'
+		system help2man,"--output=man/#{prog}.1","--no-info","--manual=TaskJuggler",*("--include=debian/h2m/#{prog}.h2m" unless !File.exists?("debian/h2m/#{prog}.h2m")),"bin/#{prog}"
+	end
+end
+
diff --git a/debian/tj3.manpages b/debian/tj3.manpages
new file mode 100644
index 0000000..bf519d7
--- /dev/null
+++ b/debian/tj3.manpages
@@ -0,0 +1 @@
+man/*.1
-- 
2.9.3

Reply via email to