Skip to content
Browse files

Merge pull request #1 from dsteinbrunner/patch-1

Updated Module::Install::GithubMeta
  • Loading branch information...
2 parents 3fed881 + 40b8a3b commit ef5e501a34009496372c47a509408de36936070e @2shortplanks committed
Showing with 66 additions and 11 deletions.
  1. +66 −11 inc/Module/Install/GithubMeta.pm
View
77 inc/Module/Install/GithubMeta.pm
@@ -1,4 +1,3 @@
-#line 1
package Module::Install::GithubMeta;
use strict;
@@ -7,7 +6,7 @@ use Cwd;
use base qw(Module::Install::Base);
use vars qw($VERSION);
-$VERSION = '0.16';
+$VERSION = '0.24';
sub githubmeta {
my $self = shift;
@@ -15,19 +14,14 @@ sub githubmeta {
return unless _under_git();
return unless $self->can_run('git');
my $remote = shift || 'origin';
- return unless my ($git_url) = `git remote show -n $remote` =~ /URL: (.*)$/m;
+ return unless my ($git_url) = `git config --get remote.$remote.url`;
return unless $git_url =~ /github\.com/; # Not a Github repository
+ chomp $git_url;
my $http_url = $git_url;
$git_url =~ s![\w\-]+\@([^:]+):!git://$1/!;
$http_url =~ s![\w\-]+\@([^:]+):!https://$1/!;
$http_url =~ s!\.git$!/tree!;
- $self->repository(
- {
- type => 'git',
- url => $git_url,
- web => $http_url,
- },
- );
+ $self->repository( $git_url );
$self->homepage( $http_url ) unless $self->homepage();
return 1;
}
@@ -54,4 +48,65 @@ sub _under_git {
'Github';
__END__
-#line 117
+=head1 NAME
+
+Module::Install::GithubMeta - A Module::Install extension to include GitHub meta information in META.yml
+
+=head1 SYNOPSIS
+
+ # In Makefile.PL
+
+ use inc::Module::Install;
+ githubmeta;
+
+The C<repository> and C<homepage> meta in C<META.yml> will be set accordingly.
+
+=head1 DESCRIPTION
+
+Module::Install::GithubMeta is a L<Module::Install> extension to include GitHub L<http://github.com> meta
+information in C<META.yml>.
+
+It automatically detects if the distribution directory is under C<git> version control and whether the
+C<origin> is a GitHub repository and will set the C<repository> and C<homepage> meta in C<META.yml> to the
+appropriate URLs for GitHub.
+
+=head1 COMMANDS
+
+This plugin adds the following Module::Install command:
+
+=over
+
+=item C<githubmeta>
+
+Does nothing on the user-side. On the author-side it will auto-detect if the directory is under C<git> version control
+and whether the C<origin> is a GitHub repository. Will set C<repository> to the public clone URL and C<homepage> to the
+http GitHub link for the repository.
+
+You may optionally provide the remote to query, this defaults to C<origin> if not specified.
+
+You may override the C<homepage> setting by using the L<Module::Install> C<homepage> command prior to calling this
+command.
+
+ use inc::Module::Install;
+ homepage 'http://mymoduleshomepage.com/';
+ githubmeta;
+
+=back
+
+=head1 AUTHOR
+
+Chris C<BinGOs> Williams
+
+Based on code from L<Module::Install::Repository> by Tatsuhiko Miyagawa
+
+=head1 LICENSE
+
+Copyright E<copy> Chris Williams and Tatsuhiko Miyagawa
+
+This module may be used, modified, and distributed under the same terms as Perl itself. Please see the license that came with your Perl distribution for details.
+
+=head1 SEE ALSO
+
+L<Module::Install>
+
+=cut

0 comments on commit ef5e501

Please sign in to comment.
Something went wrong with that request. Please try again.