| 1 | package Gruntmaster::App::Command::Rerun; |
| 2 | |
| 3 | use 5.014000; |
| 4 | use warnings; |
| 5 | |
| 6 | our $VERSION = '6000.001'; |
| 7 | |
| 8 | use Gruntmaster::App '-command'; |
| 9 | use Gruntmaster::Data; |
| 10 | use Scalar::Util qw/looks_like_number/; |
| 11 | |
| 12 | sub usage_desc { '%c rerun id...' } |
| 13 | |
| 14 | sub validate_args { |
| 15 | my ($self, $opt, $args) = @_; |
| 16 | my @args = @$args; |
| 17 | $self->usage_error('Not enough arguments') if @args < 1; |
| 18 | } |
| 19 | |
| 20 | sub execute { |
| 21 | my ($self, $opt, $args) = @_; |
| 22 | my @args = @$args; |
| 23 | |
| 24 | for my $obj (@args) { |
| 25 | if (looks_like_number $obj) { |
| 26 | rerun_job $obj; |
| 27 | } |
| 28 | else { |
| 29 | rerun_problem $obj; |
| 30 | } |
| 31 | } |
| 32 | } |
| 33 | |
| 34 | 1; |
| 35 | __END__ |
| 36 | |
| 37 | =encoding utf-8 |
| 38 | |
| 39 | =head1 NAME |
| 40 | |
| 41 | Gruntmaster::App::Command::Rerun - rerun some jobs and probles |
| 42 | |
| 43 | =head1 SYNOPSIS |
| 44 | |
| 45 | gm rerun 123 124 |
| 46 | |
| 47 | gm rerun aplusb aminusb |
| 48 | |
| 49 | gm rerun 12 aplusb |
| 50 | |
| 51 | =head1 DESCRIPTION |
| 52 | |
| 53 | The rerun command takes some IDs of jobs and problems and reruns them. |
| 54 | |
| 55 | =head1 SEE ALSO |
| 56 | |
| 57 | L<gm> |
| 58 | |
| 59 | =head1 AUTHOR |
| 60 | |
| 61 | Marius Gavrilescu, E<lt>marius@ieval.roE<gt> |
| 62 | |
| 63 | =head1 COPYRIGHT AND LICENSE |
| 64 | |
| 65 | Copyright (C) 2014-2016 by Marius Gavrilescu |
| 66 | |
| 67 | This library is free software; you can redistribute it and/or modify |
| 68 | it under the same terms as Perl itself, either Perl version 5.20.1 or, |
| 69 | at your option, any later version of Perl 5 you may have available. |
| 70 | |
| 71 | |
| 72 | =cut |