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