Class: TaskJuggler::Tj3SheetAppBase

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

Instance Method Summary collapse

Methods inherited from Tj3AppBase

#main

Methods included from MessageHandler

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

Constructor Details

#initializeTj3SheetAppBase

Returns a new instance of Tj3SheetAppBase.



20
21
22
23
24
25
# File 'lib/taskjuggler/Tj3SheetAppBase.rb', line 20

def initialize
  super

  @dryRun = false
  @workingDir = nil
end

Instance Method Details

#optsEndDateObject



42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/taskjuggler/Tj3SheetAppBase.rb', line 42

def optsEndDate
  @opts.on('-e', '--enddate <DAY>', String,
           format("The end date of the reporting period. Either as " +
                  "YYYY-MM-DD or day of week. 0: Sunday, 1: Monday and " +
                  "so on. The default value is #{@date}.")) do |arg|
    ymdFilter = /([0-9]{4})-([0-9]{2})-([0-9]{2})/
    if ymdFilter.match(arg)
      @date = Time.mktime(*(ymdFilter.match(arg)[1..3]))
    else
      @date = TjTime.new.nextDayOfWeek(arg.to_i % 7)
    end
    @date = @date.strftime('%Y-%m-%d')
  end
end

#processArguments(argv) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/taskjuggler/Tj3SheetAppBase.rb', line 27

def processArguments(argv)
  super do
    @opts.on('-d', '--directory <DIR>', String,
             format('Use the specified directory as working ' +
                    'directory')) do |arg|
      @workingDir = arg
    end
    @opts.on('--dryrun',
             format("Don't send out any emails or do SCM commits")) do
      @dryRun = true
    end
    yield
  end
end