File Coverage

blib/lib/App/Standup/Diary.pm
Criterion Covered Total %
statement 40 44 90.9
branch 2 8 25.0
condition n/a
subroutine 13 15 86.6
pod 5 7 71.4
total 60 74 81.0


line stmt bran cond sub pod time code
1             package App::Standup::Diary;
2              
3 2     2   513572 use v5.28;
  2         9  
4              
5 2     2   1349 use Config::Tiny;
  2         3956  
  2         89  
6 2     2   1692 use Object::Pad;
  2         32995  
  2         13  
7 2     2   2561 use Path::Tiny;
  2         60840  
  2         249  
8              
9 2     2   1649 use App::Standup::Role::Project;
  2         8  
  2         134  
10 2     2   1219 use App::Standup::Role::Date;
  2         13  
  2         114  
11 2     2   1100 use App::Standup::Diary::Template;
  2         7  
  2         549  
12              
13             our $VERSION = '0.08';
14              
15             class App::Standup::Diary :does( Date ) :does( Project ) {
16              
17 2     2   182 no warnings 'experimental';
  2         4  
  2         4042  
18              
19 0 0   0 1 0 field $config :accessor :param { Config::Tiny->read('diary.conf') };
  0         0  
20              
21 3 50   3 1 575 field $daily_data_path :accessor;
  3         25  
22              
23 2     2 1 16121 field $data_dir :param :reader;
  2         17  
24              
25 2 0   2 0 6 field $template :writer :accessor;
  2     0 1 9  
  0         0  
  0         0  
26              
27 3     3 1 8 method init_daily_data_path ($path) {
  3         8  
  3         9  
  3         6  
28             $daily_data_path = $data_dir ?
29             path( $data_dir . '/' . $path ) :
30 3 50       27 path( $config->{data}->{path} . '/' . $path );
31             }
32              
33             method write {
34              
35             $self->set_template( App::Standup::Diary::Template->new(
36             date => $self->date,
37             project_name => $self->project_name
38             ));
39              
40             if ( $self->should_create_dir ) {
41             say "$daily_data_path should be created";
42             $self->create_directories_tree;
43             } else {
44             $self->init_daily_data_path($self->build_path($self->date->ymd('/')));
45             }
46              
47             my $file_path = path($self->build_full_file_path);
48              
49             path($file_path)->spew_utf8($template->render) and say "Diary entry created $file_path"
50             unless $file_path->exists and say "Entry already exist";
51              
52             }
53              
54             # TODO should have a App::Standup::Diary::Path object for those
55             method build_full_file_path {
56             return $daily_data_path .
57             '/' .
58             $self->date->ymd .
59             '_' .
60             lc $self->project_name .
61             '.md';
62             }
63              
64 3     3 0 192 method build_path ($date) {
  3         12  
  3         8  
  3         6  
65 3         29 my ($path) = $date =~ m/ \d{4} \/ \d{2} /gx ;
66 3         18 return $path;
67             }
68              
69             method should_create_dir {
70             $self->init_daily_data_path($self->build_path($self->date->ymd('/')));
71             return $daily_data_path->exists ? 0 : 1;
72             }
73              
74             method create_directories_tree {
75              
76             # Unimplemented, see #29
77             if ($self->date->day_of_month == 1 ) {
78             # TODO if first day of the month
79             # Create a Priorities file
80             }
81              
82             my @created = $daily_data_path->mkpath;
83             say "Created $daily_data_path" if @created;
84             }
85             }
86              
87             =encoding utf8
88              
89             =head1 NAME
90              
91             App::Standup::Diary - Manage a simple Markdown journal for your daily standups
92              
93             =head1 SYNOPSIS
94              
95             # From command line
96             diary --data-dir /home/smonff/diary/ --project-name SeriousWork
97              
98             # In your Perl code
99             my $diary = App::Standup::Diary
100             ->new(
101             data_dir => $data_dir,
102             project_name => $project_name
103             );
104              
105             $diary->write();
106              
107              
108             =head1 DESCRIPTION
109              
110             This module is the implementation of the L command, that can help to keep
111             a directory of organized daily notes aimed at standup preparation and
112             presentation.
113              
114             It provides a couple of ways to customize the notes template.
115              
116             It use internal tools built with CPAN modules:
117              
118             =over 2
119              
120             =item L
121              
122             The Markdown template where your data are interpolated.
123              
124             =item L
125              
126             Provide date features for all the C uses.
127              
128             =item L
129              
130             Provide a project name, so far.
131              
132             =back
133              
134             =head1 MOTIVATIONS
135              
136             Daily standups are a common, tried and tested modern work methodology. They are
137             I<"brief, daily collaboration meeting in which the team review progress from the
138             previous day, declares intentions for the current day, and highlights any
139             obstacles encountered or anticipated"> (L
140             meeting in which the team review progress from the previous day, declares
141             intentions for the current day, and highlights any obstacles encountered or
142             anticipated.>).
143              
144             This tool is supposed to provide self-support for persons:
145              
146             =over 2
147              
148             =item Who struggle with daily standups presentations oral expression
149              
150             =item Surely familiar with the Perl ecosystem
151              
152             =back
153              
154             =head2 How did it start?
155              
156             Social anxiety can make my standup presentation very confusing. I also tend to
157             forget key points if improvising, due to the stress of having no talk notes
158             support. Keeping a diary of my thoughts drastically helped me to stay calm and
159             collaborate better with the various teams I worked with. And if they are well
160             sorted by year, month and day, it makes very easy to find old notes for eventual
161             later usage.
162              
163             =head2 Ready for production
164              
165             I have been using it at work since 2021 and it helped me to reduce the stress of
166             standups and meeting.
167              
168             =head2 Methodology
169              
170             Every morning, create the daily file by running C. It's template is a
171             simple 3 items list. Open the day file in C<$data_dir/$year/$month/> and stash
172             your thoughts by using the following methodology:
173              
174             =over 2
175              
176             =item C
177              
178             List of tasks you accomplished in the previous day
179              
180             =item C
181              
182             List of tasks you plan to accomplish today
183              
184             =item C
185              
186             List of eventual blockers, so that your colleagues can support you
187              
188             =back
189              
190             Then just read the notes during the daily standup.
191              
192             =head2 Experiment with Object::Pad
193              
194             L is my pet project for Perl's Corinna implementation of the
195             core OOP features. C use L, not the C feature
196             introduced in Perl C<5.40>. L is the test bed for the new core OO
197             system.
198              
199             =head1 INSTALLATION
200              
201             =head2 For common usage
202              
203             cpanm App::Standup::Diary
204              
205             It will make the C command available in the C<~/perl5/bin/> directory.
206             Should be available in your C.
207              
208             See L for command line usage.
209              
210             =head2 For development
211              
212             # Install a Perl module manager
213             apt install carton
214              
215             git clone git@codeberg.org:smonff/Diary.git
216              
217             cd Diary
218              
219             # Install CPAN dependencies
220             carton install
221              
222             =head1 How to use it?
223              
224             I set an alias in my C<.bashrc>. Should also work in your own-favorite-shell:
225              
226             alias diary="diary --data-dir /home/smonff/diary --project-name SeriousWork";
227              
228             Each morning, before my work standup, I run C. It create a Markdown file
229             in the specified C<--project-name> directory. I then edit my thoughts with an
230             editor.
231              
232             See L for command line usage.
233              
234             =head1 FIELDS
235              
236             =head2 config
237              
238             =head2 daily_data_path
239              
240             =head2 data_dir
241              
242             =head2 template
243              
244             A L object.
245              
246             =head1 METHODS
247              
248             =head2 build_full_file_path()
249              
250             =head2 build_path($self->date->ymd('/'))
251              
252             Use the date from C to build the final path file name.
253              
254             =head2 create_directories_tree()
255              
256             If C<$self->should_create_dir()> returns a true value, it would take care of the
257             directory creation using L C.
258              
259             =head2 init_daily_data_path($file_path)
260              
261             Helper that initialize C<$daily_data_path> with a C instance
262             for the current day diary entry.
263              
264             # foo/2022/03 (Path::Tiny)
265             $self->init_daily_data_path($self->build_path)
266              
267             =head2 should_create_dir()
268              
269             Check if a new I or I directory should be created so that we can
270             store the standup file. In simpler words: are we the first day of the year, or
271             of the month?
272              
273             =head2 write()
274              
275             This is C entry point, AKA C.
276              
277             =head1 TODOs
278              
279             =over 2
280              
281             =item Make the template configurable by setting it in a separate file
282              
283             =item Retrieve TODOS from previous days
284              
285             =back
286              
287             See the L.
288              
289             =head1 SEE ALSO
290              
291             A couple of similar tools:
292              
293             =over 2
294              
295             =item L
296              
297             On the CPAN, this is pretty much all what I found. I like the spirit of this
298             one.
299              
300             =item L
301              
302             A similar effort written in Bash.
303              
304             =back
305              
306             =head1 ACKNOWLEDGEMENTS
307              
308             Thanks to the maintainers of L, L, L,
309             L, L.
310              
311             =head1 LICENSE
312              
313             Copyright 2022-2024 Sebastien Feugère
314              
315             This library is free software; you can redistribute it and/or modify it under
316             the Artistic License 2.0.
317              
318             See L.
319              
320             =head1 AUTHOR
321              
322             Sébastien Feugère - seb@feugere.net
323              
324             =cut