Skip to content

Start a YAML.JSON module #17

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions lib/Module/CPANTS/Analyse.pm
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ use Carp;
use Module::CPANTS::Kwalitee;
use IO::Capture::Stdout;
use IO::Capture::Stderr;
use YAML::Any qw(LoadFile);

our $VERSION = '0.87';

Expand Down Expand Up @@ -213,10 +212,6 @@ Returns the location of the unextracted tarball.

Returns the filename of the tarball.

=head3 read_meta_yml

Reads the META.yml file and returns its content.

=head1 WEBSITE

L<http://cpants.perl.org/>
Expand Down
7 changes: 7 additions & 0 deletions lib/Module/CPANTS/Kwalitee/Files.pm
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,13 @@ sub kwalitee_indicators {
remedy=>q{Add a META.yml to the distribution. Your buildtool should be able to autogenerate it.},
code=>sub { shift->{file_meta_yml} ? 1 : 0 },
},
{
is_experimental=>1,
name=>'has_meta_json',
error=>q{The file 'META.json' is missing from this distribution. META.json is needed by people maintaining module collections (like CPAN), for people writing installation tools, or just people who want to know some stuff about a distribution before downloading it.},
remedy=>q{Add a META.json to the distribution. Your buildtool should be able to autogenerate it.},
code=>sub { shift->{file_meta_json} ? 1 : 0 },
},
{
name=>'has_buildtool',
error=>q{Makefile.PL and/or Build.PL are missing. This makes installing this distribution hard for humans and impossible for automated tools like CPAN/CPANPLUS},
Expand Down
2 changes: 1 addition & 1 deletion t/02_kwalitee.t
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use Module::CPANTS::Kwalitee;

my $CORE = 26;
my $EXTRA = 8; #is_extra set
my $EXPERIMENTAL = 10; #experimental?
my $EXPERIMENTAL = 12; #experimental?
my $METRICS = $CORE + $EXTRA + $EXPERIMENTAL;

plan tests => 8 + 2 * $METRICS;
Expand Down
7 changes: 4 additions & 3 deletions t/03_plugins.t
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use strict;
use warnings;
use Test::More tests => 9;
use Test::More tests => 10;
use Test::Deep;
use Test::NoWarnings;

Expand All @@ -15,7 +15,7 @@ my $a=Module::CPANTS::Analyse->new({dist => 'dummy'});

{
my @plugins=$a->plugins;
is(@plugins,16,'number of plugins');
is(@plugins,17,'number of plugins');
}


Expand All @@ -24,7 +24,8 @@ my $plugins=$a->mck->generators;
is(shift(@$plugins),'Module::CPANTS::Kwalitee::Files','plugin order 1 Files');
is(shift(@$plugins),'Module::CPANTS::Kwalitee::Distname','plugin order 2 Distname');
is(shift(@$plugins),'Module::CPANTS::Kwalitee::MetaYML','plugin order 3 MetaYML');
is(shift(@$plugins),'Module::CPANTS::Kwalitee::FindModules','plugin order 4 FindModules');
is(shift(@$plugins),'Module::CPANTS::Kwalitee::MetaJSON','plugin order 4 MetaJSON');
is(shift(@$plugins),'Module::CPANTS::Kwalitee::FindModules','plugin order 5 FindModules');
is(pop(@$plugins),'Module::CPANTS::Kwalitee::CpantsErrors','plugin order last CpantsErrors');

cmp_deeply($plugins,bag(
Expand Down
8 changes: 7 additions & 1 deletion t/10_analyse.t
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ my @tests = (
'has_changelog' => 1,
'no_pod_errors' => 1,
'use_strict' => 1,
'metajson_is_parsable' => 0,
'kwalitee' => 29,
'no_stdin_for_prompting' => 1,
'easily_repackageable' => 0,
Expand Down Expand Up @@ -149,6 +150,7 @@ my @tests = (
'metayml_declares_perl_version' => 1,
'has_example' => 1,
'metayml_is_parsable' => 1,
'metajson_is_parsable' => 0,
'proper_libs' => 1,
'has_changelog' => 1,
'no_pod_errors' => 1,
Expand Down Expand Up @@ -201,6 +203,7 @@ my @tests = (
'metayml_declares_perl_version' => 0,
'has_example' => 1,
'metayml_is_parsable' => 1,
'metajson_is_parsable' => 0,
'proper_libs' => 1,
'has_changelog' => 1,
'no_pod_errors' => 1,
Expand Down Expand Up @@ -248,6 +251,7 @@ my @tests = (
'metayml_declares_perl_version' => 1,
'has_example' => 0,
'metayml_is_parsable' => 1,
'metajson_is_parsable' => 0,
'proper_libs' => 1,
'has_changelog' => 1,
'no_pod_errors' => 1,
Expand Down Expand Up @@ -298,6 +302,7 @@ my @tests = (
'has_changelog' => 1,
'no_pod_errors' => 1,
'use_strict' => 1,
'metajson_is_parsable' => 0,
'kwalitee' => 38,
'no_stdin_for_prompting' => 1,
'has_license_in_source_file' => 1,
Expand Down Expand Up @@ -340,6 +345,7 @@ my @tests = (
'metayml_declares_perl_version' => 1,
'has_example' => 1,
'metayml_is_parsable' => 1,
'metajson_is_parsable' => 0,
'proper_libs' => 1,
'has_changelog' => 1,
'no_pod_errors' => 1,
Expand Down Expand Up @@ -396,7 +402,7 @@ foreach my $t (@tests) {
});

my $rv=$a->unpack;
is($rv,undef,'unpack ok');
is($rv,undef,"unpack $t->{dist}");

$a->analyse;
$a->calc_kwalitee;
Expand Down
1 change: 1 addition & 0 deletions t/generated_files.t
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ my $expected = {
'has_humanreadable_license' => 0,
'no_generated_files' => 0,
'has_meta_yml' => 1,
'has_meta_json' => 0,
'metayml_conforms_spec_current' => 0,
'use_warnings' => 0,
'no_large_files' => 1,
Expand Down