-
Notifications
You must be signed in to change notification settings - Fork 49
/
mirror.pm
59 lines (38 loc) · 1.56 KB
/
mirror.pm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
package App::Pinto::Admin::Command::mirror;
# ABSTRACT: get all the latest distributions from a remote repository
use strict;
use warnings;
#-----------------------------------------------------------------------------
use base 'App::Pinto::Admin::Command';
#------------------------------------------------------------------------------
# VERSION
#------------------------------------------------------------------------------
sub opt_spec {
my ($self, $app) = @_;
return ( $self->SUPER::opt_spec(),
[ 'force' => 'Force action, even if indexes appear unchanged' ],
[ 'message=s' => 'Prepend a message to the VCS log' ],
[ 'nocommit' => 'Do not commit changes to VCS' ],
[ 'noinit' => 'Do not pull/update from VCS' ],
# TODO [ 'notag' => 'Do not create any tag in VCS' ],
# TODO [ 'tag=s' => 'Specify an alternate tag name' ],
);
}
#------------------------------------------------------------------------------
sub validate_args {
my ($self, $opts, $args) = @_;
$self->SUPER::validate_args($opts, $args);
$self->usage_error('Arguments are not allowed') if @{ $args };
return 1;
}
#------------------------------------------------------------------------------
sub execute {
my ($self, $opts, $args) = @_;
$self->pinto->new_action_batch( %{$opts} );
$self->pinto->add_action('Mirror', %{$opts});
my $result = $self->pinto->run_actions();
return $result->is_success() ? 0 : 1;
}
#------------------------------------------------------------------------------
1;
__END__