1 package App::Rgit::Config;
8 use File::Spec::Functions qw/file_name_is_absolute/;
10 use App::Rgit::Repository;
11 use App::Rgit::Utils qw/:levels/;
13 use constant IS_WIN32 => $^O eq 'MSWin32';
17 App::Rgit::Config - Base class for App::Rgit configurations.
25 our $VERSION = '0.06';
29 Base class for L<App::Rgit> configurations.
31 This is an internal class to L<rgit>.
35 =head2 C<< new root => $root, git => $git >>
37 Creates a new configuration object based on the root directory C<$root> and using C<$git> as F<git> executable.
43 $class = ref $class || $class;
47 my $root = $args{root};
48 return unless defined $root and -d $root;
49 $root = abs_path $root unless file_name_is_absolute $root;
52 return unless defined $git;
56 return unless -x $git;
59 return unless -x $git;
62 my $conf = 'App::Rgit::Config::Default';
63 eval "require $conf; 1" or Carp::confess("Couldn't load $conf: $@");
65 my $r = App::Rgit::Repository->new(fake => 1);
66 return unless defined $r;
72 debug => defined $args{debug} ? int $args{debug} : WARN,
84 Notifies a message C<$msg> of the corresponding level.
91 if ($self->debug >= $level) {
98 sub info { shift->_notify(INFO, @_) }
100 sub warn { shift->_notify(WARN, @_) }
102 sub err { shift->_notify(ERR, @_) }
104 sub crit { shift->_notify(CRIT, @_) }
121 eval "sub $_ { \$_[0]->{$_} }" for qw/root git cwd_repo debug/;
130 Vincent Pit, C<< <perl at profvince.com> >>, L<http://profvince.com>.
132 You can contact me by mail or on C<irc.perl.org> (vincent).
136 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.
140 You can find documentation for this module with the perldoc command.
142 perldoc App::Rgit::Config
144 =head1 COPYRIGHT & LICENSE
146 Copyright 2008-2009 Vincent Pit, all rights reserved.
148 This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
152 1; # End of App::Rgit::Config