[libdist-zilla-plugin-githubmeta-perl] 01/03: Add ".git" to repo URL

Axel Beckert abe at deuxchevaux.org
Sun Apr 26 22:25:43 UTC 2015


This is an automated email from the git hooks/post-receive script.

abe pushed a commit to annotated tag 0.18
in repository libdist-zilla-plugin-githubmeta-perl.

commit f5a1a81428622523623a0aaea782d1a44e468ef9
Author: Olivier Mengué <dolmen at cpan.org>
Date:   Sat Aug 13 03:11:46 2011 +0800

    Add ".git" to repo URL
---
 lib/Dist/Zilla/Plugin/GithubMeta.pm |  7 ++++---
 t/basic.t                           | 12 +++++++++++-
 2 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/lib/Dist/Zilla/Plugin/GithubMeta.pm b/lib/Dist/Zilla/Plugin/GithubMeta.pm
index d1f59d3..95864c2 100644
--- a/lib/Dist/Zilla/Plugin/GithubMeta.pm
+++ b/lib/Dist/Zilla/Plugin/GithubMeta.pm
@@ -56,7 +56,7 @@ sub _acquire_repo_info {
   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
+    last if $git_url =~ m!\bgithub\.com[:/]!; # Not a Github repository
     undef $git_url;
   }
 
@@ -84,6 +84,7 @@ sub metadata {
 
   my $gh_url  = sprintf 'https://github.com/%s/%s', $self->user, $self->repo;
   my $bug_url = "$gh_url/issues";
+  my $repo_url = "$gh_url.git";
 
   my $home_url = $self->homepage ? $self->homepage->as_string : $gh_url;
 
@@ -92,7 +93,7 @@ sub metadata {
       homepage   => $home_url,
       repository => {
         type => 'git',
-        url  => $gh_url,
+        url  => $repo_url,
         web  => $gh_url,
       },
       ($self->issues ? (bugtracker => { web => $bug_url }) : ()),
@@ -156,7 +157,7 @@ qq[1 is the loneliest number];
 
 =head1 DESCRIPTION
 
-Dist::Zilla::Plugin::GithubMeta is a L<Dist::Zilla> plugin to include GitHub L<http://github.com> meta
+Dist::Zilla::Plugin::GithubMeta is a L<Dist::Zilla> plugin to include GitHub L<https://github.com> meta
 information in C<META.yml>.
 
 It automatically detects if the distribution directory is under C<git> version control and whether the
diff --git a/t/basic.t b/t/basic.t
index e283e7e..be1a30e 100644
--- a/t/basic.t
+++ b/t/basic.t
@@ -19,6 +19,16 @@ test_plugin("simplest case, ssh url" => {
   git    => { origin => 'git at github.com:example/Example-Repo.git' },
 });
 
+test_plugin("https url" => {
+  plugin => { },
+  git    => { origin => 'https://github.com:example/Example-Repo.git' },
+});
+
+test_plugin("SSH url, from a github-keygen user" => {
+  plugin => { },
+  git    => { origin => 'example.github.com:example/Example-Repo.git' },
+});
+
 test_plugin("use a non-default remote" => {
   plugin => { remote => 'github' },
   git    => {
@@ -107,7 +117,7 @@ sub test_plugin {
           homepage   => 'https://github.com/example/Example-Repo',
           repository => {
             type => 'git',
-            url => 'https://github.com/example/Example-Repo',
+            url => 'https://github.com/example/Example-Repo.git',
             web => 'https://github.com/example/Example-Repo',
           },
           $test->{resources} ? %{ $test->{resources} } : (),

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libdist-zilla-plugin-githubmeta-perl.git



More information about the Pkg-perl-cvs-commits mailing list