Permalink
Browse files

- retrieves metadata from META.(yml|json) if available

- added a link to PrePAN if it's included in the metadata
  • Loading branch information...
kentaro committed Nov 9, 2011
1 parent 40cd553 commit 53baf723d59d59352e682d796948d4ec0ca4743b
Showing with 18 additions and 0 deletions.
  1. +17 −0 lib/MetaCPAN/Web/Controller/Release.pm
  2. +1 −0 root/inc/release-info.html
@@ -6,6 +6,9 @@ use namespace::autoclean;
BEGIN { extends 'MetaCPAN::Web::Controller' }
use List::Util ();
+use JSON::XS ();
+use YAML::Tiny ();
+
with qw(
MetaCPAN::Web::Role::ReleaseInfo
);
@@ -58,11 +61,25 @@ sub index : PathPart('release') : Chained('/') : Args {
}
}
+ my $meta = {};
+ if (my ($filename) = grep { /^META/io } @root_files) {
+ my $source = $c->model('API::Module')->source($author, $release, $filename)->recv;
+ my $raw = $source->{raw};
+
+ if ($filename =~ /\.ya?ml$/) {
+ $meta = YAML::Tiny::Load($raw);
+ }
+ elsif ($filename =~ /\.json$/) {
+ $meta = JSON::XS->new->utf8->decode($raw);
+ }
+ }
+
# TODO: make took more automatic (to include all)
$c->stash(
{ template => 'release.html',
release => $out,
changes => $changes,
+ meta => $meta,
total => $modules->{hits}->{total},
took => List::Util::max(
$modules->{took}, $root->{took}, $reqs->{versions}->{took}
@@ -21,6 +21,7 @@
<% IF release.tests.size %>(<span style="color: #090"><% release.tests.pass %></span> / <span style="color: #900"><% release.tests.fail %></span> / <% release.tests.na %>)<% END %>
<a href="http://matrix.cpantesters.org/?dist=<% release.name %>" title="Matrix"><img src="/static/icons/grid.png" width="16" height="16" style="vertical-align: bottom; padding: 1px"></a>
</li>
+ <% IF meta.prepan %><li><a href="<% meta.prepan %>">PrePAN</a></li><% END %>
<% IF release.license %><li>License: <% release.license.join(', ') %></li><% END %>
<% IF versions.size > 1 %>
<select name="release" onchange="document.location.href='/<% IF module.path; 'module'; ELSE; 'release'; END %>/' + this.value">

0 comments on commit 53baf72

Please sign in to comment.