r36262 - in /branches/upstream/libsoftware-license-perl/current: Changes META.yml lib/Software/License.pm lib/Software/LicenseUtils.pm t/utils.t xt/release/pod-coverage.t
ryan52-guest at users.alioth.debian.org
ryan52-guest at users.alioth.debian.org
Sun May 24 04:53:54 UTC 2009
Author: ryan52-guest
Date: Sun May 24 04:53:49 2009
New Revision: 36262
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=36262
Log:
[svn-upgrade] Integrating new upstream version, libsoftware-license-perl (0.012)
Modified:
branches/upstream/libsoftware-license-perl/current/Changes
branches/upstream/libsoftware-license-perl/current/META.yml
branches/upstream/libsoftware-license-perl/current/lib/Software/License.pm
branches/upstream/libsoftware-license-perl/current/lib/Software/LicenseUtils.pm
branches/upstream/libsoftware-license-perl/current/t/utils.t
branches/upstream/libsoftware-license-perl/current/xt/release/pod-coverage.t
Modified: branches/upstream/libsoftware-license-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libsoftware-license-perl/current/Changes?rev=36262&op=diff
==============================================================================
--- branches/upstream/libsoftware-license-perl/current/Changes (original)
+++ branches/upstream/libsoftware-license-perl/current/Changes Sun May 24 04:53:49 2009
@@ -1,4 +1,8 @@
Revision history for Software-License
+
+0.012 2009-05-22
+ added guess_license_from_meta which is both JSON and YAML compatible
+ (BRICAS)
0.011 2009-05-19
clarify references to Perl in Perl_5 license
Modified: branches/upstream/libsoftware-license-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libsoftware-license-perl/current/META.yml?rev=36262&op=diff
==============================================================================
--- branches/upstream/libsoftware-license-perl/current/META.yml (original)
+++ branches/upstream/libsoftware-license-perl/current/META.yml Sun May 24 04:53:49 2009
@@ -26,4 +26,4 @@
resources:
license: http://dev.perl.org/licenses/
repository: http://github.com/rjbs/software-license
-version: 0.011
+version: 0.012
Modified: branches/upstream/libsoftware-license-perl/current/lib/Software/License.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libsoftware-license-perl/current/lib/Software/License.pm?rev=36262&op=diff
==============================================================================
--- branches/upstream/libsoftware-license-perl/current/lib/Software/License.pm (original)
+++ branches/upstream/libsoftware-license-perl/current/lib/Software/License.pm Sun May 24 04:53:49 2009
@@ -9,11 +9,11 @@
=head1 VERSION
-version 0.011
-
-=cut
-
-our $VERSION = '0.011';
+version 0.012
+
+=cut
+
+our $VERSION = '0.012';
use Data::Section -setup => { header_re => qr/\A__([^_]+)__\Z/ };
use Sub::Install ();
Modified: branches/upstream/libsoftware-license-perl/current/lib/Software/LicenseUtils.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libsoftware-license-perl/current/lib/Software/LicenseUtils.pm?rev=36262&op=diff
==============================================================================
--- branches/upstream/libsoftware-license-perl/current/lib/Software/LicenseUtils.pm (original)
+++ branches/upstream/libsoftware-license-perl/current/lib/Software/LicenseUtils.pm Sun May 24 04:53:49 2009
@@ -95,25 +95,27 @@
mozilla => [ map { "Mozilla_$_" } qw(1_0 1_1) ],
);
-=head2 guess_license_from_meta_yml
+=head2 guess_license_from_meta
- my @guesses = Software::LicenseUtils->guess_license_from_meta_yml($yaml_str);
+ my @guesses = Software::LicenseUtils->guess_license_from_meta($meta_str);
-Given the content of the META.yml file found in a CPAN distribution, this
+Given the content of the META.(yml|json) file found in a CPAN distribution, this
method makes a guess as to which licenses may apply to the distribution. It
will return a list of zero or more Software::License instances or classes.
=cut
-sub guess_license_from_meta_yml {
- my ($class, $yaml_text) = @_;
+sub guess_license_from_meta {
+ my ($class, $meta_text) = @_;
die "can't call guess_license_* in scalar context" unless wantarray;
- my ($license_text) = $yaml_text =~ m{^license: (.+)}gm;
+ my ($license_text) = $meta_text =~ m{\b["']?license["']?\s*:\s*["']?([a-z_]+)["']?}gm;
return unless $license_text and my $license = $meta_keys{ $license_text };
return map { "Software::License::$_" } ref $license ? @$license : $license;
}
+*guess_license_from_meta_yml = \&guess_license_from_meta;
+
1;
Modified: branches/upstream/libsoftware-license-perl/current/t/utils.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libsoftware-license-perl/current/t/utils.t?rev=36262&op=diff
==============================================================================
--- branches/upstream/libsoftware-license-perl/current/t/utils.t (original)
+++ branches/upstream/libsoftware-license-perl/current/t/utils.t Sun May 24 04:53:49 2009
@@ -1,6 +1,6 @@
use strict;
use warnings;
-use Test::More tests => 3;
+use Test::More tests => 4;
use Software::LicenseUtils;
{
@@ -89,7 +89,7 @@
version: 0.002
END_YAML
- my @guesses = Software::LicenseUtils->guess_license_from_meta_yml(
+ my @guesses = Software::LicenseUtils->guess_license_from_meta(
$fake_yaml
);
@@ -103,3 +103,64 @@
"guessed okay"
);
}
+
+{
+ my $fake_json = <<'END_JSON';
+{
+ "resources" : {
+ "repository" : "http://github.com/rjbs/dist-zilla"
+ },
+ "generated_by" : "Dist::Zilla::Plugin::MetaJSON version 1.091370",
+ "version" : "1.091370",
+ "name" : "Dist-Zilla",
+ "requires" : {
+ "DateTime" : "0.44",
+ "Config::INI::MVP::Reader" : "0.018",
+ "Pod::Eventual" : "0",
+ "App::Cmd" : "0.200",
+ "String::RewritePrefix" : "0.002",
+ "Data::Section" : "0.004",
+ "File::chdir" : "0",
+ "YAML::XS" : "0",
+ "String::Format" : "0",
+ "Perl::Version" : "0",
+ "autobox" : "2.53",
+ "Software::License" : "0",
+ "Archive::Tar" : "0",
+ "MooseX::ClassAttribute" : "0",
+ "List::MoreUtils" : "0",
+ "Moose" : "0.65",
+ "ExtUtils::Manifest" : "1.54",
+ "String::Flogger" : "1",
+ "File::Find::Rule" : "0",
+ "Mixin::ExtraFields::Param" : "0",
+ "File::HomeDir" : "0",
+ "ExtUtils::MakeMaker" : "0",
+ "CPAN::Uploader" : "0",
+ "Moose::Autobox" : "0.09",
+ "Test::More" : "0",
+ "MooseX::Types::Path::Class" : "0",
+ "Hash::Merge::Simple" : "0",
+ "File::Temp" : "0",
+ "Path::Class" : "0",
+ "Text::Template" : "0"
+ },
+ "abstract" : "distribution builder; installer not included!",
+ "author" : [
+ "Ricardo SIGNES <rjbs at cpan.org>"
+ ],
+ "license" : "perl"
+}
+END_JSON
+
+ my @guesses = Software::LicenseUtils->guess_license_from_meta(
+ $fake_json
+ );
+
+ is_deeply(
+ \@guesses,
+ [ 'Software::License::Perl_5' ],
+ "guessed okay"
+ );
+}
+
Modified: branches/upstream/libsoftware-license-perl/current/xt/release/pod-coverage.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libsoftware-license-perl/current/xt/release/pod-coverage.t?rev=36262&op=diff
==============================================================================
--- branches/upstream/libsoftware-license-perl/current/xt/release/pod-coverage.t (original)
+++ branches/upstream/libsoftware-license-perl/current/xt/release/pod-coverage.t Sun May 24 04:53:49 2009
@@ -5,5 +5,5 @@
plan skip_all => "Test::Pod::Coverage 1.04 required for testing POD coverage" if $@;
all_pod_coverage_ok({
coverage_class => 'Pod::Coverage::CountParents',
- trustme => [ qw(meta_yml_name) ],
+ trustme => [ qw(meta_yml_name guess_license_from_meta_yml) ],
});
More information about the Pkg-perl-cvs-commits
mailing list