#!perl
use strict;
use warnings;
use App::cpanminus::reporter;
use Getopt::Long;
use Pod::Usage;
my %options = ();
GetOptions( \%options, qw(build_dir=s build_logfile=s verbose|v force quiet|q
setup version help exclude=s only=s)
) or pod2usage();
if ($options{help}) {
pod2usage();
}
elsif ($options{version}) {
print $App::cpanminus::reporter::VERSION . $/;
}
else {
my $tester = App::cpanminus::reporter->new( %options );
if ($options{setup}) {
$tester->setup();
}
else {
$tester->run();
}
}
__END__
=head1 NAME
cpanm-reporter - send cpanm output to CPAN Testers
=head1 SETUP
New to CPAN Testers' reporting? No problem! Just run:
> cpanm-reporter --setup
And we will walk you through everything you need :)
(if you already use L<CPAN::Reporter>, you can safely skip the setup)
=head1 USAGE
Call cpanm as you normally would:
> cpanm Moose Catalyst::Runtime Data::Printer ...
then, just call cpanm-reporter:
> cpanm-reporter
=head2 OPTIONAL ARGUMENTS
--version Shows version number and exits
--help Shows basic usage help and exits
--build_dir=PATH Where your build directory is, containing
each dist's subdir. Default: $HOME/.cpanm/latest-build
--build_logfile=PATH Where the build.log is. Default: $BUILD_DIR/build.log
--verbose (or -v) Extra output
--quiet (or -q) As little output as possible (voids -v)
--setup Sets up the CPAN Testers configuration for you
--only=A::B,C::D,... Only send reports for these modules
--exclude=A::B,... Don't send reports for these modules
=head1 DESCRIPTION
This app properly parses the output of L<cpanm> (C<build.log>) to
automatically generate and send reports to the CPAN Testers database.
C<cpanm> has quickly become one of the most used CPAN clients out there, but
it doesn't come with a native way to generate and send test reports to the
CPAN Testers infrastructure. This standalone app is able to interact with
your cpanm after you install a module, and do that for you.
=head2 CONFIGURATION AND ENVIRONMENT
You can use configuration files with different names and locations by setting
the following environment variables:
=over 4
=item * PERL_CPAN_REPORTER_DIR
The base directory in which your 'C<config.ini>' file resides. Defaults to
your home directory (if you're using Linux or OS X) or to the 'my documents'
folder (if you're running Windows).
=item * PERL_CPAN_REPORTER_CONFIG
In case you don't want to change just the base directory but the entire file's
path and name, you can set this variable to point at the new 'config.ini' file.
=back
If you called C<cpanm-reporter --setup>, you can also set C<PERL_MM_USE_DEFAULT>
to true and it will answer any prompted question automatically with its default
value, if possible.
=head1 CAVEATS
=over 4
=item * This is a standalone tool that reads cpanm's C<build.log> file,
meaning it can potentially be run any time after cpanm has done its thing.
As such, you must be cautious to only run this tool I<right after> you run
cpanm, otherwise your whole environment may have changed, rendering the
report useless - maybe even turning it into a disservice.
B<< As such, we will *only* parse build.log files last modified up to 30
minutes before. >> You can override this by passing the C<--force> flag
to cpanm-reporter, but please take good care to avoid sending bogus reports.
=item * cpanm currently does B<not> record the output into your build.log file
if you pass the "verbose" argument to it, either C<--verbose> or C<-v>. If
you used those when installing dists, C<cpanm-reporter> won't find anything
to send :(
=item * cpanm-reporter is an external, auxiliary tool to cpanm. Since they're
not attached, you must take care not to change perls or local-libs between
installing distributions with C<cpanm> and generating/sending the reports with
C<cpanm-reporter>. If you're not a power user, you don't have to worry about
this. Just remember to run cpanm-reporter immediately after cpanm and
everything will be fine :)
=back
=head1 AUTHOR
Breno G. de Oliveira C<< <garu@cpan.org> >>
=head1 LICENCE AND COPYRIGHT
Copyright (c) 2012-2013, Breno G. de Oliveira C<< <garu@cpan.org> >>. All rights reserved.
This module is free software; you can redistribute it and/or
modify it under the same terms as Perl itself. See L<perlartistic>.
=head1 DISCLAIMER OF WARRANTY
BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE
ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH
YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL
NECESSARY SERVICING, REPAIR, OR CORRECTION.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE
LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL,
OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE
THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.