| 1 | package Shipwright::Source::SVK; | ||||||||||
| 2 | |||||||||||
| 3 | 2 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 2 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 2 | ▶ | use Shipwright::Util; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 2 | ▶ | use File::Spec::Functions qw/catdir/; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 2 | ▶ | use File::Path qw/remove_tree/; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | |||||||||||
| 9 | 2 | ▶ | use base qw/Shipwright::Source::Base/; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | |||||||||||
| 11 | =head2 new | ||||||||||
| 12 | |||||||||||
| 13 | =cut | ||||||||||
| 14 | |||||||||||
| 15 | 1 | ▶ | sub new { | ||||||||
|
Subroutine
new: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||
| 16 | 1 | my $class = shift; | |||||||||
| 17 | 1 | my $self = $class->SUPER::new(@_); | |||||||||
| 18 | |||||||||||
| 19 | 1 | ▶ | $self->name( $self->just_name( $self->source ) ) unless $self->name; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 20 | 1 | return $self; | |||||||||
| 21 | } | ||||||||||
| 22 | |||||||||||
| 23 | =head2 run | ||||||||||
| 24 | |||||||||||
| 25 | =cut | ||||||||||
| 26 | |||||||||||
| 27 | 0 | ▶ | sub run { | ||||||||
|
Subroutine
run: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||
| 28 | 0 | my $self = shift; | |||||||||
| 29 | 0 | $self->log->info( "preparing to run source: " . $self->source ); | |||||||||
| 30 | |||||||||||
| 31 | 0 | $self->_update_url( $self->name, 'svk:' . $self->source ); | |||||||||
| 32 | |||||||||||
| 33 | 0 | $self->_run; | |||||||||
| 34 | 0 | my $s; | |||||||||
| 35 | 0 | ▶ | if ( $self->is_compressed ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 36 | 0 | require Shipwright::Source::Compressed; | |||||||||
| 37 | 0 | $s = Shipwright::Source::Compressed->new( %$self, _no_update_url => 1 ); | |||||||||
| 38 | } | ||||||||||
| 39 | else { | ||||||||||
| 40 | 0 | require Shipwright::Source::Directory; | |||||||||
| 41 | 0 | $s = Shipwright::Source::Directory->new( %$self, _no_update_url => 1 ); | |||||||||
| 42 | } | ||||||||||
| 43 | 0 | $s->run(@_); | |||||||||
| 44 | } | ||||||||||
| 45 | |||||||||||
| 46 | =head2 _run | ||||||||||
| 47 | |||||||||||
| 48 | =cut | ||||||||||
| 49 | |||||||||||
| 50 | 0 | ▶ | sub _run { | ||||||||
|
Subroutine
_run: not called CC=6 SCAR=37.4
| |||||||||||
| 51 | 0 | my $self = shift; | |||||||||
| 52 | 0 | my $source = $self->source; | |||||||||
| 53 | |||||||||||
| 54 | 0 | my @cmds; | |||||||||
| 55 | 0 | my $path = catdir( $self->download_directory, $self->name ); | |||||||||
| 56 | push @cmds, | ||||||||||
| 57 | [ | ||||||||||
| 58 | 0 | ▶ | $ENV{'SHIPWRIGHT_SVK'}, 'co', | ||||||||
|
Branch: 1 branch
| |||||||||||
| 59 | $self->source, $path, | ||||||||||
| 60 | $self->version ? ( '-r', $self->version ) : () | ||||||||||
| 61 | ]; | ||||||||||
| 62 | 0 | push @cmds, [ $ENV{'SHIPWRIGHT_SVK'}, 'co', '-d', $path, ]; | |||||||||
| 63 | |||||||||||
| 64 | 0 | ▶ | unless ( $self->version ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 65 | my ($out) = run_cmd( | ||||||||||
| 66 | 0 | [ $ENV{'SHIPWRIGHT_SVK'}, 'info', $self->source, ] ); | |||||||||
| 67 | |||||||||||
| 68 | 0 | ▶ | if ( $out =~ /^Revision: (\d+)/m ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 69 | 0 | $self->version($1); | |||||||||
| 70 | } | ||||||||||
| 71 | } | ||||||||||
| 72 | |||||||||||
| 73 | 0 | ▶ | remove_tree($path) if -e $path; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 74 | |||||||||||
| 75 | 0 | $self->source( $path ); | |||||||||
| 76 | 0 | run_cmd($_) for @cmds; | |||||||||
| 77 | } | ||||||||||
| 78 | |||||||||||
| 79 | 2 | 1; | |||||||||
| 80 | |||||||||||
| 81 | __END__ | ||||||||||