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