Skip to content

Commit

Permalink
Don't pre-set appveyor status
Browse files Browse the repository at this point in the history
The Dist model already handles the not-set-up case and the
appveyor postprocessor handles the 'unknown'
  • Loading branch information
zoffixznet committed Aug 6, 2017
1 parent 54a715c commit badc389
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 22 deletions.
49 changes: 29 additions & 20 deletions lib/ModulesPerl6/DbBuilder/Dist/PostProcessor/METAChecker.pm
Expand Up @@ -19,44 +19,53 @@ sub process {
my $repo_url = 'https://github.com/'
. join '/', grep length, @{ $dist->{_builder} }{qw/repo_user repo/};

if ( $repo_url eq $dist->{url} ) {
log info => "dist source URL is same as META repo URL ($repo_url)";
return;
}

my $code = Mojo::UserAgent->new( max_redirects => 5 )
->get( $dist->{url} )->res->code;

log +( $code == 200 ? 'info' : 'error' ),
"HTTP $code when accessing dist source URL ($dist->{url})";

return unless $dist->{_builder}{is_fresh};

my @problems;
unless ($dist->{_builder}{has_manifest}) {
push @problems, problem("dist has no MANIFEST file", 3);
push @problems, problem "dist has no MANIFEST file", 3;
}

if ($dist->{_builder}{no_author_set}) {
push @problems, problem("dist has no author(s) specified", 3);
push @problems, problem "dist has no author(s) specified", 3;
}

if ($dist->{_builder}{has_no_readme}) {
push @problems, problem("dist has no readme", 1);
push @problems, problem "dist has no readme", 1;
}

if ($dist->{_builder}{mentions_old_tools}) {
push @problems, problem("dist mentions discouraged tools (panda, ufo etc.) in the readme", 2);
push @problems, problem "dist mentions discouraged tools (panda, ufo etc.) in the readme", 2;
}

length $dist->{ $_ } or push @problems, problem("required `$_` field is missing", 5)
for qw/perl name version description provides/;
length $dist->{ $_ }
or push @problems, problem "required `$_` field is missing", 5
for qw/perl name version description provides/;

push @problems, problem("dist does not have any tags", 1)
push @problems, problem "dist does not have any tags", 1
unless @{ $dist->{tags} };

push @problems, problem("dist does not have a version set", 5)
unless ($dist->{version} and $dist->{version} ne '*');

$dist->{problems} = \@problems;

if ( $repo_url eq $dist->{url} ) {
log info => "dist source URL is same as META repo URL ($repo_url)";
return;
if ($dist->{version}) {
push @problems, problem "dist has `*` version (it's invalid)", 5
if $dist->{version} eq '*';
}
else {
push @problems, problem "dist does not have a version set", 5
unless $dist->{version} and $dist->{version} ne '*';
}

my $code = Mojo::UserAgent->new( max_redirects => 5 )
->get( $dist->{url} )->res->code;

log +( $code == 200 ? 'info' : 'error' ),
"HTTP $code when accessing dist source URL ($dist->{url})";
$dist->{problems} = \@problems;

return 1;
}
Expand Down
5 changes: 3 additions & 2 deletions lib/ModulesPerl6/DbBuilder/Dist/Source/GitHub.pm
Expand Up @@ -109,8 +109,9 @@ sub load {
# if you add {_builder} stuff, ensure it still maintains correct stuff when dist has
# no new commits and we bail out of this routine early.
# (see conditional a dozen of lines above that `reinstates` travis status for example)
$dist->{_builder}{has_appveyor} = grep { $_->{path} =~ /\A \.? appveyor\.yml \z/x } @$tree;
$dist->{appveyor_status} = $dist->{_builder}{has_appveyor} ? 'unknown' : 'not set up';
$dist->{_builder}{has_appveyor}
= grep $_->{path} =~ /\A \.? appveyor\.yml \z/x, @$tree;

$dist->{_builder}{has_travis} = grep $_->{path} eq '.travis.yml', @$tree;
$dist->{_builder}{has_manifest} = grep $_->{path} eq 'MANIFEST', @$tree;
my ($readme) = grep { $_->{path} =~ /^README/ } @$tree;
Expand Down

0 comments on commit badc389

Please sign in to comment.