Developer-Dashboard
view release on metacpan or search on metacpan
lib/Developer/Dashboard/UpdateManager.pm view on Meta::CPAN
# Stops the named managed collectors.
# Input: list of collector name strings.
# Output: none.
sub _stop_collectors {
my ( $self, @names ) = @_;
for my $name (@names) {
eval { $self->{runner}->stop_loop($name) };
}
}
# _restart_collectors(@wanted)
# Restarts configured collectors that were previously running and are still desired.
# Input: list of collector name strings.
# Output: none.
sub _restart_collectors {
my ( $self, @names ) = @_;
return if !@names;
my %wanted = map { $_ => 1 } @names;
my @jobs = @{ $self->{config}->collectors };
for my $job (@jobs) {
next if ref($job) ne 'HASH';
next if !$wanted{ $job->{name} };
eval { $self->{runner}->start_loop($job) };
}
}
1;
__END__
=head1 NAME
Developer::Dashboard::UpdateManager - managed update runner
=head1 SYNOPSIS
my $updater = Developer::Dashboard::UpdateManager->new(...);
my $steps = $updater->run;
=head1 DESCRIPTION
This module executes repository update scripts while coordinating managed
collector shutdown and restart around the update process.
=head1 METHODS
=head2 new, updates_dir, run
Construct and execute dashboard updates.
=for comment FULL-POD-DOC START
=head1 PURPOSE
This module runs the ordered update hook chain for C<dashboard update>. It discovers executable update scripts, runs them in sorted order, streams their stdout and stderr, updates the structured C<RESULT> state between hooks, and coordinates collecto...
=head1 WHY IT EXISTS
It exists because update hooks are a first-class runtime workflow, not a one-off shell loop. The dashboard needs one module that owns ordering, streaming, structured hook results, and collector lifecycle around updates.
=head1 WHEN TO USE
Use this file when changing update hook discovery, update streaming behavior, RESULT propagation between update hooks, or the way updates stop and restart collectors.
=head1 HOW TO USE
Construct it with the file registry, path registry, and collector runner, then call its run method from the update command. Keep update hook execution policy in this module rather than in the command wrapper.
=head1 WHAT USES IT
It is used by the C<dashboard update> flow, by runtime bootstrap/update smoke tests, and by coverage that verifies update hook ordering and collector restart semantics.
=head1 EXAMPLES
Example 1:
perl -Ilib -MDeveloper::Dashboard::UpdateManager -e 1
Do a direct compile-and-load check against the module from a source checkout.
Example 2:
prove -lv t/04-update-manager.t t/26-sql-dashboard.t
Run the focused regression tests that most directly exercise this module's behavior.
Example 3:
HARNESS_PERL_SWITCHES=-MDevel::Cover prove -lr t
Recheck the module under the repository coverage gate rather than relying on a load-only probe.
Example 4:
prove -lr t
Put any module-level change back through the entire repository suite before release.
=for comment FULL-POD-DOC END
=cut
( run in 1.360 second using v1.01-cache-2.11-cpan-39bf76dae61 )