File Coverage

blib/lib/App/Rgit/Command/Each.pm
Criterion Covered Total %
statement 35 35 100.0
branch 12 14 85.7
condition n/a
subroutine 7 7 100.0
pod 1 1 100.0
total 55 57 96.4


line stmt bran cond sub pod time code
1             package App::Rgit::Command::Each;
2              
3 2     2   4706 use strict;
  2         5  
  2         92  
4 2     2   10 use warnings;
  2         5  
  2         91  
5              
6 2     2   10 use base qw/App::Rgit::Command/;
  2         3  
  2         347  
7              
8 2     2   10094 use App::Rgit::Guard;
  2         7  
  2         85  
9 2     2   13 use App::Rgit::Utils qw/:codes/;
  2         3  
  2         981  
10              
11             =head1 NAME
12              
13             App::Rgit::Command::Each - Class for commands to execute for each repository.
14              
15             =head1 VERSION
16              
17             Version 0.08
18              
19             =cut
20              
21             our $VERSION = '0.08';
22              
23             =head1 DESCRIPTION
24              
25             Class for commands to execute for each repository.
26              
27             This is an internal class to L.
28              
29             =head1 METHODS
30              
31             This class inherits from L.
32              
33             It implements :
34              
35             =head2 C
36              
37             =cut
38              
39             sub run {
40 4     4 1 10 my $self = shift;
41 4         4 my $conf = shift;
42              
43 4         9 my $status = 0;
44 4         8 my $code;
45              
46 4         5 my $repos = 0;
47 4 50   4   52 my $guard = App::Rgit::Guard->new(sub { $conf->cwd_repo->chdir if $repos });
  4         452  
48              
49 4         7 for (@{$conf->repos}) {
  4         26  
50 13 50       168 $_->chdir or next;
51 13         32 ++$repos;
52              
53 13         33 ($status, my $signal) = $_->run($conf, @{$self->args});
  13         805  
54              
55 13 100       502 $code = $self->report($conf, $_, $status, $signal) unless defined $code;
56              
57 13 100       95 last if $code & LAST;
58 12 100       110 if ($code & REDO) {
59 3         21 undef $code; # Don't save it, that would be very dumb
60 3         11 redo;
61             }
62 9 100       64 undef $code unless $code & SAVE;
63             }
64              
65 4 100       114 return wantarray ? ($status, $code) : $status;
66             }
67              
68             =head1 SEE ALSO
69              
70             L.
71              
72             L.
73              
74             =head1 AUTHOR
75              
76             Vincent Pit, C<< >>, L.
77              
78             You can contact me by mail or on C (vincent).
79              
80             =head1 BUGS
81              
82             Please report any bugs or feature requests to C, or through the web interface at L.
83             I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
84              
85             =head1 SUPPORT
86              
87             You can find documentation for this module with the perldoc command.
88              
89             perldoc App::Rgit::Command::Each
90              
91             =head1 COPYRIGHT & LICENSE
92              
93             Copyright 2008,2009,2010 Vincent Pit, all rights reserved.
94              
95             This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
96              
97             =cut
98              
99             1; # End of App::Rgit::Command::Each