[Catalyst-commits] r6906 - in trunk: .
Catalyst-Plugin-ConfigLoader-Remote
Catalyst-Plugin-ConfigLoader-Remote/lib
Catalyst-Plugin-ConfigLoader-Remote/lib/Catalyst
Catalyst-Plugin-ConfigLoader-Remote/lib/Catalyst/Plugin
Catalyst-Plugin-ConfigLoader-Remote/lib/Catalyst/Plugin/ConfigLoader
Catalyst-Plugin-ConfigLoader-Remote/t Config-Any-Remote
Config-Any-Remote/lib Config-Any-Remote/lib/Config
Config-Any-Remote/lib/Config/Any Config-Any-Remote/t
jshirley at dev.catalyst.perl.org
jshirley at dev.catalyst.perl.org
Sat Sep 15 01:41:39 GMT 2007
Author: jshirley
Date: 2007-09-15 01:41:39 +0100 (Sat, 15 Sep 2007)
New Revision: 6906
Added:
trunk/Catalyst-Plugin-ConfigLoader-Remote/
trunk/Catalyst-Plugin-ConfigLoader-Remote/.cvsignore
trunk/Catalyst-Plugin-ConfigLoader-Remote/Changes
trunk/Catalyst-Plugin-ConfigLoader-Remote/MANIFEST
trunk/Catalyst-Plugin-ConfigLoader-Remote/Makefile.PL
trunk/Catalyst-Plugin-ConfigLoader-Remote/README
trunk/Catalyst-Plugin-ConfigLoader-Remote/lib/
trunk/Catalyst-Plugin-ConfigLoader-Remote/lib/Catalyst/
trunk/Catalyst-Plugin-ConfigLoader-Remote/lib/Catalyst/Plugin/
trunk/Catalyst-Plugin-ConfigLoader-Remote/lib/Catalyst/Plugin/ConfigLoader/
trunk/Catalyst-Plugin-ConfigLoader-Remote/lib/Catalyst/Plugin/ConfigLoader/Remote.pm
trunk/Catalyst-Plugin-ConfigLoader-Remote/t/
trunk/Catalyst-Plugin-ConfigLoader-Remote/t/00-load.t
trunk/Catalyst-Plugin-ConfigLoader-Remote/t/boilerplate.t
trunk/Catalyst-Plugin-ConfigLoader-Remote/t/pod-coverage.t
trunk/Catalyst-Plugin-ConfigLoader-Remote/t/pod.t
trunk/Config-Any-Remote/
trunk/Config-Any-Remote/.cvsignore
trunk/Config-Any-Remote/Changes
trunk/Config-Any-Remote/MANIFEST
trunk/Config-Any-Remote/Makefile.PL
trunk/Config-Any-Remote/README
trunk/Config-Any-Remote/lib/
trunk/Config-Any-Remote/lib/Config/
trunk/Config-Any-Remote/lib/Config/Any/
trunk/Config-Any-Remote/lib/Config/Any/Remote.pm
trunk/Config-Any-Remote/t/
trunk/Config-Any-Remote/t/00-load.t
trunk/Config-Any-Remote/t/basic.t
trunk/Config-Any-Remote/t/boilerplate.t
trunk/Config-Any-Remote/t/lib/
trunk/Config-Any-Remote/t/pod-coverage.t
trunk/Config-Any-Remote/t/pod.t
Log:
First checking in with the basics, no tests yet.
Added: trunk/Catalyst-Plugin-ConfigLoader-Remote/.cvsignore
===================================================================
--- trunk/Catalyst-Plugin-ConfigLoader-Remote/.cvsignore (rev 0)
+++ trunk/Catalyst-Plugin-ConfigLoader-Remote/.cvsignore 2007-09-15 00:41:39 UTC (rev 6906)
@@ -0,0 +1,10 @@
+blib*
+Makefile
+Makefile.old
+Build
+_build*
+pm_to_blib*
+*.tar.gz
+.lwpcookies
+Catalyst-Plugin-ConfigLoader-Remote-*
+cover_db
Added: trunk/Catalyst-Plugin-ConfigLoader-Remote/Changes
===================================================================
--- trunk/Catalyst-Plugin-ConfigLoader-Remote/Changes (rev 0)
+++ trunk/Catalyst-Plugin-ConfigLoader-Remote/Changes 2007-09-15 00:41:39 UTC (rev 6906)
@@ -0,0 +1,5 @@
+Revision history for Catalyst-Plugin-ConfigLoader-Remote
+
+0.01 Date/time
+ First version, released on an unsuspecting world.
+
Added: trunk/Catalyst-Plugin-ConfigLoader-Remote/MANIFEST
===================================================================
--- trunk/Catalyst-Plugin-ConfigLoader-Remote/MANIFEST (rev 0)
+++ trunk/Catalyst-Plugin-ConfigLoader-Remote/MANIFEST 2007-09-15 00:41:39 UTC (rev 6906)
@@ -0,0 +1,10 @@
+Changes
+MANIFEST
+META.yml # Will be created by "make dist"
+Makefile.PL
+README
+lib/Catalyst/Plugin/ConfigLoader/Remote.pm
+t/00-load.t
+t/boilerplate.t
+t/pod-coverage.t
+t/pod.t
Added: trunk/Catalyst-Plugin-ConfigLoader-Remote/Makefile.PL
===================================================================
--- trunk/Catalyst-Plugin-ConfigLoader-Remote/Makefile.PL (rev 0)
+++ trunk/Catalyst-Plugin-ConfigLoader-Remote/Makefile.PL 2007-09-15 00:41:39 UTC (rev 6906)
@@ -0,0 +1,10 @@
+use inc::Module::Install;
+
+name 'Catalyst::Plugin::ConfigLoader::Remote';
+all_from 'lib/Catalyst/Plugin/ConfigLoader/Remote.pm';
+
+requires 'Catalyst::Plugin::ConfigLoader';
+requires 'File::Fetch';
+
+auto_install;
+WriteAll;
Added: trunk/Catalyst-Plugin-ConfigLoader-Remote/README
===================================================================
--- trunk/Catalyst-Plugin-ConfigLoader-Remote/README (rev 0)
+++ trunk/Catalyst-Plugin-ConfigLoader-Remote/README 2007-09-15 00:41:39 UTC (rev 6906)
@@ -0,0 +1,49 @@
+Catalyst-Plugin-ConfigLoader-Remote
+
+The README is used to introduce the module and provide instructions on
+how to install the module, any machine dependencies it may have (for
+example C compilers and installed libraries) and any other information
+that should be provided before the module is installed.
+
+A README file is required for CPAN modules since CPAN extracts the README
+file from a module distribution so that people browsing the archive
+can use it get an idea of the modules uses. It is usually a good idea
+to provide version information here so that people can decide whether
+fixes for the module are worth downloading.
+
+INSTALLATION
+
+To install this module, run the following commands:
+
+ perl Makefile.PL
+ make
+ make test
+ make install
+
+
+SUPPORT AND DOCUMENTATION
+
+After installing, you can find documentation for this module with the perldoc command.
+
+ perldoc Catalyst::Plugin::ConfigLoader::Remote
+
+You can also look for information at:
+
+ Search CPAN
+ http://search.cpan.org/dist/Catalyst-Plugin-ConfigLoader-Remote
+
+ CPAN Request Tracker:
+ http://rt.cpan.org/NoAuth/Bugs.html?Dist=Catalyst-Plugin-ConfigLoader-Remote
+
+ AnnoCPAN, annotated CPAN documentation:
+ http://annocpan.org/dist/Catalyst-Plugin-ConfigLoader-Remote
+
+ CPAN Ratings:
+ http://cpanratings.perl.org/d/Catalyst-Plugin-ConfigLoader-Remote
+
+COPYRIGHT AND LICENCE
+
+Copyright (C) 2007 J. Shirley
+
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
Added: trunk/Catalyst-Plugin-ConfigLoader-Remote/lib/Catalyst/Plugin/ConfigLoader/Remote.pm
===================================================================
--- trunk/Catalyst-Plugin-ConfigLoader-Remote/lib/Catalyst/Plugin/ConfigLoader/Remote.pm (rev 0)
+++ trunk/Catalyst-Plugin-ConfigLoader-Remote/lib/Catalyst/Plugin/ConfigLoader/Remote.pm 2007-09-15 00:41:39 UTC (rev 6906)
@@ -0,0 +1,116 @@
+package Catalyst::Plugin::ConfigLoader::Remote;
+
+use warnings;
+use strict;
+
+use File::Fetch;
+use Scalar::Util qw(blessed);
+use File::Temp qw/tempdir/;
+
+=head1 NAME
+
+Catalyst::Plugin::ConfigLoader::Remote - The great new Catalyst::Plugin::ConfigLoader::Remote!
+
+=head1 VERSION
+
+Version 0.01
+
+=cut
+
+our $VERSION = '0.01';
+
+=head1 SYNOPSIS
+
+Quick summary of what the module does.
+
+Perhaps a little code snippet.
+
+ use Catalyst::Plugin::ConfigLoader::Remote;
+
+ my $foo = Catalyst::Plugin::ConfigLoader::Remote->new();
+ ...
+
+=head1 METHODS
+
+=head2 find_files
+
+=cut
+
+sub find_files {
+ my $c = shift;
+
+ my @files = ();
+ my $tempdir = tempdir( CLEANUP => 1 );
+
+ my @incoming_files = $c->SUPER::find_files();
+
+ # replace everything in @files that is a URI object with a downloaded copy
+ foreach my $arg ( @incoming_files ) {
+ if ( blessed $arg and $arg->isa('URI') ) {
+ # Fetch a blessed URI
+ my $ff = File::Fetch->new( uri => $arg->as_string );
+ if ( $ff ) {
+ my $file = $ff->fetch( to => $tempdir );
+ if ( $file and -f $file ) {
+ push @files, $file;
+ }
+ }
+ } else {
+ push @files, $arg;
+ }
+ }
+ return @files;
+}
+
+=head1 AUTHOR
+
+J. Shirley, C<< <jshirley at gmail.com> >>
+
+=head1 BUGS
+
+Please report any bugs or feature requests to
+C<bug-catalyst-plugin-configloader-remote at rt.cpan.org>, or through the web interface at
+L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Catalyst-Plugin-ConfigLoader-Remote>.
+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 Catalyst::Plugin::ConfigLoader::Remote
+
+You can also look for information at:
+
+=over 4
+
+=item * AnnoCPAN: Annotated CPAN documentation
+
+L<http://annocpan.org/dist/Catalyst-Plugin-ConfigLoader-Remote>
+
+=item * CPAN Ratings
+
+L<http://cpanratings.perl.org/d/Catalyst-Plugin-ConfigLoader-Remote>
+
+=item * RT: CPAN's request tracker
+
+L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Catalyst-Plugin-ConfigLoader-Remote>
+
+=item * Search CPAN
+
+L<http://search.cpan.org/dist/Catalyst-Plugin-ConfigLoader-Remote>
+
+=back
+
+=head1 ACKNOWLEDGEMENTS
+
+=head1 COPYRIGHT & LICENSE
+
+Copyright 2007 J. Shirley, 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; # End of Catalyst::Plugin::ConfigLoader::Remote
Added: trunk/Catalyst-Plugin-ConfigLoader-Remote/t/00-load.t
===================================================================
--- trunk/Catalyst-Plugin-ConfigLoader-Remote/t/00-load.t (rev 0)
+++ trunk/Catalyst-Plugin-ConfigLoader-Remote/t/00-load.t 2007-09-15 00:41:39 UTC (rev 6906)
@@ -0,0 +1,9 @@
+#!perl -T
+
+use Test::More tests => 1;
+
+BEGIN {
+ use_ok( 'Catalyst::Plugin::ConfigLoader::Remote' );
+}
+
+diag( "Testing Catalyst::Plugin::ConfigLoader::Remote $Catalyst::Plugin::ConfigLoader::Remote::VERSION, Perl $], $^X" );
Added: trunk/Catalyst-Plugin-ConfigLoader-Remote/t/boilerplate.t
===================================================================
--- trunk/Catalyst-Plugin-ConfigLoader-Remote/t/boilerplate.t (rev 0)
+++ trunk/Catalyst-Plugin-ConfigLoader-Remote/t/boilerplate.t 2007-09-15 00:41:39 UTC (rev 6906)
@@ -0,0 +1,48 @@
+#!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");
+ }
+}
+
+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)
+);
+
+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]/,
+ );
+}
+
+module_boilerplate_ok('lib/Catalyst/Plugin/ConfigLoader/Remote.pm');
Added: trunk/Catalyst-Plugin-ConfigLoader-Remote/t/pod-coverage.t
===================================================================
--- trunk/Catalyst-Plugin-ConfigLoader-Remote/t/pod-coverage.t (rev 0)
+++ trunk/Catalyst-Plugin-ConfigLoader-Remote/t/pod-coverage.t 2007-09-15 00:41:39 UTC (rev 6906)
@@ -0,0 +1,6 @@
+#!perl -T
+
+use Test::More;
+eval "use Test::Pod::Coverage 1.04";
+plan skip_all => "Test::Pod::Coverage 1.04 required for testing POD coverage" if $@;
+all_pod_coverage_ok();
Added: trunk/Catalyst-Plugin-ConfigLoader-Remote/t/pod.t
===================================================================
--- trunk/Catalyst-Plugin-ConfigLoader-Remote/t/pod.t (rev 0)
+++ trunk/Catalyst-Plugin-ConfigLoader-Remote/t/pod.t 2007-09-15 00:41:39 UTC (rev 6906)
@@ -0,0 +1,6 @@
+#!perl -T
+
+use Test::More;
+eval "use Test::Pod 1.14";
+plan skip_all => "Test::Pod 1.14 required for testing POD" if $@;
+all_pod_files_ok();
Added: trunk/Config-Any-Remote/.cvsignore
===================================================================
--- trunk/Config-Any-Remote/.cvsignore (rev 0)
+++ trunk/Config-Any-Remote/.cvsignore 2007-09-15 00:41:39 UTC (rev 6906)
@@ -0,0 +1,10 @@
+blib*
+Makefile
+Makefile.old
+Build
+_build*
+pm_to_blib*
+*.tar.gz
+.lwpcookies
+Config-Any-Remote-*
+cover_db
Added: trunk/Config-Any-Remote/Changes
===================================================================
--- trunk/Config-Any-Remote/Changes (rev 0)
+++ trunk/Config-Any-Remote/Changes 2007-09-15 00:41:39 UTC (rev 6906)
@@ -0,0 +1,5 @@
+Revision history for Config-Any-Remote
+
+0.01 Date/time
+ First version, released on an unsuspecting world.
+
Added: trunk/Config-Any-Remote/MANIFEST
===================================================================
--- trunk/Config-Any-Remote/MANIFEST (rev 0)
+++ trunk/Config-Any-Remote/MANIFEST 2007-09-15 00:41:39 UTC (rev 6906)
@@ -0,0 +1,10 @@
+Changes
+MANIFEST
+META.yml # Will be created by "make dist"
+Makefile.PL
+README
+lib/Config/Any/Remote.pm
+t/00-load.t
+t/boilerplate.t
+t/pod-coverage.t
+t/pod.t
Added: trunk/Config-Any-Remote/Makefile.PL
===================================================================
--- trunk/Config-Any-Remote/Makefile.PL (rev 0)
+++ trunk/Config-Any-Remote/Makefile.PL 2007-09-15 00:41:39 UTC (rev 6906)
@@ -0,0 +1,10 @@
+use inc::Module::Install;
+
+name 'Config::Any::Remote';
+all_from 'lib/Config/Any/Remote.pm';
+
+requires 'Config::Any';
+requires 'File::Fetch';
+
+auto_install;
+WriteAll;
Added: trunk/Config-Any-Remote/README
===================================================================
--- trunk/Config-Any-Remote/README (rev 0)
+++ trunk/Config-Any-Remote/README 2007-09-15 00:41:39 UTC (rev 6906)
@@ -0,0 +1,49 @@
+Config-Any-Remote
+
+The README is used to introduce the module and provide instructions on
+how to install the module, any machine dependencies it may have (for
+example C compilers and installed libraries) and any other information
+that should be provided before the module is installed.
+
+A README file is required for CPAN modules since CPAN extracts the README
+file from a module distribution so that people browsing the archive
+can use it get an idea of the modules uses. It is usually a good idea
+to provide version information here so that people can decide whether
+fixes for the module are worth downloading.
+
+INSTALLATION
+
+To install this module, run the following commands:
+
+ perl Makefile.PL
+ make
+ make test
+ make install
+
+
+SUPPORT AND DOCUMENTATION
+
+After installing, you can find documentation for this module with the perldoc command.
+
+ perldoc Config::Any::Remote
+
+You can also look for information at:
+
+ Search CPAN
+ http://search.cpan.org/dist/Config-Any-Remote
+
+ CPAN Request Tracker:
+ http://rt.cpan.org/NoAuth/Bugs.html?Dist=Config-Any-Remote
+
+ AnnoCPAN, annotated CPAN documentation:
+ http://annocpan.org/dist/Config-Any-Remote
+
+ CPAN Ratings:
+ http://cpanratings.perl.org/d/Config-Any-Remote
+
+COPYRIGHT AND LICENCE
+
+Copyright (C) 2007 J. Shirley
+
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
Added: trunk/Config-Any-Remote/lib/Config/Any/Remote.pm
===================================================================
--- trunk/Config-Any-Remote/lib/Config/Any/Remote.pm (rev 0)
+++ trunk/Config-Any-Remote/lib/Config/Any/Remote.pm 2007-09-15 00:41:39 UTC (rev 6906)
@@ -0,0 +1,137 @@
+package Config::Any::Remote;
+
+use warnings;
+use strict;
+
+use base qw|Config::Any|;
+
+use Scalar::Util qw(blessed);
+use File::Temp qw/tempdir/;
+use File::Fetch;
+use NEXT;
+
+=head1 NAME
+
+Config::Any::Remote - Capability to fetch remote files for configuration.
+
+=head1 VERSION
+
+Version 0.01
+
+=cut
+
+our $VERSION = '0.01';
+
+=head1 SYNOPSIS
+
+Loads configuration just like L<Config::Any>, but can fetch remote files and
+use those. It stores the downloaded files in a tempfile that is unlinked on
+program exit.
+
+ my $cfg = Config::Any::Remote->load_files({
+ files => [
+ URI->new("http://www.example.com/config1.yml"),
+ URI->new("ftp://ftp.foo.com/config2.conf")
+ ], ...
+ });
+
+=head1 METHODS
+
+=head2 load_files
+
+This behaves near identical to load_files in L<Config::Any>. The only exception
+is that it will download and store to a temporary location any blessed URI file.
+
+=cut
+
+sub load_files {
+ my $class = shift;
+ my $args = shift;
+
+ my @files = ();
+
+ my $tempdir = tempdir( CLEANUP => 1 );
+
+ unless ( exists $args->{files} ) {
+ warn "no files specified";
+ return;
+ }
+
+ my @incoming_files = @{ $args->{files} };
+ foreach my $arg ( @incoming_files ) {
+ if ( blessed $arg and $arg->isa('URI') ) {
+ # Fetch a blessed URI
+ my $ff = File::Fetch->new( uri => $arg->as_string );
+ if ( $ff ) {
+ my $file = $ff->fetch( to => $tempdir );
+ if ( $file and -f $file ) {
+ push @files, $file;
+ }
+ }
+ } else {
+ push @files, $arg;
+ }
+ }
+
+ $args->{files} = \@files;
+
+ $class->NEXT::load_files($args);
+}
+
+# Prevent deep recursion
+sub extensions { return; }
+
+=head1 AUTHOR
+
+J. Shirley, C<< <jshirley at gmail.com> >>
+
+=head1 BUGS
+
+Please report any bugs or feature requests to
+C<bug-config-any-remote at rt.cpan.org>, or through the web interface at
+L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Config-Any-Remote>.
+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 Config::Any::Remote
+
+You can also look for information at:
+
+=over 4
+
+=item * AnnoCPAN: Annotated CPAN documentation
+
+L<http://annocpan.org/dist/Config-Any-Remote>
+
+=item * CPAN Ratings
+
+L<http://cpanratings.perl.org/d/Config-Any-Remote>
+
+=item * RT: CPAN's request tracker
+
+L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Config-Any-Remote>
+
+=item * Search CPAN
+
+L<http://search.cpan.org/dist/Config-Any-Remote>
+
+=back
+
+=head1 ACKNOWLEDGEMENTS
+
+Brian Cassidy for writing L<Config::Any> and other great things.
+
+=head1 COPYRIGHT & LICENSE
+
+Copyright 2007 J. Shirley, 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; # End of Config::Any::Remote
Added: trunk/Config-Any-Remote/t/00-load.t
===================================================================
--- trunk/Config-Any-Remote/t/00-load.t (rev 0)
+++ trunk/Config-Any-Remote/t/00-load.t 2007-09-15 00:41:39 UTC (rev 6906)
@@ -0,0 +1,9 @@
+#!perl -T
+
+use Test::More tests => 1;
+
+BEGIN {
+ use_ok( 'Config::Any::Remote' );
+}
+
+diag( "Testing Config::Any::Remote $Config::Any::Remote::VERSION, Perl $], $^X" );
Added: trunk/Config-Any-Remote/t/basic.t
===================================================================
--- trunk/Config-Any-Remote/t/basic.t (rev 0)
+++ trunk/Config-Any-Remote/t/basic.t 2007-09-15 00:41:39 UTC (rev 6906)
@@ -0,0 +1,28 @@
+use strict;
+use warnings;
+
+use Test::More tests => 10;
+
+use URI;
+
+use Config::Any::Remote;
+
+my @files = qw{
+ http://localhost/~jshirley/test1.yml
+ http://localhost/~jshirley/test2.conf
+};
+
+use YAML::Syck;
+
+my $cfg = Config::Any::Remote->load_files({ use_ext => 1,
+ files => [ map { URI->new($_) } @files ] });
+
+my ( $filename, $config );
+
+
+($filename, $config) = each %{ $cfg->[0] };
+like($filename, qr/test2.conf$/, 'got test2.conf');
+
+($filename, $config) = each %{ $cfg->[1] };
+like($filename, qr/test1.yml$/, 'got test1.yml');
+
Added: trunk/Config-Any-Remote/t/boilerplate.t
===================================================================
--- trunk/Config-Any-Remote/t/boilerplate.t (rev 0)
+++ trunk/Config-Any-Remote/t/boilerplate.t 2007-09-15 00:41:39 UTC (rev 6906)
@@ -0,0 +1,48 @@
+#!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");
+ }
+}
+
+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)
+);
+
+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]/,
+ );
+}
+
+module_boilerplate_ok('lib/Config/Any/Remote.pm');
Added: trunk/Config-Any-Remote/t/pod-coverage.t
===================================================================
--- trunk/Config-Any-Remote/t/pod-coverage.t (rev 0)
+++ trunk/Config-Any-Remote/t/pod-coverage.t 2007-09-15 00:41:39 UTC (rev 6906)
@@ -0,0 +1,6 @@
+#!perl -T
+
+use Test::More;
+eval "use Test::Pod::Coverage 1.04";
+plan skip_all => "Test::Pod::Coverage 1.04 required for testing POD coverage" if $@;
+all_pod_coverage_ok();
Added: trunk/Config-Any-Remote/t/pod.t
===================================================================
--- trunk/Config-Any-Remote/t/pod.t (rev 0)
+++ trunk/Config-Any-Remote/t/pod.t 2007-09-15 00:41:39 UTC (rev 6906)
@@ -0,0 +1,6 @@
+#!perl -T
+
+use Test::More;
+eval "use Test::Pod 1.14";
+plan skip_all => "Test::Pod 1.14 required for testing POD" if $@;
+all_pod_files_ok();
More information about the Catalyst-commits
mailing list