App-Slackeria
view release on metacpan or search on metacpan
bin/slackeria view on Meta::CPAN
#!/usr/bin/env perl
## Copyright © 2011 by Daniel Friesel <derf@finalrewind.org>
## License: WTFPL:
## 0. You just DO WHAT THE FUCK YOU WANT TO.
use strict;
use warnings;
use 5.010;
use App::Slackeria::Config;
use App::Slackeria::PluginLoader;
use App::Slackeria::Output;
use Getopt::Long qw(:config no_ignore_case);
my $conf = App::Slackeria::Config->new();
my $project;
my $plugin = App::Slackeria::PluginLoader->new();
my $template;
my $verbose = 0;
my ( @plugins, @projects );
our $VERSION = '0.12';
GetOptions(
'h|help' => sub { show_help(0) },
'P|projects=s@' => sub { push( @projects, split( qr{,}, $_[1] ) ) },
'p|plugins=s@' => sub { push( @plugins, split( qr{,}, $_[1] ) ) },
't|template=s' => \$template,
'v|verbose' => \$verbose,
'V|version' => sub { say "slackeria version ${VERSION}"; exit 0 },
) or show_help(1);
my $filename = shift or show_help(1);
sub show_help {
my ($exit_status) = @_;
say 'Usage: slackeria [-v] [-P projects] [-p plugins] [-t template] '
. '<outfile>';
exit $exit_status;
}
if ( @projects == 0 ) {
@projects = $conf->projects();
}
if ( @plugins == 0 ) {
@plugins = $conf->plugins();
}
for my $p (@projects) {
$project->{$p} = {};
}
for my $name (@plugins) {
$plugin->load( $name, %{ $conf->get( 'config', $name ) } );
}
for my $p ( keys %{$project} ) {
for my $name ( $plugin->list() ) {
if ($verbose) {
say "Running ${p}/${name}";
}
$project->{$p}->{$name}
= $plugin->run( $name, $conf->get( $p, $name ) );
}
}
App::Slackeria::Output->write_out(
data => $project,
filename => $filename,
template => $template,
);
__END__
=head1 NAME
slackeria - Project status overview
=head1 SYNOPSIS
B<slackeria> [B<-v>|B<--verbose>] I<outfile>
=head1 VERSION
version 0.12
=head1 DESCRIPTION
B<slackeria> outputs a nice (XHTML) overview of all your projects and their
status in various distributions, on websites, et cetera. So far it checks two
things: First, if the project exists on a given site, and second what version
it has there. This output is then put into a table so you can quickly see
what's missing or not up-to-date.
=head1 OPTIONS
=over
=item B<-t>, B<--template> I<file>
Read output template from I<file>. See App::Slackeria::Out::XHTML(3pm).
=item B<-v>, B<--verbose>
Show the names of projects/plugins as they are run.
=item B<-V>, B<--version>
Print program version
=back
=head1 EXIT STATUS
Zero unless something went completely wrong. The exist status does not
indicate the status of projects or plugins.
=head1 CONFIGURATION
( run in 1.941 second using v1.01-cache-2.11-cpan-800906f7e73 )