Developer-Dashboard
view release on metacpan or search on metacpan
lib/Developer/Dashboard/CLI/Progress.pm view on Meta::CPAN
};
}
$self->render;
return 1;
}
# update($event)
# Applies one lifecycle progress event to the tracked task board.
# Input: hash reference with task_id, status, and optional label.
# Output: true value.
sub update {
my ( $self, $event ) = @_;
return 1 if !$event || ref($event) ne 'HASH';
$self->add_tasks( $event->{add_tasks} ) if exists $event->{add_tasks};
my $id = $event->{task_id} || return 1;
my $task = $self->{tasks}{$id} || return 1;
$task->{status} = $event->{status} if defined $event->{status} && $event->{status} ne '';
$task->{label} = $event->{label} if defined $event->{label} && $event->{label} ne '';
if ( exists $event->{detail_lines} ) {
my @detail_lines = ref( $event->{detail_lines} ) eq 'ARRAY' ? @{ $event->{detail_lines} } : ();
my $max = $self->_detail_line_limit;
lib/Developer/Dashboard/Collector.pm view on Meta::CPAN
}
);
}
# update_status($name, $callback)
# Updates one collector status file under an exclusive lock so concurrent
# workers can safely merge active-run counters and lifecycle fields.
# Input: collector name string and callback that receives the current status
# hash reference and returns a replacement hash reference.
# Output: written status file path.
sub update_status {
my ( $self, $name, $callback ) = @_;
die 'Missing collector name' if !defined $name || $name eq '';
die 'Missing collector status callback' if ref($callback) ne 'CODE';
my $paths = $self->collector_paths($name);
my $lock = File::Spec->catfile( $paths->{dir}, '.status.lock' );
open my $lock_fh, '>>', $lock or die "Unable to open $lock: $!";
flock( $lock_fh, LOCK_EX ) or die "Unable to lock $lock: $!";
my $existing = $self->_read_status_file( $paths->{status} ) || {};
my $next = $callback->($existing);
die 'Collector status callback must return a hash reference' if ref($next) ne 'HASH';
lib/Developer/Dashboard/SkillManager.pm view on Meta::CPAN
message => "Skill '$repo_name' uninstalled successfully",
unregistered_ddfile => $registration->{ddfile},
unregistered_ddfile_entries => $registration->{removed},
};
}
# update($repo_name)
# Pulls latest changes from the skill's Git repository.
# Input: skill repo name.
# Output: hash ref with success status.
sub update {
my ( $self, $repo_name ) = @_;
return { error => 'Missing repo name' } if !$repo_name;
my $skill_path = $self->get_skill_path( $repo_name, include_disabled => 1 );
return { error => "Skill '$repo_name' not found" } if !defined $skill_path || !-d $skill_path;
my ( $stdout, $stderr, $exit ) = capture {
system( 'git', '-C', $skill_path, 'pull', '--ff-only' );
};
lib/Developer/Dashboard/UpdateManager.pm view on Meta::CPAN
files => $files,
paths => $paths,
runner => $runner,
}, $class;
}
# updates_dir()
# Returns the directory containing updater scripts.
# Input: none.
# Output: directory path string.
sub updates_dir {
my ($self) = @_;
return File::Spec->catdir( cwd(), 'updates' );
}
# run()
# Executes update scripts in order while stopping and restarting managed collectors.
# Input: none.
# Output: array reference of update step result hashes.
sub run {
my ($self) = @_;
( run in 0.839 second using v1.01-cache-2.11-cpan-9581c071862 )