From be1e0792273b71a922fd5231d2f5097b79cc1411 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Wed, 16 Feb 2011 11:07:35 -0600 Subject: better Repository handling --- lib/Dist/Zilla/PluginBundle/DOY.pm | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'lib') diff --git a/lib/Dist/Zilla/PluginBundle/DOY.pm b/lib/Dist/Zilla/PluginBundle/DOY.pm index 5b78142..b3afd03 100644 --- a/lib/Dist/Zilla/PluginBundle/DOY.pm +++ b/lib/Dist/Zilla/PluginBundle/DOY.pm @@ -2,6 +2,8 @@ package Dist::Zilla::PluginBundle::DOY; use Moose; # ABSTRACT: Dist::Zilla plugins for me +use List::MoreUtils qw(any); + use Dist::Zilla; with 'Dist::Zilla::Role::PluginBundle::Easy'; @@ -74,15 +76,17 @@ has is_test_dist => ( default => sub { shift->dist =~ /^Foo-/ ? 1 : 0 }, ); -has github_url => ( +has git_remote => ( is => 'ro', isa => 'Str', lazy => 1, default => sub { my $self = shift; - my $dist = $self->dist; - $dist = lc($dist); - "git://github.com/doy/$dist.git"; + return '' unless -d '.git'; + my @remotes = `git remote`; + chomp @remotes; + return 'github' if any { $_ eq 'github' } @remotes; + return 'origin'; }, ); @@ -140,8 +144,7 @@ has plugin_options => ( my %opts = ( 'NextRelease' => { format => '%-5v %{yyyy-MM-dd}d' }, 'Repository' => { - git_remote => $self->github_url, - github_http => 0 + git_remote => $self->git_remote, }, 'Git::Check' => { allow_dirty => '' }, 'Git::Tag' => { tag_format => '%v', tag_message => '' }, -- cgit v1.2.3-54-g00ecf