Class: TaskJuggler::Tj3SsSender

Inherits:
Tj3SheetAppBase show all
Defined in:
lib/taskjuggler/apps/Tj3SsSender.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

#initializeTj3SsSender

Returns a new instance of Tj3SsSender.



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

def initialize
  super
  @optsSummaryWidth = 25
  @force = false
  @intervalDuration = nil

  @hideResource = nil
  # The default report period end is next Wednesday 0:00.
  @date = TjTime.new.nextDayOfWeek(3).to_s('%Y-%m-%d')
  @resourceList = []
end

Instance Method Details

#appMain(argv) ⇒ Object



72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/taskjuggler/apps/Tj3SsSender.rb', line 72

def appMain(argv)
  ts = StatusSheetSender.new('tj3ss_sender')
  @rc.configure(ts, 'global')
  @rc.configure(ts, 'statussheets')
  @rc.configure(ts, 'statussheets.sender')
  ts.workingDir = @workingDir if @workingDir
  ts.dryRun = @dryRun
  ts.force = @force
  ts.intervalDuration = @intervalDuration if @intervalDuration
  ts.date = @date if @date
  ts.hideResource = @hideResource if @hideResource

  ts.sendTemplates(@resourceList)

  0
end

#processArguments(argv) ⇒ Object



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
68
69
70
# File 'lib/taskjuggler/apps/Tj3SsSender.rb', line 39

def processArguments(argv)
  super do
    @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
    end
    @opts.on('-f', '--force',
            format('Send out a new template even if one exists ' +
                   'already')) do |arg|
      @force = true
    end
    @opts.on('--hideresource <EXPR>', String,
             format('Filter expression to limit the resource list')) do |arg|
      @hideResource = arg
    end
    @opts.on('-i', '--interval <DURATION>', String,
             format('The duration of the interval. This is a number ' +
                    'directly followed by a unit. 1w means one week ' +
                    '(the default), 5d means 5 days and 72h means 72 ' +
                    'hours.')) do |arg|
      @intervalDuration = arg
    end
    optsEndDate
  end
end