From 2219dda78a844e09f12c539e34e43447fc1f9557 Mon Sep 17 00:00:00 2001 From: Yanick Champoux Date: Sun, 20 Jun 2010 00:12:38 +0800 Subject: [PATCH] add the possibility to custom the remote branch --- lib/Dist/Zilla/Plugin/GithubMeta.pm | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/lib/Dist/Zilla/Plugin/GithubMeta.pm b/lib/Dist/Zilla/Plugin/GithubMeta.pm index 435290a..a061a40 100644 --- a/lib/Dist/Zilla/Plugin/GithubMeta.pm +++ b/lib/Dist/Zilla/Plugin/GithubMeta.pm @@ -15,11 +15,17 @@ has 'homepage' => ( coerce => 1, ); +has remote => ( + is => 'ro', + default => 'origin', +); + sub metadata { my $self = shift; return unless _under_git(); return unless can_run('git'); - return unless my ($git_url) = `git remote show -n origin` =~ /URL: (.*)$/m; + 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/!; @@ -70,6 +76,10 @@ Dist::Zilla::Plugin::GithubMeta - Automatically include GitHub meta information [GithubMeta] homepage = http://some.sort.of.url/project/ + # to override the github remote repo (defaults to 'origin') + [GithubMeta] + remote=github + =head1 DESCRIPTION Dist::Zilla::Plugin::GithubMeta is a L plugin to include GitHub L meta @@ -77,12 +87,17 @@ information in C. It automatically detects if the distribution directory is under C version control and whether the C is a GitHub repository and will set the C and C meta in C to the -appropriate URLs for GitHub. +appropriate URLs for GitHub. =head2 ATTRIBUTES =over +=item C + +The GitHub remote repo can be overriden with this attribute. If not +provided, it defaults to C. + =item C You may override the C setting by specifying this attribute. This should be a valid URL as