App-Prove-Plugin-Elasticsearch
view release on metacpan or search on metacpan
lib/App/ape/plan.pm view on Meta::CPAN
# PODNAME: App::ape::plan
# ABSTRACT: plan testing using elasticsearch
package App::ape::plan;
$App::ape::plan::VERSION = '0.001';
use strict;
use warnings;
use Getopt::Long qw{GetOptionsFromArray};
use App::Prove::Elasticsearch::Utils;
use App::Prove::State;
use Pod::Usage;
use IO::Prompter [ -yesno, -single, -stdio, -style => 'bold' ];
use List::Util qw{shuffle};
use File::Basename qw{basename};
use POSIX qw{strftime};
sub new {
my ($class, @args) = @_;
my (%options, @conf, $help);
GetOptionsFromArray(
\@args,
'platform=s@' => \$options{platforms},
'version=s' => \$options{version},
'show' => \$options{show},
'prompt' => \$options{prompt},
'pairwise' => \$options{pairwise},
'all-platforms' => \$options{allplatforms},
'recurse' => \$options{recurse},
'extension=s@' => \$options{exts},
'name' => \$options{name},
'requeue' => \$options{requeue},
'replay' => \$options{replay},
'help' => \$help,
);
$options{platforms} //= [];
#Deliberately exiting here, as I "unit" test this as the binary
pod2usage(0) if $help;
if (!$options{version}) {
pod2usage(
-exitval => "NOEXIT",
-msg => "Insufficient arguments. You must pass --version.",
);
return 2;
}
if ($options{prompt} && $options{show}) {
pod2usage(
-exitval => "NOEXIT",
-msg =>
"--prompt and --show are mutually exclusive options. You must pass one or the other.",
);
return 3;
}
#Store platform groups in the configuration to differentiate further plans
my $conf = App::Prove::Elasticsearch::Utils::process_configuration(@conf);
if (
scalar(
grep {
my $subj = $_;
grep { $subj eq $_ } qw{server.host server.port}
} keys(%$conf)
) != 2
) {
pod2usage(
-exitval => "NOEXIT",
-msg =>
"Insufficient information provided to associate defect with test results to elasticsearch",
( run in 0.517 second using v1.01-cache-2.11-cpan-524268b4103 )