X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=lib%2FApp%2FRgit.pm;h=865b6ea201f3a274722af5c38a20e71a8ac35d7e;hb=0f55b91d632134b6077941fa223cd94378151373;hp=12917269cc4f5b2b55c25ee8b52a0d634f0ff795;hpb=787cc59d827d22afa8a3100daa42e5b9df3fe50d;p=perl%2Fmodules%2Frgit.git diff --git a/lib/App/Rgit.pm b/lib/App/Rgit.pm index 1291726..865b6ea 100644 --- a/lib/App/Rgit.pm +++ b/lib/App/Rgit.pm @@ -3,11 +3,8 @@ package App::Rgit; use strict; use warnings; -use Object::Tiny qw/config command/; - use App::Rgit::Command; use App::Rgit::Config; -use App::Rgit::Utils qw/validate/; =head1 NAME @@ -36,23 +33,29 @@ Creates a new L object that's bound to execute the command C<$cmd> on =cut sub new { - my ($class, %args) = &validate; + my $class = shift; + $class = ref $class || $class; + + my %args = @_; + my $config = App::Rgit::Config->new( root => $args{root}, git => $args{git}, debug => $args{debug}, ); return unless defined $config; + my $command = App::Rgit::Command->new( cmd => $args{cmd}, args => $args{args}, policy => $args{policy}, ); return unless defined $command; - $class->SUPER::new( + + bless { config => $config, command => $command, - ); + }, $class; } =head2 C @@ -63,6 +66,7 @@ Actually run the commands. sub run { my $self = shift; + $self->command->run($self->config); } @@ -70,7 +74,13 @@ sub run { =head2 C -Accessors. +Read-only accessors. + +=cut + +BEGIN { + eval "sub $_ { \$_[0]->{$_} }" for qw/config command/; +} =head1 SEE ALSO @@ -79,7 +89,7 @@ L. =head1 AUTHOR Vincent Pit, C<< >>, L. - + You can contact me by mail or on C (vincent). =head1 BUGS @@ -94,7 +104,7 @@ You can find documentation for this module with the perldoc command. =head1 COPYRIGHT & LICENSE -Copyright 2008-2009 Vincent Pit, all rights reserved. +Copyright 2008,2009,2010 Vincent Pit, all rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.