Patch/Command/Clone.pm

filter: Statementstmt 78.3% 29 / 37 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 77.7% 7 / 9 Podpod n/a totaltotal 67.9% 36 / 53 CC 3 SCAR 14.1
CC
3
Cov
69%
__ANON__
12.0
__ANON__
2.0
BEGIN
1.0
CRAP 4.1
« Patch/Role/Patch.pm ↑ Summary Patch/Role/Git.pm »
1 package Git::CPAN::Patch::Command::Clone;
2 2 our $AUTHORITY = 'cpan:YANICK';
3 #ABSTRACT: Clone a CPAN module's history into a new git repository
4 2 $Git::CPAN::Patch::Command::Clone::VERSION = '2.3.4';
5 2 ▶use 5.20.0;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 2 ▶use autodie;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 2 ▶use Path::Class;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 2 ▶use MooseX::App::Command;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 2 extends 'Git::CPAN::Patch::Command::Import';
15  
16 2 ▶use experimental 'signatures';
Subroutine BEGIN: called CC=1 SCAR=0.0
17  
18 2 parameter target => (
19 is => 'rw',
20 isa => 'Str',
21 required => 0,
22 );
23  
24 2 has _seen_imports => (
25 is => 'rw',
26 isa => 'Bool',
27 default => 0,
28 );
29  
30  
31 ▶before [ qw/import_release clone_git_repo /] => sub($self,$release,@) {
Subroutine __ANON__: not called CC=3 SCAR=24.8
32 0 ▶ return if $self->_seen_imports;
Branch: 1 branch
BranchTrueFalseTotal
if $self->_seen_imports 0 0 0
33 0 $self->_set_seen_imports(1);
34  
35 0 ▶ my $target = $self->target || $release->dist_name;
Condition0%0/3
$self->target || $release->dist_name
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->target || $release->dist_name
$self->target $release->dist_name
Truth table0%0/3
A || B
A= $self->targetB= $release->dist_name
ABresult
1X1
011
000
36  
37 0 say "creating $target";
38  
39 0 dir($target)->mkpath;
40 0 Git::Repository->run( init => $target );
41 0 $self->set_root($target);
42 2 };
43  
44 ▶after [ qw/ clone_git_repo import_release /] => sub($self,@) {
Subroutine __ANON__: not called CC=1 SCAR=6.9
45 0 $self->git_run( 'reset', '--hard', $self->last_commit );
46 2 };
47  
48 2 __PACKAGE__->meta->make_immutable;
49  
50 2 1;
51  
52 __END__
53  
54 =pod
55  
56 =encoding UTF-8
57  
58 =head1 NAME
59  
60 Git::CPAN::Patch::Command::Clone - Clone a CPAN module's history into a new git repository
61  
62 =head1 VERSION
63  
64 version 2.3.4
65  
66 =head1 SYNOPSIS
67  
68 # from a specific tarball
69 $ git-cpan clone http://...
70 $ git-cpan clone /path/to/Foo-Bar-0.03.tar.gz
71  
72 # from CPAN, module and dist names are okay
73 $ git-cpan clone Foo::Bar
74 $ git-cpan clone Foo-Bar
75
76 # can also specify the directory to create
77 $ git-cpan clone Foo-Bar my_clone
78  
79 =head1 DESCRIPTION
80  
81 Clones a CPAN distribution. If a tarball is given, either locally or via an
82 url, it'll be used. If not, C<git-cpan> will try to find the distribution or
83 module. If it has an official git repository, it'll be cloned. If not, the
84 history will be created using the CPAN releases.
85  
86 If the target
87 directory is omitted, then the "humanish" part of the distribution is used.
88  
89 =head1 AUTHORS
90  
91 Mike Doherty C<< <doherty@cpan.org> >>
92  
93 Yanick Champoux C<< <yanick@cpan.org> >>
94  
95 =head1 SEE ALSO
96  
97 L<Git::CPAN::Patch>, L<git-cpan-init>, L<git-cpan-import>
98  
99 =head1 AUTHOR
100  
101 Yanick Champoux <yanick@cpan.org>
102  
103 =head1 COPYRIGHT AND LICENSE
104  
105 This software is copyright (c) 2018, 2017, 2016, 2015, 2014, 2013, 2012, 2011, 2010, 2009 by Yanick Champoux.
106  
107 This is free software; you can redistribute it and/or modify it under
108 the same terms as the Perl 5 programming language system itself.
109  
110 =cut
« Patch/Role/Patch.pm ↑ Summary Patch/Role/Git.pm »