App-Midgen
view release on metacpan or search on metacpan
lib/App/Midgen/Role/Output/METAjson.pm view on Meta::CPAN
package App::Midgen::Role::Output::METAjson;
use constant {
BLANK => q{ },
NONE => q{},
THREE => q{ },
SIX => q{ },
NINE => q{ },
TWELVE => q{ },
};
use Moo::Role;
requires qw( no_index verbose );
# Load time and dependencies negate execution time
# use namespace::clean -except => 'meta';
our $VERSION = '0.34';
$VERSION = eval $VERSION; ## no critic
use English qw( -no_match_vars ); # Avoids reg-ex performance penalty
local $OUTPUT_AUTOFLUSH = 1;
use Term::ANSIColor qw( :constants colored );
use Data::Printer {caller_info => 1,};
use File::Spec;
#######
# header_metajson
#######
sub header_metajson {
my $self = shift;
my $package_name = shift || NONE;
$package_name =~ s{::}{-}g;
print "{\n";
if ($self->verbose > 0) {
print BRIGHT_BLACK THREE
. '"abstract" : "This is a short description of the purpose of the distribution.",' . "\n";
print THREE . '"author" : "...",' . "\n";
print THREE . '"dynamic_config" : "0|1",' . "\n";
print THREE . '"generated_by" : "...",' . "\n";
print THREE . '"license" : [' . "\n";
print SIX . '"perl_5"' . "\n";
print THREE . "],\n";
print THREE . '"meta-spec" : {' . "\n";
print SIX . '"url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",' . "\n";
print SIX . '"version" : "2"' . "\n";
print THREE . '},';
}
print CLEAR THREE . '"name" : "' . $package_name . q{",} . "\n";
if ($self->verbose > 0) {
print BRIGHT_BLACK THREE . '"release_status" : "stable|testing|unstable",' . "\n";
print THREE . '"version" : "...",' . "\n";
}
return;
}
#######
# body_metajson
#######
sub body_metajson {
my $self = shift;
my $title = shift;
my $required_ref = shift || return;
return if not %{$required_ref};
if ( $title eq 'RuntimeRequires') {
print CLEAR THREE . '"prereqs" : {' . "\n";
print SIX . '"runtime" : {' . "\n";
print NINE . '"requires" : {' . "\n";
$required_ref->{'perl'} = $App::Midgen::Min_Version;
foreach my $module_name (sort keys %{$required_ref}) {
print TWELVE . "\"$module_name\" : \"$required_ref->{$module_name}\",\n"
if $required_ref->{$module_name} !~ m/mcpan/;
}
( run in 2.740 seconds using v1.01-cache-2.11-cpan-5837b0d9d2c )