The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.
Changes 04
LICENSE 33
META.json 35
META.yml 33
Makefile.PL 11
README 22
dist.ini 11
lib/Dist/Zilla/Plugin/Repository.pm 39
t/10-repo.t 125
9 files changed (This is a version diff) 1753
@@ -1,5 +1,9 @@
 Revision history for Perl extension Dist-Zilla-Plugin-Repository
 
+0.17    2011.01.06
+        Guard against invalid github remote (dagolden)
+        Guard tests against a user's ~/.svk directory (dagolden)
+
 0.16    2010.11.11
         detect repository type even if unable to determine URL (cjm)
 
@@ -1,4 +1,4 @@
-This software is copyright (c) 2010 by Fayland Lam, Ricardo SIGNES, Moritz Onken, Christopher J. Madsen.
+This software is copyright (c) 2011 by Fayland Lam, Ricardo SIGNES, Moritz Onken, Christopher J. Madsen.
 
 This is free software; you can redistribute it and/or modify it under
 the same terms as the Perl 5 programming language system itself.
@@ -12,7 +12,7 @@ b) the "Artistic License"
 
 --- The GNU General Public License, Version 1, February 1989 ---
 
-This software is Copyright (c) 2010 by Fayland Lam, Ricardo SIGNES, Moritz Onken, Christopher J. Madsen.
+This software is Copyright (c) 2011 by Fayland Lam, Ricardo SIGNES, Moritz Onken, Christopher J. Madsen.
 
 This is free software, licensed under:
 
@@ -270,7 +270,7 @@ That's all there is to it!
 
 --- The Artistic License 1.0 ---
 
-This software is Copyright (c) 2010 by Fayland Lam, Ricardo SIGNES, Moritz Onken, Christopher J. Madsen.
+This software is Copyright (c) 2011 by Fayland Lam, Ricardo SIGNES, Moritz Onken, Christopher J. Madsen.
 
 This is free software, licensed under:
 
@@ -7,7 +7,7 @@
       "Christopher J. Madsen <perl@cjmweb.net>"
    ],
    "dynamic_config" : 0,
-   "generated_by" : "Dist::Zilla version 4.102342, CPAN::Meta::Converter version 2.102400",
+   "generated_by" : "Dist::Zilla version 4.200000, CPAN::Meta::Converter version 2.102400",
    "license" : [
       "perl_5"
    ],
@@ -42,9 +42,11 @@
    "release_status" : "stable",
    "resources" : {
       "repository" : {
-         "url" : "http://github.com/fayland/dist-zilla-plugin-repository"
+         "type" : "git",
+         "url" : "git://github.com/fayland/dist-zilla-plugin-repository.git",
+         "web" : "http://github.com/fayland/dist-zilla-plugin-repository"
       }
    },
-   "version" : "0.16"
+   "version" : "0.17"
 }
 
@@ -11,7 +11,7 @@ build_requires:
 configure_requires:
   ExtUtils::MakeMaker: 6.31
 dynamic_config: 0
-generated_by: 'Dist::Zilla version 4.102342, CPAN::Meta::Converter version 2.102400'
+generated_by: 'Dist::Zilla version 4.200000, CPAN::Meta::Converter version 2.102400'
 license: perl
 meta-spec:
   url: http://module-build.sourceforge.net/META-spec-v1.4.html
@@ -23,5 +23,5 @@ no_index:
 requires:
   Dist::Zilla: 4.102340
 resources:
-  repository: http://github.com/fayland/dist-zilla-plugin-repository
-version: 0.16
+  repository: git://github.com/fayland/dist-zilla-plugin-repository.git
+version: 0.17
@@ -25,7 +25,7 @@ my %WriteMakefileArgs = (
   'PREREQ_PM' => {
     'Dist::Zilla' => '4.102340'
   },
-  'VERSION' => '0.16',
+  'VERSION' => '0.17',
   'test' => {
     'TESTS' => 't/*.t'
   }
@@ -3,7 +3,7 @@ NAME
     svn/svk/Git checkout for Dist::Zilla
 
 VERSION
-    version 0.16
+    version 0.17
 
 SYNOPSIS
         # dist.ini
@@ -68,7 +68,7 @@ AUTHORS
     *   Christopher J. Madsen <perl@cjmweb.net>
 
 COPYRIGHT AND LICENSE
-    This software is copyright (c) 2010 by Fayland Lam, Ricardo SIGNES,
+    This software is copyright (c) 2011 by Fayland Lam, Ricardo SIGNES,
     Moritz Onken, Christopher J. Madsen.
 
     This is free software; you can redistribute it and/or modify it under
@@ -1,6 +1,6 @@
 ;				be kind to Emacs users -*-conf-windows-*-
 name    = Dist-Zilla-Plugin-Repository
-version = 0.16
+version = 0.17
 author = Fayland Lam <fayland@gmail.com>
 author = Ricardo SIGNES <rjbs@cpan.org>
 author = Moritz Onken <onken@netcubed.de>
@@ -1,7 +1,7 @@
 package Dist::Zilla::Plugin::Repository;
 
 BEGIN {
-    $Dist::Zilla::Plugin::Repository::VERSION = '0.16';
+    $Dist::Zilla::Plugin::Repository::VERSION = '0.17';
 }
 
 # ABSTRACT: Automatically sets repository URL from svn/svk/Git checkout for Dist::Zilla
@@ -119,6 +119,12 @@ sub _find_repo {
         elsif ( $execute->('git svn info') =~ /URL: (.*)$/m ) {
             %repo = ( qw(type svn  url), $1 );
         }
+
+        # invalid github remote might come back with just the remote name
+        if ( $repo{url} && $repo{url} =~ /\A\w+\z/ ) {
+            delete $repo{$_} for qw/url type web/;
+            $self->log( "Skipping invalid git remote " . $self->git_remote );
+        }
     }
     elsif ( -e ".svn" ) {
         $repo{type} = 'svn';
@@ -188,7 +194,7 @@ Dist::Zilla::Plugin::Repository - Automatically sets repository URL from svn/svk
 
 =head1 VERSION
 
-version 0.16
+version 0.17
 
 =head1 SYNOPSIS
 
@@ -273,7 +279,7 @@ Christopher J. Madsen <perl@cjmweb.net>
 
 =head1 COPYRIGHT AND LICENSE
 
-This software is copyright (c) 2010 by Fayland Lam, Ricardo SIGNES, Moritz Onken, Christopher J. Madsen.
+This software is copyright (c) 2011 by Fayland Lam, Ricardo SIGNES, Moritz Onken, Christopher J. Madsen.
 
 This is free software; you can redistribute it and/or modify it under
 the same terms as the Perl 5 programming language system itself.
@@ -3,7 +3,7 @@
 
 use strict;
 use warnings;
-use Test::More tests => 34;
+use Test::More;
 
 use Dist::Zilla::Tester;
 
@@ -11,6 +11,8 @@ use Dist::Zilla::Tester;
 # Fake execution of VCS commands:
 
 use Dist::Zilla::Plugin::Repository;    # make sure it's already loaded
+use File::Temp qw/tempdir/;
+local $ENV{HOME} = tempdir( CLEANUP => 1 );
 
 my %result;
 
@@ -126,6 +128,11 @@ sub github_deprecated {
     scalar grep { /github_http is deprecated/ } @{ shift->log_messages };
 }    # end github_deprecated
 
+#---------------------------------------------------------------------
+sub remote_not_found {
+    scalar grep { /Skipping invalid git remote/ } @{ shift->log_messages };
+}    # end remote_not_found
+
 #=====================================================================
 {
     my $tzil = build_tzil();
@@ -386,4 +393,21 @@ END GIT NOURL
 }
 
 #---------------------------------------------------------------------
+$result{'git remote show -n github'} = <<'END GITHUB REMOTE NOT FOUND';
+* remote github
+  Fetch URL: github
+  Push  URL: github
+  HEAD branch: (not queried)
+  Remote branches: (status not queried)
+END GITHUB REMOTE NOT FOUND
+
+{
+    my $tzil = build_tzil( ['git_remote = github'], '.git' );
+
+    is( $tzil->distmeta->{resources}{repository},
+        undef, "Auto git remote github not found" );
+    ok( remote_not_found($tzil), "Auto git remote github not found" );
+}
+
+#---------------------------------------------------------------------
 done_testing;