| 1 | package Shipwright::Source::SVN; | ||||||||||
| 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 | 0 | $self->_update_url( $self->name, 'svn:' . $self->source ); | |||||||||
| 31 | |||||||||||
| 32 | 0 | $self->_run; | |||||||||
| 33 | 0 | my $s; | |||||||||
| 34 | 0 | ▶ | if ( $self->is_compressed ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 35 | 0 | require Shipwright::Source::Compressed; | |||||||||
| 36 | 0 | $s = Shipwright::Source::Compressed->new( %$self, _no_update_url => 1 ); | |||||||||
| 37 | } | ||||||||||
| 38 | else { | ||||||||||
| 39 | 0 | require Shipwright::Source::Directory; | |||||||||
| 40 | 0 | $s = Shipwright::Source::Directory->new( %$self, _no_update_url => 1 ); | |||||||||
| 41 | } | ||||||||||
| 42 | 0 | $s->run(@_); | |||||||||
| 43 | } | ||||||||||
| 44 | |||||||||||
| 45 | =head2 _run | ||||||||||
| 46 | |||||||||||
| 47 | =cut | ||||||||||
| 48 | |||||||||||
| 49 | 0 | ▶ | sub _run { | ||||||||
|
Subroutine
_run: not called CC=5 SCAR=34.0
| |||||||||||
| 50 | 0 | my $self = shift; | |||||||||
| 51 | 0 | my $source = $self->source; | |||||||||
| 52 | |||||||||||
| 53 | 0 | my $path = catdir( $self->download_directory, $self->name ); | |||||||||
| 54 | my $cmd = [ | ||||||||||
| 55 | 0 | ▶ | $ENV{'SHIPWRIGHT_SVN'}, 'export', | ||||||||
|
Branch: 1 branch
| |||||||||||
| 56 | $self->source, $path, | ||||||||||
| 57 | $self->version ? ( '-r', $self->version ) : (), | ||||||||||
| 58 | ]; | ||||||||||
| 59 | |||||||||||
| 60 | 0 | ▶ | unless ( $self->version ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 61 | my ($out) = | ||||||||||
| 62 | 0 | run_cmd( [ $ENV{'SHIPWRIGHT_SVN'}, 'info', $source, ] ); | |||||||||
| 63 | |||||||||||
| 64 | 0 | ▶ | if ( $out =~ /^Revision: (\d+)/m ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 65 | 0 | $self->version($1); | |||||||||
| 66 | } | ||||||||||
| 67 | } | ||||||||||
| 68 | |||||||||||
| 69 | 0 | ▶ | remove_tree($path) if -e $path; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 70 | 0 | $self->source( $path ); | |||||||||
| 71 | 0 | run_cmd($cmd); | |||||||||
| 72 | } | ||||||||||
| 73 | |||||||||||
| 74 | 2 | 1; | |||||||||
| 75 | |||||||||||
| 76 | __END__ | ||||||||||