]> git.vpit.fr Git - perl/modules/rgit.git/blob - lib/App/Rgit.pm
Update VPIT::TestHelpers to 15e8aee3
[perl/modules/rgit.git] / lib / App / Rgit.pm
1 package App::Rgit;
2
3 use strict;
4 use warnings;
5
6 use App::Rgit::Command;
7 use App::Rgit::Config;
8
9 =head1 NAME
10
11 App::Rgit - Backend that supports the rgit utility.
12
13 =head1 VERSION
14
15 Version 0.08
16
17 =cut
18
19 our $VERSION = '0.08';
20
21 =head1 DESCRIPTION
22
23 Backend that supports the L<rgit> utility.
24
25 This is an internal class to L<rgit>.
26
27 =head1 METHODS
28
29 =head2 C<new>
30
31     my $ar = App::Rgit->new(
32      root => $root,
33      git  => $git,
34      cmd  => $cmd,
35      args => \@args,
36     );
37
38 Creates a new L<App::Rgit> object that's bound to execute the command C<$cmd> on all the C<git> repositories inside C<$root> with C<@args> as arguments and C<$git> as C<git> executable.
39
40 =cut
41
42 sub new {
43  my $class = shift;
44  $class = ref $class || $class;
45
46  my %args = @_;
47
48  my $config = App::Rgit::Config->new(
49   root  => $args{root},
50   git   => $args{git},
51   debug => $args{debug},
52  );
53  return unless defined $config;
54
55  my $command = App::Rgit::Command->new(
56   cmd    => $args{cmd},
57   args   => $args{args},
58   policy => $args{policy},
59  );
60  return unless defined $command;
61
62  bless {
63   config  => $config,
64   command => $command,
65  }, $class;
66 }
67
68 =head2 C<run>
69
70 Actually run the commands.
71
72 =cut
73
74 sub run {
75  my $self = shift;
76
77  $self->command->run($self->config);
78 }
79
80 =head2 C<config>
81
82 =head2 C<command>
83
84 Read-only accessors.
85
86 =cut
87
88 BEGIN {
89  eval "sub $_ { \$_[0]->{$_} }" for qw<config command>;
90 }
91
92 =head1 SEE ALSO
93
94 L<rgit>.
95
96 =head1 AUTHOR
97
98 Vincent Pit, C<< <perl at profvince.com> >>, L<http://profvince.com>.
99
100 You can contact me by mail or on C<irc.perl.org> (vincent).
101
102 =head1 BUGS
103
104 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>.
105 I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
106
107 =head1 SUPPORT
108
109 You can find documentation for this module with the perldoc command.
110
111     perldoc App::Rgit
112
113 =head1 COPYRIGHT & LICENSE
114
115 Copyright 2008,2009,2010 Vincent Pit, all rights reserved.
116
117 This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
118
119 =cut
120
121 1; # End of App::Rgit