App-karr
view release on metacpan or search on metacpan
lib/App/karr/Foundation/ChainStore.pm view on Meta::CPAN
sub step {
my ( $self, $id ) = @_;
return undef unless _valid_id($id);
my $step = $self->_read_yaml( $self->_step_ref($id), "chain step '$id'" )
or return undef;
return _as_step( $step, $id );
}
sub update_step {
my ( $self, $id, $code ) = @_;
return undef unless _valid_id($id);
my $ref = $self->_step_ref($id);
# retry_contended reads an empty return as "lost the race, read again"; a
# one-element (undef) return is a committed answer and comes back as undef.
return scalar $self->git->retry_contended( "chain step $id", sub {
my ( $oid, $content ) = $self->git->read_ref_with_oid($ref);
return undef unless defined $oid;
my $step = $self->_decode_yaml( $content, "chain step '$id'" ) or return undef;
lib/App/karr/Role/TaskMutation.pm view on Meta::CPAN
# real and only `karr list --compact` follows it, carrying no placeholder, so
# the suggestion is always printed (the shape `karr needs` got in k263). The
# trailing newline is here so a `die` honours it and Carp appends no call site.
sub task_not_found {
my ($self, $id) = @_;
return "Task $id not found on this board:\n"
. App::karr::Error::command_hint('list', '--compact') . "\n";
}
sub update_task_guarded {
my ($self, $id, $mutate) = @_;
my $git = $self->git;
my $ref = $self->_task_data_ref($id);
return $git->retry_contended( "task $id", sub {
my ( $oid, $content ) = $git->read_ref_with_oid($ref);
die $self->task_not_found($id) unless defined $oid && length $content;
my $task = App::karr::Task->from_string( $content,
repair_frontmatter => $git->board_is_legacy_encoded );
lib/App/karr/Task.pm view on Meta::CPAN
# inline prefix would turn `-a "## Findings"` into a line that is no longer a
# heading, so it cannot be forced on every append.
$text = gmtime->strftime('%Y-%m-%d %H:%M') . ' ' . $text if $timestamp;
my $body = defined $self->body ? $self->body : '';
$body =~ s/\n+\z//;
$self->body( length $body ? $body . "\n\n" . $text : $text );
return $self;
}
sub update_timestamps {
my ( $self, $old_status, $new_status, $first_status, $config ) = @_;
my $now = gmtime->datetime . 'Z';
# Called on the class, is_terminal_status answers for the default board --
# the literal `done` and `archived`. That is all this method could ever ask
# before the last #67 leftover fell, so a board whose final column is named
# anything else recorded no completion at all: `karr move 1 shipped` stamped
# `started` and left `completed` unset for ever, and every reader built on
# it (metrics, context's recently-completed) saw an empty set. Hand the
# board's own App::karr::Config in and its statuses decide instead.
( run in 2.654 seconds using v1.01-cache-2.11-cpan-364913b4093 )