summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2013-09-09 20:03:49 -0400
committerJesse Luehrs <doy@tozt.net>2013-09-09 20:04:56 -0400
commitbfee7132f891416aec2ff54aeab472d91e19f28a (patch)
treedb1cc8ff59b6e7a3c6f0896f32854857238b967e
parent7611b40b746550fc9ef8d13a6f64741f04e7627e (diff)
downloadconf-bfee7132f891416aec2ff54aeab472d91e19f28a.tar.gz
conf-bfee7132f891416aec2ff54aeab472d91e19f28a.zip
allow linting local dist tarballs
-rwxr-xr-xbin/lint-dist29
1 files changed, 21 insertions, 8 deletions
diff --git a/bin/lint-dist b/bin/lint-dist
index 12f7f00..fe0d1ff 100755
--- a/bin/lint-dist
+++ b/bin/lint-dist
@@ -624,14 +624,15 @@ my @dists = $all
: (get_info_for_dists(\@ARGV, $minicpan));
for my $dist (@dists) {
- lint_dist($dist, $minicpan, $github_user);
+ lint_dist(@$dist, $minicpan, $github_user);
say '';
}
sub get_all_dists_for {
my ($cpanid, $minicpan) = @_;
- return sort { fc($a->dist) cmp fc($b->dist) }
+ return map { [ $_, undef ] }
+ sort { fc($a->dist) cmp fc($b->dist) }
grep { $_->dist ne 'perl' }
grep { $_->cpanid eq $cpanid }
_packages($minicpan)->latest_distributions;
@@ -643,11 +644,22 @@ sub get_info_for_dists {
my $p = _packages($minicpan);
return map {
- $p->latest_distribution($_)
- || die "Couldn't find $_ in the index"
+ my $name = (-e) ? get_name_for_tarball($_) : $_;
+ [
+ ($p->latest_distribution($name)
+ || die "Couldn't find $_ in the index"),
+ ((-e) ? $_ : undef)
+ ]
} @$dists;
}
+sub get_name_for_tarball {
+ my ($tarball_name) = @_;
+ require CPAN::DistnameInfo;
+ my $d = CPAN::DistnameInfo->new($tarball_name);
+ return $d->dist;
+}
+
sub _packages {
my ($minicpan) = @_;
@@ -673,12 +685,13 @@ sub _packages {
}
sub lint_dist {
- my ($dist, $minicpan, $github_user) = @_;
+ my ($dist, $tarball_name, $minicpan, $github_user) = @_;
my $to_lint = Dist::To::Lint->new(
- dist => $dist,
- minicpan => $minicpan,
- github_user => $github_user,
+ dist => $dist,
+ tarball_name => $tarball_name,
+ minicpan => $minicpan,
+ github_user => $github_user,
);
for my $check (@checks) {