blib/lib/Zed/Plugin/Host/Checkout.pm untested

filter: Statementstmt 0.0% 0 / 30 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 2 MC/DCmcdc n/a Subroutinesub 0.0% 0 / 5 Podpod n/a totaltotal 0.0% 0 / 41 CC 1 SCAR 6.9
CC
1
Cov
0%
BEGIN
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 package Zed::Plugin::Host::Checkout;
2  
3 use strict;
4 use Zed::Plugin;
5 use Zed::Output;
6 use Zed::Config::Env;
7 use Zed::Config::Space;
8  
9 =head1 SYNOPSIS
10  
11 Checkout execute result to separate space
12 ex:
13 checkout
14 checkout ex1
15  
16 =cut
17  
18 invoke "checkout" => sub {
19  
20 my ( $prefix, %result, %checkout ) = shift;
21 %result = %{ env('result') };
22 $prefix ||= 'default';
23 debug("result:", \%result);
24
25 my %checkout = map
26 {
27 my( $v, %hash ) = $result{$_};
28 ref $v eq "ARRAY" ? $hash{$_} = $v : ref $v eq "HASH" ? map{ $hash{$_} = $v->{$_} }keys %$v : ();
29 %hash;
30 } qw( suc fail group );
31  
32 while( my($key, $v) = each %checkout )
33 {
34 space("$prefix\.$key", $v);
35 info("add $prefix\.$key hosts[", scalar @$v, "] suc!");
36 }
37 };
38 1