Class: TaskJuggler::Tj3TsSummary

Inherits:
Tj3SheetAppBase show all
Defined in:
lib/taskjuggler/apps/Tj3TsSummary.rb

Instance Method Summary collapse

Methods inherited from Tj3SheetAppBase

#optsEndDate

Methods inherited from Tj3AppBase

#main

Methods included from MessageHandler

#critical, #debug, #error, #fatal, #info, #warning

Constructor Details

#initializeTj3TsSummary

Returns a new instance of Tj3TsSummary.



27
28
29
30
31
32
33
34
35
# File 'lib/taskjuggler/apps/Tj3TsSummary.rb', line 27

def initialize
  super

  # The default report period end is next Monday 0:00.
  @date = TjTime.new.nextDayOfWeek(1).to_s('%Y-%m-%d')
  @resourceList = []
  @sheetRecipients = []
  @digestRecipients = []
end

Instance Method Details

#appMain(argv) ⇒ Object



69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/taskjuggler/apps/Tj3TsSummary.rb', line 69

def appMain(argv)
  ts = TimeSheetSummary.new
  @rc.configure(ts, 'global')
  @rc.configure(ts, 'timesheets')
  @rc.configure(ts, 'timesheets.summary')
  ts.workingDir = @workingDir if @workingDir
  ts.dryRun = @dryRun
  ts.date = @date if @date
  ts.sheetRecipients += @sheetRecipients
  ts.digestRecipients += @digestRecipients

  ts.sendSummary(@resourceList)

  0
end

#processArguments(argv) ⇒ Object



37
38
39
40
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
# File 'lib/taskjuggler/apps/Tj3TsSummary.rb', line 37

def processArguments(argv)
  super do
    @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
    end
    @opts.on('-t', '--to <EMAIL>', String,
             format('Send all individual reports and a summary report ' +
                    'to this email address')) do |arg|
      @sheetRecipients << arg
      @digestRecipients << arg
    end
    @opts.on('--sheet <EMAIL>', String,
             format('Send all reports to this email address')) do |arg|
      @sheetRecipients << arg
    end
    @opts.on('--digest <EMAIL>', String,
             format('Send a summary report to this email address')) do |arg|
      @digestRecipients << arg
    end
    optsEndDate
  end
end