line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Module::Install::GithubMeta; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
24924
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
39
|
|
4
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
28
|
|
5
|
1
|
|
|
1
|
|
5
|
use Cwd; |
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
87
|
|
6
|
1
|
|
|
1
|
|
5
|
use base qw(Module::Install::Base); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
833
|
|
7
|
1
|
|
|
1
|
|
5
|
use vars qw($VERSION); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
493
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
$VERSION = '0.28'; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub githubmeta { |
12
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
13
|
0
|
0
|
|
|
|
|
return unless $Module::Install::AUTHOR; |
14
|
0
|
0
|
|
|
|
|
return unless _under_git(); |
15
|
0
|
0
|
|
|
|
|
return unless $self->can_run('git'); |
16
|
0
|
|
0
|
|
|
|
my $remote = shift || 'origin'; |
17
|
0
|
|
|
|
|
|
local $ENV{LC_ALL}='C'; |
18
|
0
|
|
|
|
|
|
local $ENV{LANG}='C'; |
19
|
0
|
0
|
|
|
|
|
return unless my ($git_url) = `git remote show -n $remote` =~ /URL: (.*)$/m; |
20
|
0
|
0
|
|
|
|
|
return unless $git_url =~ /github\.com/; # Not a Github repository |
21
|
0
|
|
|
|
|
|
my $http_url = $git_url; |
22
|
0
|
|
|
|
|
|
$git_url =~ s![\w\-]+\@([^:]+):!git://$1/!; |
23
|
0
|
|
|
|
|
|
$http_url =~ s![\w\-]+\@([^:]+):!https://$1/!; |
24
|
0
|
|
|
|
|
|
$http_url =~ s!\.git$!/tree!; |
25
|
0
|
|
|
|
|
|
$self->repository( $git_url ); |
26
|
0
|
0
|
|
|
|
|
$self->homepage( $http_url ) unless $self->homepage(); |
27
|
0
|
|
|
|
|
|
return 1; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub _under_git { |
31
|
0
|
0
|
|
0
|
|
|
return 1 if -e '.git'; |
32
|
0
|
|
|
|
|
|
my $cwd = getcwd; |
33
|
0
|
|
|
|
|
|
my $last = $cwd; |
34
|
0
|
|
|
|
|
|
my $found = 0; |
35
|
0
|
|
|
|
|
|
while (1) { |
36
|
0
|
0
|
|
|
|
|
chdir '..' or last; |
37
|
0
|
|
|
|
|
|
my $current = getcwd; |
38
|
0
|
0
|
|
|
|
|
last if $last eq $current; |
39
|
0
|
|
|
|
|
|
$last = $current; |
40
|
0
|
0
|
|
|
|
|
if ( -e '.git' ) { |
41
|
0
|
|
|
|
|
|
$found = 1; |
42
|
0
|
|
|
|
|
|
last; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
} |
45
|
0
|
|
|
|
|
|
chdir $cwd; |
46
|
0
|
|
|
|
|
|
return $found; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
'Github'; |
50
|
|
|
|
|
|
|
__END__ |