inc/Module/Install/GithubMeta.pm

filter: Statementstmt 38.6% 17 / 44 Branchbran 0.0% 0 / 20 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 71.4% 5 / 7 Podpod 0.0% 0 / 1 totaltotal 30.5% 22 / 72 CC 11 SCAR 34.7
CC
11
Cov
27%
githubmeta
56.0
_under_git
30.0
BEGIN
1.0
CRAP 32.2
« inc/Module/Install/Metadata.pm ↑ Summary inc/Module/Install/Makefile.pm »
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
BranchTrueFalseTotal
unless $Module::Install::AUTHOR 0 0 0
14 0 ▶ return unless $Module::Install::AUTHOR;
Branch: 1 branch
BranchTrueFalseTotal
unless _under_git() 0 0 0
15 0 ▶ return unless _under_git();
Branch: 1 branch
BranchTrueFalseTotal
unless $self->can_run("git") 0 0 0
16 0 ▶ return unless $self->can_run('git');
Branch: 1 branch
BranchTrueFalseTotal
unless my($git_url) = `git remote show -n origin` =~ /URL: (.*)$/m 0 0 0
17 0 ▶ return unless my ($git_url) = `git remote show -n origin` =~ /URL: (.*)$/m;
Branch: 1 branch
BranchTrueFalseTotal
unless $git_url =~ /github\.com/ 0 0 0
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
BranchTrueFalseTotal
unless $self->homepage 0 0 0
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
BranchTrueFalseTotal
if -e ".git" 0 0 0
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
BranchTrueFalseTotal
chdir ".." or last 0 0 0
34 0 chdir '..' or last;
35 0 ▶ my $current = getcwd;
Branch: 1 branch
BranchTrueFalseTotal
if $last eq $current 0 0 0
36 0 last if $last eq $current;
37 0 ▶ $last = $current;
Branch: 1 branch
BranchTrueFalseTotal
if (-e ".git") 0 0 0
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__
« inc/Module/Install/Metadata.pm ↑ Summary inc/Module/Install/Makefile.pm »