inc/Module/Install/Repository.pm

filter: Statementstmt 26.3% 10 / 38 Branchbran 0.0% 0 / 34 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 60.0% 3 / 5 Podpod 0.0% 0 / 1 totaltotal 16.6% 13 / 78 CC 18 SCAR 53.0
CC
18
Cov
14%
_find_repo
272.0
auto_set_repository
12.0
BEGIN
1.0
CRAP 199.6
« inc/Module/Install/Fetch.pm ↑ Summary inc/Module/Install/Metadata.pm »
1 #line 1
2 package Module::Install::Repository;
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 5.008_001;
6 our $VERSION = '0.02';
7 1 ▶ 
Subroutine BEGIN: called CC=1 SCAR=0.0
8 use base qw(Module::Install::Base);
9 0 ▶ 
Subroutine auto_set_repository: not called CC=3 SCAR=24.8
Pod undocumented
10 0 sub auto_set_repository {
11 my $self = shift;
12 0 ▶ 
Branch: 1 branch
BranchTrueFalseTotal
unless $Module::Install::AUTHOR 0 0 0
13 return unless $Module::Install::AUTHOR;
14 0  
15 0 ▶ my $repo = _find_repo();
Branch: 1 branch
BranchTrueFalseTotal
if ($repo) { } 0 0 0
16 0 if ($repo) {
17 $self->repository($repo);
18 0 } else {
19 warn "Cannot determine repository URL\n";
20 }
21 }
22 0 ▶ 
Subroutine _find_repo: not called CC=16 SCAR=56.1
23 0 ▶sub _find_repo {
Branch: 4 branches
BranchTrueFalseTotal
if (-e '.git') { } 0 0 0
elsif (-e '.svn') { } 0 0 0
elsif (-e '_darcs') { } 0 0 0
elsif (-e "$ENV{'HOME'}/.svk") { } 0 0 0
24 if (-e ".git") {
25 0 ▶ # TODO support remote besides 'origin'?
Branch: 1 branch
BranchTrueFalseTotal
if (`git remote show origin` =~ /URL: (.*)$/m) 0 0 0
26 if (`git remote show origin` =~ /URL: (.*)$/m) {
27 0 # XXX Make it public clone URL, but this only works with github
28 0 my $git_url = $1;
29 0 $git_url =~ s![\w\-]+\@([^:]+):!git://$1/!;
30 return $git_url;
31 }
32 0 ▶ } elsif (-e ".svn") {
Branch: 1 branch
BranchTrueFalseTotal
if (`svn info` =~ /URL: (.*)$/m) 0 0 0
33 0 if (`svn info` =~ /URL: (.*)$/m) {
34 return $1;
35 }
36 } elsif (-e "_darcs") {
37 0 ▶ # defaultrepo is better, but that is more likely to be ssh, not http
Branch: 1 branch
BranchTrueFalseTotal
if (my $query_repo = `darcs query repo`) 0 0 0
38 0 ▶ if (my $query_repo = `darcs query repo`) {
Branch: 1 branch
BranchTrueFalseTotal
if ($query_repo =~ m[Default Remote: (http://.+)]) 0 0 0
39 0 if ($query_repo =~ m!Default Remote: (http://.+)!) {
40 return $1;
41 }
42 }
43 0 ▶ 
Branch: 1 branch
BranchTrueFalseTotal
open my $handle, "<", "_darcs/prefs/repos" or return 0 0 0
44 0 ▶ open my $handle, '<', '_darcs/prefs/repos' or return;
Branch: 1 branch
BranchTrueFalseTotal
if (defined($_ = readline $handle)) 0 0 0
45 0 while (<$handle>) {
46 0 ▶ chomp;
Branch: 1 branch
BranchTrueFalseTotal
if m[^http://] 0 0 0
47 return $_ if m!^http://!;
48 }
49 } elsif (-e "$ENV{HOME}/.svk") {
50 0 ▶ # Is there an explicit way to check if it's an svk checkout?
Branch: 1 branch
BranchTrueFalseTotal
my $svk_info = `svk info` or return 0 0 0
51 my $svk_info = `svk info` or return;
52 0 ▶ SVK_INFO: {
Branch: 1 branch
BranchTrueFalseTotal
if ($svk_info =~ /Mirrored From: (.*), Rev\./) 0 0 0
53 0 if ($svk_info =~ /Mirrored From: (.*), Rev\./) {
54 return $1;
55 }
56 0 ▶ 
Branch: 1 branch
BranchTrueFalseTotal
if ($svk_info =~ m[Merged From: (/mirror/.*), Rev\.]) 0 0 0
57 0 ▶ if ($svk_info =~ m!Merged From: (/mirror/.*), Rev\.!) {
Branch: 1 branch
BranchTrueFalseTotal
$svk_info = `svk info /$1` or return 0 0 0
58 0 $svk_info = `svk info /$1` or return;
59 redo SVK_INFO;
60 }
61 }
62 0  
63 return;
64 }
65 }
66 1  
67 1;
68 __END__
« inc/Module/Install/Fetch.pm ↑ Summary inc/Module/Install/Metadata.pm »