| 1 | package StandupGenerator::Accessor; | ||||||||||
| 2 | |||||||||||
| 3 | 3 | ▶ | use base 'Exporter'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 3 | ▶ | use StandupGenerator::Helper; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | 3 | our @EXPORT = qw( | |||||||||
| 7 | open_one | ||||||||||
| 8 | open_many | ||||||||||
| 9 | ); | ||||||||||
| 10 | |||||||||||
| 11 | # Open a standup file when given a full path, sprint number, and two-digit string for day | ||||||||||
| 12 | 16 | ▶ | sub open_one { | ||||||||
|
Subroutine
open_one: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 13 | 16 | my ($path, $sprint, $day) = @_; | |||||||||
| 14 | 16 | my $command = "open \"${path}/s${sprint}d${day}.txt\""; | |||||||||
| 15 | 16 | system($command); | |||||||||
| 16 | } | ||||||||||
| 17 | |||||||||||
| 18 | # Open all standup files for the past week within a given directory | ||||||||||
| 19 | 2 | ▶ | sub open_many { | ||||||||
|
Subroutine
open_many: called CC=4 SCAR=14.9
Pod
documented
| |||||||||||
| 20 | 2 | my ($path) = @_; | |||||||||
| 21 | 2 | my $last_file = StandupGenerator::Helper::find_last_file($path); | |||||||||
| 22 | 2 | my %last_file_identifiers = StandupGenerator::Helper::extract_identifiers($last_file); | |||||||||
| 23 | 2 | my $last_file_sprint = $last_file_identifiers{'sprint'}; | |||||||||
| 24 | 2 | my $last_file_day = $last_file_identifiers{'day'}; | |||||||||
| 25 | |||||||||||
| 26 | 2 | ▶ | if ($last_file_day > 5) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 27 | # All days will fall within the current sprint | ||||||||||
| 28 | 0 | ▶ | for (my $i = 4; $i <= 9; $i = $i + 1) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 29 | 0 | my $new_day = "0${i}"; | |||||||||
| 30 | 0 | open_one($path, $last_file_sprint, $new_day); | |||||||||
| 31 | } | ||||||||||
| 32 | } else { | ||||||||||
| 33 | # Since a new sprint has just begun, days will be split between the current sprint and the previous sprint | ||||||||||
| 34 | 2 | open_one($path, $last_file_sprint - 1, '09'); | |||||||||
| 35 | 2 | open_one($path, $last_file_sprint - 1, '10'); | |||||||||
| 36 | |||||||||||
| 37 | 2 | ▶ | for (my $i = 1; $i <= 4; $i = $i + 1) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 38 | 8 | my $new_day = "0${i}"; | |||||||||
| 39 | 8 | open_one($path, $last_file_sprint, $new_day); | |||||||||
| 40 | } | ||||||||||
| 41 | } | ||||||||||
| 42 | } | ||||||||||
| 43 | |||||||||||
| 44 | 3 | 1; | |||||||||
| 45 | |||||||||||
| 46 | __END__ | ||||||||||