| 1 | # ABSTRACT: Unpack and open a distribution with your shell | ||||||||||
| 2 | |||||||||||
| 3 | package Pinto::Action::Look; | ||||||||||
| 4 | |||||||||||
| 5 | 1 | ▶ | use Moose; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 1 | ▶ | use MooseX::StrictConstructor; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 1 | ▶ | use MooseX::MarkAsMethods ( autoclean => 1 ); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | |||||||||||
| 9 | 1 | ▶ | use Pinto::Shell; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | 1 | ▶ | use Pinto::Util qw(throw); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | 1 | ▶ | use Pinto::Types qw(StackName StackDefault TargetList); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 12 | |||||||||||
| 13 | 1 | ▶ | use Path::Class qw(file); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 14 | |||||||||||
| 15 | #------------------------------------------------------------------------------ | ||||||||||
| 16 | |||||||||||
| 17 | 1 | our $VERSION = '0.14'; # VERSION | |||||||||
| 18 | |||||||||||
| 19 | #------------------------------------------------------------------------------ | ||||||||||
| 20 | |||||||||||
| 21 | 1 | extends qw( Pinto::Action ); | |||||||||
| 22 | |||||||||||
| 23 | #------------------------------------------------------------------------------ | ||||||||||
| 24 | |||||||||||
| 25 | 1 | has stack => ( | |||||||||
| 26 | is => 'ro', | ||||||||||
| 27 | isa => StackName | StackDefault, | ||||||||||
| 28 | default => undef, | ||||||||||
| 29 | ); | ||||||||||
| 30 | |||||||||||
| 31 | 1 | has targets => ( | |||||||||
| 32 | isa => TargetList, | ||||||||||
| 33 | traits => [qw(Array)], | ||||||||||
| 34 | handles => { targets => 'elements' }, | ||||||||||
| 35 | required => 1, | ||||||||||
| 36 | coerce => 1, | ||||||||||
| 37 | ); | ||||||||||
| 38 | |||||||||||
| 39 | #------------------------------------------------------------------------------ | ||||||||||
| 40 | |||||||||||
| 41 | 0 | ▶ | sub execute { | ||||||||
|
Subroutine
execute: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||
| 42 | 0 | my ($self) = @_; | |||||||||
| 43 | |||||||||||
| 44 | 0 | my $stack = $self->repo->get_stack($self->stack); | |||||||||
| 45 | |||||||||||
| 46 | 0 | for my $target ( $self->targets ) { | |||||||||
| 47 | |||||||||||
| 48 | 0 | my $dist; | |||||||||
| 49 | 0 | ▶ | if ($target->isa('Pinto::Target::Package')) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 50 | 0 | ▶ | $dist = $stack->get_distribution( target => $target ) | ||||||||
|
Branch: 1 branch
| |||||||||||
| 51 | or throw "Target $target is not in stack $stack"; | ||||||||||
| 52 | } | ||||||||||
| 53 | else { | ||||||||||
| 54 | 0 | ▶ | $dist = $self->repo->get_distribution( target => $target ) | ||||||||
|
Branch: 1 branch
| |||||||||||
| 55 | or throw "Target $target is not in the repository"; | ||||||||||
| 56 | } | ||||||||||
| 57 | |||||||||||
| 58 | 0 | my $shell = Pinto::Shell->new( archive => $dist->native_path ); | |||||||||
| 59 | 0 | $self->diag("Entering $dist with $shell\n"); | |||||||||
| 60 | 0 | $shell->spawn; | |||||||||
| 61 | } | ||||||||||
| 62 | |||||||||||
| 63 | 0 | return $self->result; | |||||||||
| 64 | } | ||||||||||
| 65 | |||||||||||
| 66 | #------------------------------------------------------------------------------ | ||||||||||
| 67 | |||||||||||
| 68 | 1 | __PACKAGE__->meta->make_immutable; | |||||||||
| 69 | |||||||||||
| 70 | #------------------------------------------------------------------------------ | ||||||||||
| 71 | |||||||||||
| 72 | 1 | 1; | |||||||||
| 73 | |||||||||||
| 74 | __END__ | ||||||||||