| 1 | # | ||||||||||
| 2 | # This file is part of App-Magpie | ||||||||||
| 3 | # | ||||||||||
| 4 | # This software is copyright (c) 2011 by Jerome Quelin. | ||||||||||
| 5 | # | ||||||||||
| 6 | # This is free software; you can redistribute it and/or modify it under | ||||||||||
| 7 | # the same terms as the Perl 5 programming language system itself. | ||||||||||
| 8 | # | ||||||||||
| 9 | 1 | ▶ | use 5.012; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | 1 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 12 | |||||||||||
| 13 | package App::Magpie::App::Command::checkout; | ||||||||||
| 14 | # ABSTRACT: check-out or update a given package | ||||||||||
| 15 | 1 | $App::Magpie::App::Command::checkout::VERSION = '2.010'; | |||||||||
| 16 | 1 | ▶ | use App::Magpie::App -command; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 17 | |||||||||||
| 18 | |||||||||||
| 19 | # -- public methods | ||||||||||
| 20 | |||||||||||
| 21 | 0 | ▶ | sub command_names { qw{ checkout co }; } | ||||||||
|
Subroutine
command_names: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 22 | |||||||||||
| 23 | 0 | ▶ | sub description { | ||||||||
|
Subroutine
description: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 24 | 0 | "Check out a package from Mageia repository, or update the local | |||||||||
| 25 | check-out if it already exists." | ||||||||||
| 26 | } | ||||||||||
| 27 | |||||||||||
| 28 | 0 | ▶ | sub opt_spec { | ||||||||
|
Subroutine
opt_spec: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 29 | 0 | my $self = shift; | |||||||||
| 30 | return ( | ||||||||||
| 31 | 0 | [], | |||||||||
| 32 | [ 'directory|d=s' => "directory where to check out" ], | ||||||||||
| 33 | [ 'shell|s' => "display Bourne shell commands to execute to change directory" ], | ||||||||||
| 34 | [], | ||||||||||
| 35 | $self->verbose_options, | ||||||||||
| 36 | ); | ||||||||||
| 37 | } | ||||||||||
| 38 | |||||||||||
| 39 | 0 | ▶ | sub execute { | ||||||||
|
Subroutine
execute: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||
| 40 | 0 | my ($self, $opts, $args) = @_; | |||||||||
| 41 | |||||||||||
| 42 | # sanity check | ||||||||||
| 43 | 0 | my $pkg = shift @$args; | |||||||||
| 44 | 0 | ▶ | $self->usage_error( "A package should be specified." ) | ||||||||
|
Branch: 1 branch
| |||||||||||
| 45 | unless defined $pkg; | ||||||||||
| 46 | |||||||||||
| 47 | # do the checkout | ||||||||||
| 48 | 0 | $self->log_init($opts); | |||||||||
| 49 | 0 | require App::Magpie::Action::Checkout; | |||||||||
| 50 | 0 | my $pkgdir = App::Magpie::Action::Checkout->new->run($pkg, $opts->{directory}); | |||||||||
| 51 | |||||||||||
| 52 | # display command to execute if shell mode | ||||||||||
| 53 | 0 | ▶ | say "cd $pkgdir" if $opts->{shell}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 54 | } | ||||||||||
| 55 | |||||||||||
| 56 | 1 | 1; | |||||||||
| 57 | |||||||||||
| 58 | __END__ | ||||||||||