From: Vincent Pit Date: Mon, 16 Feb 2009 17:15:09 +0000 (+0100) Subject: Initial commit X-Git-Tag: v0.01~1 X-Git-Url: http://git.vpit.fr/?a=commitdiff_plain;h=ccce87545fda1846090f652fc4770e2393070ab9;p=perl%2Fmodules%2FAcme-CPANAuthors-You-re_using.git Initial commit --- ccce87545fda1846090f652fc4770e2393070ab9 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..fa4104d --- /dev/null +++ b/.gitignore @@ -0,0 +1,25 @@ +blib* +pm_to_blib* + +Makefile +Makefile.old +Build +_build* + +*.tar.gz +Acme-CPANAuthors-You-re_using-* + +core.* +*.[co] +*.so +*.bs +*.out +*.def +*.exp + +cover_db +*.gcda +*.gcov +*.gcno + +Debian_CPANTS.txt diff --git a/Changes b/Changes new file mode 100644 index 0000000..77a8425 --- /dev/null +++ b/Changes @@ -0,0 +1,3 @@ +0.01 2009-02-16 18:10 UTC + First version, released on an unsuspecting world. + diff --git a/MANIFEST b/MANIFEST new file mode 100644 index 0000000..7c28cd7 --- /dev/null +++ b/MANIFEST @@ -0,0 +1,14 @@ +Changes +MANIFEST +META.yml +Makefile.PL +README +lib/Acme/CPANAuthors/You/re_using.pm +samples/list_authors +t/00-load.t +t/10-base.t +t/90-boilerplate.t +t/91-pod.t +t/92-pod-coverage.t +t/95-portability-files.t +t/99-kwalitee.t diff --git a/META.yml b/META.yml new file mode 100644 index 0000000..5151af4 --- /dev/null +++ b/META.yml @@ -0,0 +1,32 @@ +--- #YAML:1.0 +name: Acme-CPANAuthors-You-re_using +version: 0.01 +abstract: We are the CPAN authors that have written the modules installed for this perl. +author: + - Vincent Pit +license: perl +distribution_type: module +configure_requires: + ExtUtils::MakeMaker: 0 +build_requires: + Acme::CPANAuthors: 0 + ExtUtils::MakeMaker: 0 + Test::More: 0 +requires: + Acme::CPANAuthors: 0 + Carp: 0 + ExtUtils::Installed: 0 + perl: 5.006 +resources: + bugtracker: http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Acme-CPANAuthors-You-re_using + homepage: http://search.cpan.org/dist/Acme-CPANAuthors-You-re_using/ + license: http://dev.perl.org/licenses/ + repository: http://git.profvince.com/perl/modules/Acme-CPANAuthors-You-re_using.git +no_index: + directory: + - t + - inc +generated_by: ExtUtils::MakeMaker version 6.48 +meta-spec: + url: http://module-build.sourceforge.net/META-spec-v1.4.html + version: 1.4 diff --git a/Makefile.PL b/Makefile.PL new file mode 100644 index 0000000..1bc7582 --- /dev/null +++ b/Makefile.PL @@ -0,0 +1,45 @@ +use strict; +use warnings; +use ExtUtils::MakeMaker; + +my $dist = 'Acme-CPANAuthors-You-re_using'; + +my %META = ( + configure_requires => { + 'ExtUtils::MakeMaker' => 0, + }, + build_requires => { + 'Acme::CPANAuthors' => 0, + 'ExtUtils::MakeMaker' => 0, + 'Test::More' => 0, + }, + resources => { + bugtracker => "http://rt.cpan.org/NoAuth/ReportBug.html?Queue=$dist", + homepage => "http://search.cpan.org/dist/$dist/", + license => 'http://dev.perl.org/licenses/', + repository => "http://git.profvince.com/perl/modules/$dist.git", + }, +); + +WriteMakefile( + NAME => 'Acme::CPANAuthors::You::re_using', + AUTHOR => 'Vincent Pit ', + LICENSE => 'perl', + VERSION_FROM => 'lib/Acme/CPANAuthors/You/re_using.pm', + ABSTRACT_FROM => 'lib/Acme/CPANAuthors/You/re_using.pm', + PL_FILES => {}, + PREREQ_PM => { + 'Acme::CPANAuthors' => 0, + 'Carp' => 0, + 'ExtUtils::Installed' => 0, + }, + MIN_PERL_VERSION => 5.006, + META_MERGE => \%META, + dist => { + PREOP => 'pod2text lib/Acme/CPANAuthors/You/re_using.pm > $(DISTVNAME)/README', + COMPRESS => 'gzip -9f', SUFFIX => 'gz' + }, + clean => { + FILES => "$dist-* *.gcov *.gcda *.gcno cover_db Debian_CPANTS.txt" + }, +); diff --git a/README b/README new file mode 100644 index 0000000..cf94e12 --- /dev/null +++ b/README @@ -0,0 +1,51 @@ +NAME + Acme::CPANAuthors::You::re_using - We are the CPAN authors that have + written the modules installed for this perl. + +VERSION + Version 0.01 + +SYNOPSIS + use Acme::CPANAuthors; + + my $authors = Acme::CPANAuthors->new("You're_using"); + print $authors->name($_) . " ($_)\n" for $authors->id; + +DESCRIPTION + This module builds an Acme::CPANAuthors class by looking for all + installed modules for the current "perl" and then retrieving theirs + authors' name and PAUSE id. + + It may take some time to load since it has to get CPAN indexes at + "BEGIN" time. + +DEPENDENCIES + Carp, ExtUtils::Installed, Acme::CPANAuthors. + +SEE ALSO + All others "Acme::CPANAuthors::*" modules. + +AUTHOR + Vincent Pit, "", . + + You can contact me by mail or on "irc.perl.org" (vincent). + +BUGS + Please report any bugs or feature requests to + "bug-acme-cpanauthors-you-re_using at rt.cpan.org", or through the web + interface at + . I will be notified, and then you'll automatically be notified of + progress on your bug as I make changes. + +SUPPORT + You can find documentation for this module with the perldoc command. + + perldoc Acme::CPANAuthors::You::re_using + +COPYRIGHT & LICENSE + Copyright 2009 Vincent Pit, all rights reserved. + + This program is free software; you can redistribute it and/or modify it + under the same terms as Perl itself. + diff --git a/lib/Acme/CPANAuthors/You/re_using.pm b/lib/Acme/CPANAuthors/You/re_using.pm new file mode 100644 index 0000000..36fd9c7 --- /dev/null +++ b/lib/Acme/CPANAuthors/You/re_using.pm @@ -0,0 +1,108 @@ +package Acme::CPANAuthors::You::re_using; + +use strict; +use warnings; + +use Carp qw/croak/; + +use ExtUtils::Installed; + +use Acme::CPANAuthors::Utils; + +=head1 NAME + +Acme::CPANAuthors::You::re_using - We are the CPAN authors that have written the modules installed for this perl. + +=head1 VERSION + +Version 0.01 + +=cut + +our $VERSION; +BEGIN { + $VERSION = '0.01'; +} + +=head1 SYNOPSIS + + use Acme::CPANAuthors; + + my $authors = Acme::CPANAuthors->new("You're_using"); + print $authors->name($_) . " ($_)\n" for $authors->id; + +=head1 DESCRIPTION + +This module builds an L class by looking for all installed modules for the current C and then retrieving theirs authors' name and PAUSE id. + +It may take some time to load since it has to get CPAN indexes at C time. + +=cut + +BEGIN { + my %authors; + + my $pkgs = Acme::CPANAuthors::Utils::cpan_packages(); + croak 'Couldn\'t retrieve a valid Parse::CPAN::Packages object' unless $pkgs; + + my $auths = Acme::CPANAuthors::Utils::cpan_authors(); + croak 'Couldn\'t retrieve a valid Parse::CPAN::Authors object' unless $auths; + + my $installed = ExtUtils::Installed->new; + croak 'Couldn\'t create a valid ExtUtils::Installed object' unless $installed; + + for ($installed->modules()) { + my $mod = $pkgs->package($_); + next unless $mod; + + my $dist = $mod->distribution; + next unless $dist; + + my $cpanid = $dist->cpanid; + next if not $cpanid or exists $authors{$cpanid}; + + my $auth = $auths->author($cpanid); + + my $name; + $name = $auth->name if defined $auth; + + $authors{$cpanid} = defined $name ? $name : $cpanid; + } + + require Acme::CPANAuthors::Register; + Acme::CPANAuthors::Register->import(%authors); +} + +=head1 DEPENDENCIES + +L, L, L. + +=head1 SEE ALSO + +All others C modules. + +=head1 AUTHOR + +Vincent Pit, C<< >>, L. + +You can contact me by mail or on C (vincent). + +=head1 BUGS + +Please report any bugs or feature requests to C, or through the web interface at L. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. + +=head1 SUPPORT + +You can find documentation for this module with the perldoc command. + + perldoc Acme::CPANAuthors::You::re_using + +=head1 COPYRIGHT & LICENSE + +Copyright 2009 Vincent Pit, all rights reserved. + +This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. + +=cut + +1; diff --git a/samples/list_authors b/samples/list_authors new file mode 100644 index 0000000..bc91585 --- /dev/null +++ b/samples/list_authors @@ -0,0 +1,9 @@ +#!perl + +use strict; +use warnings; + +use Acme::CPANAuthors; + +my $authors = Acme::CPANAuthors->new("You're_using"); +print $authors->name($_) . " ($_)\n" for $authors->id; diff --git a/t/00-load.t b/t/00-load.t new file mode 100644 index 0000000..1211a76 --- /dev/null +++ b/t/00-load.t @@ -0,0 +1,13 @@ +#!perl + +use strict; +use warnings; + +use Test::More tests => 1; + +BEGIN { + local $^W = 0; + use_ok( "Acme::CPANAuthors::You're_using" ); +} + +diag( "Testing Acme::CPANAuthors::You're_using $Acme::CPANAuthors::You're_using::VERSION, Perl $], $^X" ); diff --git a/t/10-base.t b/t/10-base.t new file mode 100644 index 0000000..60a54bc --- /dev/null +++ b/t/10-base.t @@ -0,0 +1,18 @@ +#!perl + +use strict; +use warnings; + +use Test::More tests => 1; + +use Acme::CPANAuthors; + +my $authors = eval { Acme::CPANAuthors->new("You're_using") }; + +SKIP: { + skip $@ => 1 unless defined $authors; + + my $count = $authors->count; + diag "$count authors found"; + cmp_ok $count, '>', 0, 'there are some authors'; +} diff --git a/t/90-boilerplate.t b/t/90-boilerplate.t new file mode 100644 index 0000000..162fcdd --- /dev/null +++ b/t/90-boilerplate.t @@ -0,0 +1,49 @@ +#!perl -T + +use strict; +use warnings; +use Test::More tests => 3; + +sub not_in_file_ok { + my ($filename, %regex) = @_; + open( my $fh, '<', $filename ) + or die "couldn't open $filename for reading: $!"; + + my %violated; + + while (my $line = <$fh>) { + while (my ($desc, $regex) = each %regex) { + if ($line =~ $regex) { + push @{$violated{$desc}||=[]}, $.; + } + } + } + + if (%violated) { + fail("$filename contains boilerplate text"); + diag "$_ appears on lines @{$violated{$_}}" for keys %violated; + } else { + pass("$filename contains no boilerplate text"); + } +} + +sub module_boilerplate_ok { + my ($module) = @_; + not_in_file_ok($module => + 'the great new $MODULENAME' => qr/ - The great new /, + 'boilerplate description' => qr/Quick summary of what the module/, + 'stub function definition' => qr/function[12]/, + ); +} + +not_in_file_ok(README => + "The README is used..." => qr/The README is used/, + "'version information here'" => qr/to provide version information/, +); + +not_in_file_ok(Changes => + "placeholder date/time" => qr(Date/time) +); + +module_boilerplate_ok('lib/Acme/CPANAuthors/You/re_using.pm'); + diff --git a/t/91-pod.t b/t/91-pod.t new file mode 100644 index 0000000..ee8b18a --- /dev/null +++ b/t/91-pod.t @@ -0,0 +1,12 @@ +#!perl -T + +use strict; +use warnings; +use Test::More; + +# Ensure a recent version of Test::Pod +my $min_tp = 1.22; +eval "use Test::Pod $min_tp"; +plan skip_all => "Test::Pod $min_tp required for testing POD" if $@; + +all_pod_files_ok(); diff --git a/t/92-pod-coverage.t b/t/92-pod-coverage.t new file mode 100644 index 0000000..27e0cf8 --- /dev/null +++ b/t/92-pod-coverage.t @@ -0,0 +1,16 @@ +use strict; +use warnings; +use Test::More; + +# Ensure a recent version of Test::Pod::Coverage +my $min_tpc = 1.08; +eval "use Test::Pod::Coverage $min_tpc"; +plan skip_all => "Test::Pod::Coverage $min_tpc required for testing POD coverage" if $@; + +# Test::Pod::Coverage doesn't require a minimum Pod::Coverage version, +# but older versions don't recognize some common documentation styles +my $min_pc = 0.18; +eval "use Pod::Coverage $min_pc"; +plan skip_all => "Pod::Coverage $min_pc required for testing POD coverage" if $@; + +all_pod_coverage_ok( { also_private => [ qw/format_available init prepare create install uninstall/ ] }); diff --git a/t/95-portability-files.t b/t/95-portability-files.t new file mode 100644 index 0000000..ab541f3 --- /dev/null +++ b/t/95-portability-files.t @@ -0,0 +1,10 @@ +#!perl -T + +use strict; +use warnings; + +use Test::More; + +eval "use Test::Portability::Files"; +plan skip_all => "Test::Portability::Files required for testing filenames portability" if $@; +run_tests(); diff --git a/t/99-kwalitee.t b/t/99-kwalitee.t new file mode 100644 index 0000000..7775e60 --- /dev/null +++ b/t/99-kwalitee.t @@ -0,0 +1,9 @@ +#!perl + +use strict; +use warnings; + +use Test::More; + +eval { require Test::Kwalitee; Test::Kwalitee->import() }; +plan( skip_all => 'Test::Kwalitee not installed; skipping' ) if $@;