File Coverage

blib/lib/Module/Setup/Plugin/VC/SVK.pm
Criterion Covered Total %
statement 26 26 100.0
branch 8 8 100.0
condition 2 2 100.0
subroutine 8 8 100.0
pod 2 3 66.6
total 46 47 97.8


line stmt bran cond sub pod time code
1             package Module::Setup::Plugin::VC::SVK;
2 1     1   7 use strict;
  1         2  
  1         34  
3 1     1   5 use warnings;
  1         3  
  1         41  
4 1     1   6 use base 'Module::Setup::Plugin::VC::SVN';
  1         1  
  1         583  
5              
6 1     1   7 use Path::Class;
  1         3  
  1         456  
7              
8             sub register {
9 7     7 0 15 my($self, ) = @_;
10 7         29 $self->add_trigger( before_dump_config => \&before_dump_config );
11 7     5   191 $self->add_trigger( after_setup_module_attribute => sub { shift->SUPER::after_setup_module_attribute(@_) } );
  5         193  
12 7         147 $self->add_trigger( finish_of_run => \&finish_of_run );
13             }
14              
15             sub before_dump_config {
16 2     2 1 32 my($self, $config) = @_;
17              
18 2   100     13 $config->{plugin_vc_svk_scratch_repos} ||= '//scratch';
19             $config->{plugin_vc_svk_scratch_repos} =
20 2         6 $self->dialog("Your svk base scratch DEPOTPATH: ", $config->{plugin_vc_svk_scratch_repos});
21             }
22              
23             sub finish_of_run {
24 5     5 1 111 my $self = shift;
25 5 100       17 return unless $self->dialog("import to SVK scratch DEPOTPATH? [yN] ", 'n') =~ /[Yy]/;
26              
27             !$self->system(
28             'svk', 'import',
29             '-m', $self->distribute->dist_name . ' import',
30 4 100       39 $self->config->{plugin_vc_svk_scratch_repos} . '/' . $self->distribute->dist_name,
31             '--from-checkout', $self->distribute->base_path,
32             ) or die $?;
33              
34 3         30 $self->distribute->base_path->rmtree;
35              
36 3 100       4092 my $trunk_path = $self->plugins_stash->{'VC::SVN'}->{is_subversion_friendly} ? '/trunk' : '';
37             !$self->system(
38             'svk', 'co',
39 3 100       12 $self->config->{plugin_vc_svk_scratch_repos} . '/' . $self->distribute->dist_name . $trunk_path,
40             $self->distribute->dist_name,
41             ) or die $?;
42             }
43              
44             1;