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