| 1 | #line 1 | ||||||||||
| 2 | package Module::Install::GithubMeta; | ||||||||||
| 3 | 1 | ▶ | |||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 1 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 1 | ▶ | use Cwd; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 1 | ▶ | use base qw(Module::Install::Base); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | use vars qw($VERSION); | ||||||||||
| 9 | 1 | ||||||||||
| 10 | $VERSION = '0.10'; | ||||||||||
| 11 | 0 | ▶ | |||||||||
|
Subroutine
githubmeta: not called CC=7 SCAR=40.3
Pod
undocumented
| |||||||||||
| 12 | 0 | sub githubmeta { | |||||||||
| 13 | 0 | ▶ | my $self = shift; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 14 | 0 | ▶ | return unless $Module::Install::AUTHOR; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 15 | 0 | ▶ | return unless _under_git(); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 16 | 0 | ▶ | return unless $self->can_run('git'); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 17 | 0 | ▶ | return unless my ($git_url) = `git remote show -n origin` =~ /URL: (.*)$/m; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 18 | 0 | return unless $git_url =~ /github\.com/; # Not a Github repository | |||||||||
| 19 | 0 | my $http_url = $git_url; | |||||||||
| 20 | 0 | $git_url =~ s![\w\-]+\@([^:]+):!git://$1/!; | |||||||||
| 21 | 0 | $http_url =~ s![\w\-]+\@([^:]+):!http://$1/!; | |||||||||
| 22 | 0 | $http_url =~ s!\.git$!/tree!; | |||||||||
| 23 | 0 | ▶ | $self->repository( $git_url ); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 24 | 0 | $self->homepage( $http_url ) unless $self->homepage(); | |||||||||
| 25 | return 1; | ||||||||||
| 26 | } | ||||||||||
| 27 | 0 | ▶ | |||||||||
|
Subroutine
_under_git: not called CC=5 SCAR=34.0
| |||||||||||
| 28 | 0 | ▶ | sub _under_git { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 29 | 0 | return 1 if -e '.git'; | |||||||||
| 30 | 0 | my $cwd = getcwd; | |||||||||
| 31 | 0 | my $last = $cwd; | |||||||||
| 32 | 0 | my $found = 0; | |||||||||
| 33 | 0 | ▶ | while (1) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 34 | 0 | chdir '..' or last; | |||||||||
| 35 | 0 | ▶ | my $current = getcwd; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 36 | 0 | last if $last eq $current; | |||||||||
| 37 | 0 | ▶ | $last = $current; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 38 | 0 | if ( -e '.git' ) { | |||||||||
| 39 | 0 | $found = 1; | |||||||||
| 40 | last; | ||||||||||
| 41 | } | ||||||||||
| 42 | 0 | } | |||||||||
| 43 | 0 | chdir $cwd; | |||||||||
| 44 | return $found; | ||||||||||
| 45 | } | ||||||||||
| 46 | 1 | ||||||||||
| 47 | 'Github'; | ||||||||||
| 48 | __END__ | ||||||||||