Skip Menu |
 
rt.cpan.org will be shut down on March 1st, 2021.

This queue is for tickets about the Module-Install CPAN distribution.

Report information
The Basics
Id: 31902
Status: resolved
Priority: 0/
Queue: Module-Install

People
Owner: Nobody in particular
Requestors: SAMV [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.68
Fixed in: (no value)



Subject: [PATCH] Add support for 'resources'
Download (untitled) / with headers
text/plain 182b
Hi, I saw that search.cpan.org has support for some more metadata, http://perlbuzz.com/2007/12/updated-distribution-metainformation-available-at.html So I wrote the attached patch.
Subject: 0001-Add-support-for-the-resources-META.yml-key.patch
From e581c70c41fc9f6c93affbe94e7a22f16debcb8e Mon Sep 17 00:00:00 2001 From: Sam Vilain <sam@vilain.net> Date: Wed, 26 Dec 2007 23:24:34 +1300 Subject: [PATCH] Add support for the 'resources' META.yml key MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------1.5.3.7.2095.gb2448-dirty" This is a multi-part message in MIME format. --------------1.5.3.7.2095.gb2448-dirty Content-Type: text/plain; charset=UTF-8; format=fixed Content-Transfer-Encoding: 8bit The "resources" key was added in the META.yml specification at version 1.2 or earlier. Add support and documentation for this, including a section to the main manual page entry. --- lib/Module/Install.pod | 42 +++++++++++++++++++++++++++++++++- lib/Module/Install/Admin/Metadata.pm | 4 +++ lib/Module/Install/Metadata.pm | 16 +++++++++++++ 3 files changed, 61 insertions(+), 1 deletions(-) --------------1.5.3.7.2095.gb2448-dirty Content-Type: text/x-patch; name="e581c70c41fc9f6c93affbe94e7a22f16debcb8e.diff" Content-Transfer-Encoding: 8bit Content-Disposition: attachment; filename="e581c70c41fc9f6c93affbe94e7a22f16debcb8e.diff" diff --git a/lib/Module/Install.pod b/lib/Module/Install.pod index 3fdfc60..5b46307 100644 --- a/lib/Module/Install.pod +++ b/lib/Module/Install.pod @@ -20,7 +20,13 @@ In your F<Makefile.PL>: (Recommended Usage) requires 'File::Spec' => '0.80'; build_requires 'Test::More' => '0.42'; recommends 'Your::OtherModule' => '0.01'; - + resources + license => "http://dev.perl.org/licenses", + homepage => "http://yourproject.host.org", + bugtracker => "http://rt.cpan.org/NoAuth/Bugs.html?Dist=Foo-Bar", + repository => "http://yourhost.com/myscm", + MailingList => "http://yourhost.com/listinfo/foo-bar"; + no_index 'directory' => 'demos'; install_script 'bin/myscript'; @@ -383,6 +389,40 @@ you and do not require a command. To summarise, if you can see it on L<http://search.cpan.org/> and you shouldn't be able to, you need a C<no_index> entry. +=head2 resources + + resources + license => "http://dev.perl.org/licenses", + homepage => "http://yourproject.host.org", + bugtracker => "http://rt.cpan.org/NoAuth/Bugs.html?Dist=Foo-Bar", + repository => "http://yourhost.com/myscm", + MailingList => "http://yourhost.com/listinfo/foo-bar", + SVN => "http://svn.foo.com/repos/Foo-bar", + ViewVC => "http://foo-bar.svn.sourceforge.net/viewvc/foo-bar", + Git => "http://git.foo.com/Foo-bar.git", + GitWeb => "http://git.foo.com/gitweb.cgi?p=Foo-bar.git", + Mercurial => "http://hg.foo.com/repo/Foo-bar", + Bzr => "http://foo-bar.launchpad.net/~foobar/foo-bar/trunk", + Darcs => "http://darcs.foo.com/Foo-bar", + + LaunchPad => "https://code.launchpad.net/foobar"; + +The C<resources> section is for URLs that are related to the release +in some way. + +The specification for META.yml requires that all non-standard resource +definitions be spelt with some uppercase letters (LikeThis). This +module warns if any unknown, reserved resource names are given. In +lieu of further standards settling, this author recommends use of the +above keys, where they fit. + +Note the key C<repository> is shown in the example of version 1.3 of +the specification (see +L<http://module-build.sourceforge.net/META-spec-v1.3.html#resources>). +So, Module::Install permits it. A good idea to put in here is the URL +of the source repository that is used for active development of the +module. + =head2 WriteAll The C<WriteAll> command is generally the last command; it writes out diff --git a/lib/Module/Install/Admin/Metadata.pm b/lib/Module/Install/Admin/Metadata.pm index 5ca6e4c..cb864b1 100644 --- a/lib/Module/Install/Admin/Metadata.pm +++ b/lib/Module/Install/Admin/Metadata.pm @@ -109,6 +109,10 @@ sub dump_meta { $dump{no_index} = $no_index; $dump{generated_by} = "$package version $version"; + if ( $values{resources} ) { + $dump{resources} = $values{resources}; + } + # Add mention of the META spec $dump{"meta-spec"} = { version => 1.3, diff --git a/lib/Module/Install/Metadata.pm b/lib/Module/Install/Metadata.pm index 6dab4ce..35597cb 100644 --- a/lib/Module/Install/Metadata.pm +++ b/lib/Module/Install/Metadata.pm @@ -332,4 +332,20 @@ sub license_from { return 'unknown'; } +my $valid_resources = qr{^(homepage|license|bugtracker|repository)$}; + +sub resources { + my $self = shift; + my %args = (@_ == 1 ? %{$_[0]} : @_); + + $DB::single = 1; + my $resources = $self->Meta->{"values"}{resources} ||= {}; + while ( my ($arg, $val) = each %args ) { + if ( lc $arg eq $arg and $arg !~ m{$valid_resources} ) { + warn "resource type '$arg' is reserved by the META-spec\n"; + } + $resources->{$arg} = $val; + } +} + 1; --------------1.5.3.7.2095.gb2448-dirty--
Download (untitled) / with headers
text/plain 129b
On Wed Dec 26 05:30:22 2007, SAMV wrote: Show quoted text
> So I wrote the attached patch.
Sorry, here it is again, without the MIME wrapping.
From e581c70c41fc9f6c93affbe94e7a22f16debcb8e Mon Sep 17 00:00:00 2001 From: Sam Vilain <sam@vilain.net> Date: Wed, 26 Dec 2007 23:24:34 +1300 Subject: [PATCH] Add support for the 'resources' META.yml key The "resources" key was added in the META.yml specification at version 1.2 or earlier. Add support and documentation for this, including a section to the main manual page entry. --- lib/Module/Install.pod | 42 +++++++++++++++++++++++++++++++++- lib/Module/Install/Admin/Metadata.pm | 4 +++ lib/Module/Install/Metadata.pm | 16 +++++++++++++ 3 files changed, 61 insertions(+), 1 deletions(-) diff --git a/lib/Module/Install.pod b/lib/Module/Install.pod index 3fdfc60..5b46307 100644 --- a/lib/Module/Install.pod +++ b/lib/Module/Install.pod @@ -20,7 +20,13 @@ In your F<Makefile.PL>: (Recommended Usage) requires 'File::Spec' => '0.80'; build_requires 'Test::More' => '0.42'; recommends 'Your::OtherModule' => '0.01'; - + resources + license => "http://dev.perl.org/licenses", + homepage => "http://yourproject.host.org", + bugtracker => "http://rt.cpan.org/NoAuth/Bugs.html?Dist=Foo-Bar", + repository => "http://yourhost.com/myscm", + MailingList => "http://yourhost.com/listinfo/foo-bar"; + no_index 'directory' => 'demos'; install_script 'bin/myscript'; @@ -383,6 +389,40 @@ you and do not require a command. To summarise, if you can see it on L<http://search.cpan.org/> and you shouldn't be able to, you need a C<no_index> entry. +=head2 resources + + resources + license => "http://dev.perl.org/licenses", + homepage => "http://yourproject.host.org", + bugtracker => "http://rt.cpan.org/NoAuth/Bugs.html?Dist=Foo-Bar", + repository => "http://yourhost.com/myscm", + MailingList => "http://yourhost.com/listinfo/foo-bar", + SVN => "http://svn.foo.com/repos/Foo-bar", + ViewVC => "http://foo-bar.svn.sourceforge.net/viewvc/foo-bar", + Git => "http://git.foo.com/Foo-bar.git", + GitWeb => "http://git.foo.com/gitweb.cgi?p=Foo-bar.git", + Mercurial => "http://hg.foo.com/repo/Foo-bar", + Bzr => "http://foo-bar.launchpad.net/~foobar/foo-bar/trunk", + Darcs => "http://darcs.foo.com/Foo-bar", + + LaunchPad => "https://code.launchpad.net/foobar"; + +The C<resources> section is for URLs that are related to the release +in some way. + +The specification for META.yml requires that all non-standard resource +definitions be spelt with some uppercase letters (LikeThis). This +module warns if any unknown, reserved resource names are given. In +lieu of further standards settling, this author recommends use of the +above keys, where they fit. + +Note the key C<repository> is shown in the example of version 1.3 of +the specification (see +L<http://module-build.sourceforge.net/META-spec-v1.3.html#resources>). +So, Module::Install permits it. A good idea to put in here is the URL +of the source repository that is used for active development of the +module. + =head2 WriteAll The C<WriteAll> command is generally the last command; it writes out diff --git a/lib/Module/Install/Admin/Metadata.pm b/lib/Module/Install/Admin/Metadata.pm index 5ca6e4c..cb864b1 100644 --- a/lib/Module/Install/Admin/Metadata.pm +++ b/lib/Module/Install/Admin/Metadata.pm @@ -109,6 +109,10 @@ sub dump_meta { $dump{no_index} = $no_index; $dump{generated_by} = "$package version $version"; + if ( $values{resources} ) { + $dump{resources} = $values{resources}; + } + # Add mention of the META spec $dump{"meta-spec"} = { version => 1.3, diff --git a/lib/Module/Install/Metadata.pm b/lib/Module/Install/Metadata.pm index 6dab4ce..35597cb 100644 --- a/lib/Module/Install/Metadata.pm +++ b/lib/Module/Install/Metadata.pm @@ -332,4 +332,20 @@ sub license_from { return 'unknown'; } +my $valid_resources = qr{^(homepage|license|bugtracker|repository)$}; + +sub resources { + my $self = shift; + my %args = (@_ == 1 ? %{$_[0]} : @_); + + $DB::single = 1; + my $resources = $self->Meta->{"values"}{resources} ||= {}; + while ( my ($arg, $val) = each %args ) { + if ( lc $arg eq $arg and $arg !~ m{$valid_resources} ) { + warn "resource type '$arg' is reserved by the META-spec\n"; + } + $resources->{$arg} = $val; + } +} + 1; -- 1.5.3.7.2095.gb2448-dirty
Download (untitled) / with headers
text/plain 139b
Hi. 'resources' command itself has been there for a while, and a new API doc is out with Module::Install 0.96/0.97. Thanks for the report.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.