class TaskJuggler::Tj3TsSender

Public Class Methods

new() click to toggle source
Calls superclass method TaskJuggler::Tj3SheetAppBase.new
# File lib/taskjuggler/apps/Tj3TsSender.rb, line 26
def initialize
  super
  @optsSummaryWidth = 22
  @force = false
  @intervalDuration = nil

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

Public Instance Methods

appMain(argv) click to toggle source
# File lib/taskjuggler/apps/Tj3TsSender.rb, line 57
def appMain(argv)
  ts = TimeSheetSender.new('tj3ts_sender')
  @rc.configure(ts, 'global')
  @rc.configure(ts, 'timesheets')
  @rc.configure(ts, 'timesheets.sender')
  ts.workingDir = @workingDir if @workingDir
  ts.dryRun = @dryRun
  ts.force = @force
  ts.intervalDuration = @intervalDuration if @intervalDuration
  ts.date = @date if @date

  ts.sendTemplates(@resourceList)

  0
end
processArguments(argv) click to toggle source
# File lib/taskjuggler/apps/Tj3TsSender.rb, line 37
    def processArguments(argv)
      super do
        @opts.banner += <<'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
        end
        @opts.on('-f', '--force',
                format('Send out a new template even if one exists ' +
                       'already')) do |arg|
          @force = true
        end
        optsEndDate
      end
    end