File Coverage

blib/lib/Pinto/Action/Roots.pm
Criterion Covered Total %
statement 24 24 100.0
branch n/a
condition n/a
subroutine 7 7 100.0
pod 0 1 0.0
total 31 32 96.8


line stmt bran cond sub pod time code
1             # ABSTRACT: Show the roots of a stack
2              
3             package Pinto::Action::Roots;
4              
5 1     1   717 use Moose;
  1         887  
  1         19  
6 1     1   10826 use MooseX::StrictConstructor;
  1         4  
  1         18  
7 1     1   3979 use MooseX::Types::Moose qw(Str);
  1         6  
  1         26  
8 1     1   4944 use MooseX::MarkAsMethods ( autoclean => 1 );
  1         3  
  1         15  
9              
10 1     1   4497 use Pinto::Util qw(whine);
  1         3  
  1         90  
11 1     1   6 use Pinto::Types qw(StackName StackDefault StackObject);
  1         3  
  1         14  
12              
13             #------------------------------------------------------------------------------
14              
15             our $VERSION = '0.14'; # VERSION
16              
17             #------------------------------------------------------------------------------
18              
19             extends qw( Pinto::Action );
20              
21             #------------------------------------------------------------------------------
22              
23             has stack => (
24             is => 'ro',
25             isa => StackName | StackDefault | StackObject,
26             default => undef,
27             );
28              
29             has format => (
30             is => 'ro',
31             isa => Str,
32             default => '%a/%f',
33             lazy => 1,
34             );
35              
36             #------------------------------------------------------------------------------
37              
38             sub execute {
39 2     2 0 9 my ($self) = @_;
40              
41 2         56 my $stack = $self->repo->get_stack($self->stack);
42 2         16 my @roots = sort map { $_->to_string($self->format) } $stack->roots;
  2         1277  
43 2         995 $self->show($_) for @roots;
44              
45 2         58 return $self->result;
46             }
47              
48             #------------------------------------------------------------------------------
49              
50             __PACKAGE__->meta->make_immutable;
51              
52             #------------------------------------------------------------------------------
53              
54             1;
55              
56             __END__
57              
58             =pod
59              
60             =encoding UTF-8
61              
62             =for :stopwords Jeffrey Ryan Thalhammer
63              
64             =head1 NAME
65              
66             Pinto::Action::Roots - Show the roots of a stack
67              
68             =head1 VERSION
69              
70             version 0.14
71              
72             =head1 AUTHOR
73              
74             Jeffrey Ryan Thalhammer <jeff@stratopan.com>
75              
76             =head1 COPYRIGHT AND LICENSE
77              
78             This software is copyright (c) 2015 by Jeffrey Ryan Thalhammer.
79              
80             This is free software; you can redistribute it and/or modify it under
81             the same terms as the Perl 5 programming language system itself.
82              
83             =cut