File Coverage

blib/lib/Module/Setup/Plugin/VC/SVK.pm
Criterion Covered Total %
statement 23 23 100.0
branch 8 8 100.0
condition 2 2 100.0
subroutine 7 7 100.0
pod 2 3 66.6
total 42 43 97.6


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