This is an automated email from the git hooks/post-receive script. abe pushed a commit to annotated tag 0.12 in repository libdist-zilla-plugin-githubmeta-perl.
commit b66a1c9b8416815ccce7ea14b5cfdffac0b2f16c Author: Ricardo Signes <r...@cpan.org> Date: Mon May 2 17:46:58 2011 -0400 allow checking multiple remotes; use smart urls --- lib/Dist/Zilla/Plugin/GithubMeta.pm | 48 +++++++++++++++++++++++++++---------- 1 file changed, 36 insertions(+), 12 deletions(-) diff --git a/lib/Dist/Zilla/Plugin/GithubMeta.pm b/lib/Dist/Zilla/Plugin/GithubMeta.pm index 8b26b66..5e628ff 100644 --- a/lib/Dist/Zilla/Plugin/GithubMeta.pm +++ b/lib/Dist/Zilla/Plugin/GithubMeta.pm @@ -19,24 +19,48 @@ has 'homepage' => ( coerce => 1, ); -has remote => ( - is => 'ro', - default => 'origin', +has 'remote' => ( + is => 'ro', + isa => 'ArrayRef[Str]', + default => sub { [ 'origin' ] }, ); sub metadata { my $self = shift; return unless _under_git(); return unless can_run('git'); - my $origin = $self->remote; - return unless my ($git_url) = `git remote show -n $origin` =~ /URL: (.*)$/m; - return unless $git_url =~ /github\.com/; # Not a Github repository - my $web_url = $git_url; - $git_url =~ s![\w\-]+\@([^:]+):!git://$1/!; - $web_url =~ s![\w\-]+\@([^:]+):!http://$1/!; - $web_url =~ s!\.git$!/tree!; - my $home_url = $self->homepage ? $self->homepage->as_string : $web_url; - return { resources => { repository => { url => $git_url, type => 'git', web => $web_url }, homepage => $home_url } }; + + my $git_url; + for my $remote (@{ $self->remote }) { + next unless $git_url = $self->_url_for_remote($remote); + last if $git_url =~ /github\.com/; # Not a Github repository + undef $git_url; + } + + return unless $git_url; + + $git_url =~ s![\w\-]+\@([^:]+):!http://$1/!; + $git_url =~ s!\.git$!!; + + my $home_url = $self->homepage ? $self->homepage->as_string : $git_url; + + return { + resources => { + homepage => $home_url, + repository => { + type => 'git', + url => $git_url, + web => $git_url, + }, + } + }; +} + +sub _url_for_remote { + my ($self, $remote) = @_; + my ($url) = `git remote show -n $remote` =~ /URL: (.*)$/m; + + return $url; } sub _under_git { -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libdist-zilla-plugin-githubmeta-perl.git _______________________________________________ Pkg-perl-cvs-commits mailing list Pkg-perl-cvs-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits