r48969 - in /trunk/libtest-cpan-meta-perl: Changes META.yml debian/changelog lib/Test/CPAN/Meta.pm lib/Test/CPAN/Meta/Version.pm t/03metaversion.t
jawnsy-guest at users.alioth.debian.org
jawnsy-guest at users.alioth.debian.org
Sat Dec 19 00:15:34 UTC 2009
Author: jawnsy-guest
Date: Sat Dec 19 00:15:23 2009
New Revision: 48969
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=48969
Log:
New upstream release
Modified:
trunk/libtest-cpan-meta-perl/Changes
trunk/libtest-cpan-meta-perl/META.yml
trunk/libtest-cpan-meta-perl/debian/changelog
trunk/libtest-cpan-meta-perl/lib/Test/CPAN/Meta.pm
trunk/libtest-cpan-meta-perl/lib/Test/CPAN/Meta/Version.pm
trunk/libtest-cpan-meta-perl/t/03metaversion.t
Modified: trunk/libtest-cpan-meta-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-cpan-meta-perl/Changes?rev=48969&op=diff
==============================================================================
--- trunk/libtest-cpan-meta-perl/Changes (original)
+++ trunk/libtest-cpan-meta-perl/Changes Sat Dec 19 00:15:23 2009
@@ -1,4 +1,10 @@
# Changes log for Test::CPAN::Meta
+
+0.16 18/12/2009
+ - renamed word() to keyword().
+ - added identifier() validation.
+ - changed optional_features key from a keyword to an identifier type,
+ thus further clarifying RT#52685 (thanks Kevin).
0.15 12/12/2009
- clarified spec defined and user defined keys, as promoted by Kevin
Modified: trunk/libtest-cpan-meta-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-cpan-meta-perl/META.yml?rev=48969&op=diff
==============================================================================
--- trunk/libtest-cpan-meta-perl/META.yml (original)
+++ trunk/libtest-cpan-meta-perl/META.yml Sat Dec 19 00:15:23 2009
@@ -1,6 +1,6 @@
--- #YAML:1.0
name: Test-CPAN-Meta
-version: 0.15
+version: 0.16
abstract: A test module to validate a CPAN META.yml file.
author:
- Barbie <barbie at cpan.org>
@@ -24,10 +24,10 @@
provides:
Test::CPAN::Meta:
file: lib/Test/CPAN/Meta.pm
- version: 0.15
+ version: 0.16
Test::CPAN::Meta::Version:
file: lib/Test/CPAN/Meta/Version.pm
- version: 0.15
+ version: 0.16
no_index:
directory:
- t
Modified: trunk/libtest-cpan-meta-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-cpan-meta-perl/debian/changelog?rev=48969&op=diff
==============================================================================
--- trunk/libtest-cpan-meta-perl/debian/changelog (original)
+++ trunk/libtest-cpan-meta-perl/debian/changelog Sat Dec 19 00:15:23 2009
@@ -1,3 +1,9 @@
+libtest-cpan-meta-perl (0.16-1) UNRELEASED; urgency=low
+
+ * New upstream release
+
+ -- Jonathan Yu <jawnsy at cpan.org> Fri, 18 Dec 2009 16:06:20 -0500
+
libtest-cpan-meta-perl (0.15-1) unstable; urgency=low
* New upstream release
Modified: trunk/libtest-cpan-meta-perl/lib/Test/CPAN/Meta.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-cpan-meta-perl/lib/Test/CPAN/Meta.pm?rev=48969&op=diff
==============================================================================
--- trunk/libtest-cpan-meta-perl/lib/Test/CPAN/Meta.pm (original)
+++ trunk/libtest-cpan-meta-perl/lib/Test/CPAN/Meta.pm Sat Dec 19 00:15:23 2009
@@ -4,7 +4,7 @@
use strict;
use vars qw($VERSION);
-$VERSION = '0.15';
+$VERSION = '0.16';
#----------------------------------------------------------------------------
@@ -153,11 +153,34 @@
return $yaml;
}
-q( Currently Listening To: Joy Division - "Transmission" from 'Heart And Soul');
+q( Currently Listening To: Nine Inch Nails - "Head Down" from 'The Slip');
__END__
#----------------------------------------------------------------------------
+
+=head1 TESTING META FILES
+
+There are currently 3 distributions to test META files:
+
+ Test-CPAN-Meta
+ Test-JSON-Meta
+ Test-YAML-Meta
+
+All three have slightly different requirements and are intended to be used in
+slightly different environments.
+
+Test-YAML-Meta requires a YAML parser, and currently looks for the YAML or
+YAML::Syck modules. This is the original variant of the 3 and was intended to
+provide a more complete YAML validation of a META.yml.
+
+Test-CPAN-Meta requires the Parse::CPAN::Meta module, which is now part of Perl
+Core as of perl-5.10.1. This version is intended to be used by those only
+wishing to rely on core modules to test their META.yml files.
+
+Test-JSON-Meta is the most recent addition to the family, and is specifically
+aimed at those distributions that use a META.json Meta file. The distribution
+requires the JSON module to parse the Meta file.
=head1 BUGS, PATCHES & FIXES
Modified: trunk/libtest-cpan-meta-perl/lib/Test/CPAN/Meta/Version.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-cpan-meta-perl/lib/Test/CPAN/Meta/Version.pm?rev=48969&op=diff
==============================================================================
--- trunk/libtest-cpan-meta-perl/lib/Test/CPAN/Meta/Version.pm (original)
+++ trunk/libtest-cpan-meta-perl/lib/Test/CPAN/Meta/Version.pm Sat Dec 19 00:15:23 2009
@@ -4,7 +4,7 @@
use strict;
use vars qw($VERSION);
-$VERSION = '0.15';
+$VERSION = '0.16';
#----------------------------------------------------------------------------
@@ -64,7 +64,7 @@
}
};
my $no_index_1_1 = {
- 'map' => { ':key' => { name => \&word, list => { value => \&string } },
+ 'map' => { ':key' => { name => \&keyword, list => { value => \&string } },
}
};
@@ -92,7 +92,7 @@
'optional_features' => {
'map' => {
- ':key' => { name => \&word,
+ ':key' => { name => \&identifier,
'map' => { description => { value => \&string },
requires_packages => { value => \&string },
requires_os => { value => \&string },
@@ -128,7 +128,7 @@
# additional user defined key/value pairs
# note we can only validate the key name, as the structure is user defined
- ':key' => { name => \&word },
+ ':key' => { name => \&keyword },
},
'1.3' => {
@@ -153,7 +153,7 @@
'optional_features' => {
'map' => {
- ':key' => { name => \&word,
+ ':key' => { name => \&identifier,
'map' => { description => { value => \&string },
requires_packages => { value => \&string },
requires_os => { value => \&string },
@@ -189,7 +189,7 @@
# additional user defined key/value pairs
# note we can only validate the key name, as the structure is user defined
- ':key' => { name => \&word },
+ ':key' => { name => \&keyword },
},
# v1.2 is misleading, it seems to assume that a number of fields where created
@@ -223,7 +223,7 @@
'optional_features' => {
'map' => {
- ':key' => { name => \&word,
+ ':key' => { name => \&identifier,
'map' => { description => { value => \&string },
requires_packages => { value => \&string },
requires_os => { value => \&string },
@@ -254,7 +254,7 @@
# additional user defined key/value pairs
# note we can only validate the key name, as the structure is user defined
- ':key' => { name => \&word },
+ ':key' => { name => \&keyword },
},
# note that the 1.1 spec doesn't specify optional or mandatory fields, what
@@ -279,7 +279,7 @@
# additional user defined key/value pairs
# note we can only validate the key name, as the structure is user defined
- ':key' => { name => \&word },
+ ':key' => { name => \&keyword },
},
# note that the 1.0 spec doesn't specify optional or mandatory fields, what
@@ -301,7 +301,7 @@
# additional user defined key/value pairs
# note we can only validate the key name, as the structure is user defined
- ':key' => { name => \&word },
+ ':key' => { name => \&keyword },
},
);
@@ -536,7 +536,7 @@
Validates that the given key is in CamelCase, to indicate a user defined
keyword.
-=item * word($self,$key,$value)
+=item * keyword($self,$key,$value)
Validates that key is in an acceptable format for the META.yml specification,
i.e. any in the character class [-_a-z].
@@ -545,6 +545,12 @@
(v1.0 - v1.4), the convention is to precede the key with a pattern matching
qr{\Ax_}i. Following this any character from the character class [-_a-zA-Z]
can be used. This clarification has been added to v2.0 of the specification.
+
+=item * identifier($self,$key,$value)
+
+Validates that key is in an acceptable format for the META.yml specification,
+for an identifier, i.e. any that matches the regular expression
+qr/[a-z][a-z_]/i.
=item * module($self,$key,$value)
@@ -712,7 +718,7 @@
return 0;
}
-sub word {
+sub keyword {
my ($self,$key) = @_;
if(defined $key) {
return 1 if($key && $key =~ /^([-_a-z]+)$/); # spec defined
@@ -724,6 +730,17 @@
return 0;
}
+sub identifier {
+ my ($self,$key) = @_;
+ if(defined $key) {
+ return 1 if($key && $key =~ /^([a-z][_a-z]+)$/i); # spec 2.0 defined
+ } else {
+ $key = '<undef>';
+ }
+ $self->_error( "Key '$key' is not a legal identifier." );
+ return 0;
+}
+
sub module {
my ($self,$key) = @_;
if(defined $key) {
Modified: trunk/libtest-cpan-meta-perl/t/03metaversion.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-cpan-meta-perl/t/03metaversion.t?rev=48969&op=diff
==============================================================================
--- trunk/libtest-cpan-meta-perl/t/03metaversion.t (original)
+++ trunk/libtest-cpan-meta-perl/t/03metaversion.t Sat Dec 19 00:15:23 2009
@@ -1,7 +1,7 @@
#!/usr/bin/perl -w
use strict;
-use Test::More tests => 92;
+use Test::More tests => 108;
use Test::CPAN::Meta::Version;
my $spec = Test::CPAN::Meta::Version->new(spec => '1.3');
@@ -83,12 +83,15 @@
is($spec->resource(''),0);
is($spec->resource(undef),0);
-is($spec->word('test'),1,'valid word');
-is($spec->word('test-test'),1);
-is($spec->word('test_test'),1);
-is($spec->word('test:'),0);
-is($spec->word(''),0);
-is($spec->word(undef),0);
+is($spec->keyword($_),1,"valid keyword $_") for(qw(test X_TEST x_test test-test test_test));
+is($spec->keyword($_),0,"invalid keyword $_") for(qw(X-TEST Test TEST test:));
+is($spec->keyword(''),0,'invalid keyword <empty string>');
+is($spec->keyword(undef),0,'invalid keyword <undef>');
+
+is($spec->identifier($_),1,"valid identifier $_") for(qw(test Test TEST X_TEST x_test test_test));
+is($spec->identifier($_),0,"invalid identifier $_") for(qw(X-TEST test-test test:));
+is($spec->identifier(''),0,'invalid identifier <empty string>');
+is($spec->identifier(undef),0,'invalid identifier <undef>');
is($spec->module('Test'),1,'valid module name');
is($spec->module('Test::CPAN::Meta'),1);
More information about the Pkg-perl-cvs-commits
mailing list