p5-p5u / lib / P5U / Command / Testers.pm

Toby Inkster 9c2a00a 



Toby Inkster a7ee9a5 


Toby Inkster 9c2a00a 
Toby Inkster a7ee9a5 


Toby Inkster e8551ab 
Toby Inkster a7ee9a5 
Toby Inkster 9c2a00a 





Toby Inkster f98963a 








Toby Inkster 9c2a00a 


























Toby Inkster 1b0fde8 




Toby Inkster 9c2a00a 







package P5U::Command::Testers;

use 5.010;
use strict;
use utf8;
use P5U-command;

use PerlX::Maybe 0 'maybe';

BEGIN {
	$P5U::Command::Testers::AUTHORITY = 'cpan:TOBYINK';
	$P5U::Command::Testers::VERSION   = '0.005';
};

use constant {
	abstract    => q[show CPAN testers statistics for a distribution],
	usage_desc  => q[%c testers %o Distribution],
};

sub command_names
{
	qw(
		testers
		cpan-testers
		ct
	);
}

sub opt_spec
{
	return (
		["version|v=s",  "a specific version to query"],
		["summary|s",    "show summary for all versions"],
		["os|o",         "break down statistics by operating system"],
		["stable|z",     "ignore development versions"],
	)
}

sub execute
{
	require P5U::Lib::Testers;
	
	my ($self, $opt, $args) = @_;

	$self->usage_error("You must provide a distribution name.")
		if $opt->{summary} && ($opt->{os_data} or length $opt->{version});
		
	$self->usage_error("You must provide a distribution name.")
		if $opt->{stable} && length $opt->{version};
	
	my $distro = shift @$args
		or $self->usage_error("You must provide a distribution name.");
	$distro =~ s{::}{-}g;
	
	my $helper = P5U::Lib::Testers::->new(
		      distro    =>   $distro,
		      os_data   => !!$opt->{os_data},
		      stable    => !!$opt->{stable},
		maybe version   =>   $opt->{version},
		      cache_dir =>   $self->get_cachedir->stringify,
	);
	
	if ($opt->{summary})
		{ print $helper->summary_report }
	else
		{ print $helper->version_report }
}

1;
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.