use List::MoreUtils qw/any zip/;
use DateTime;
use Encode qw/decode/;
- use I18N::Langinfo qw/langinfo CODESET/;
+
+ use if $^O ne 'MSWin32', 'I18N::Langinfo', => qw/langinfo CODESET/;
+ BEGIN {
+ no strict 'subs';
+ *__owner = defined &langinfo
+ ? sub { map { decode(langinfo(CODESET), $_) } (getpwuid $_[0]->path->stat->uid)[6,0] }
+ : sub { return qw/OwnEr GroUp/ }
+ ;
+ }
+
use Gitalist::Git::Object::Blob;
use Gitalist::Git::Object::Tree;
use Gitalist::Git::Object::Commit;
chomp($type);
my $class = 'Gitalist::Git::Object::' . ucfirst($type);
$class->new(
- project => $self,
+ repository => $self,
sha1 => $sha1,
type => $type,
);
## BUILDERS
method _build_util {
Gitalist::Git::Util->new(
- project => $self,
+ repository => $self,
);
}
}
method _build_owner {
- my ($gecos, $name) = map { decode(langinfo(CODESET), $_) } (getpwuid $self->path->stat->uid)[6,0];
+ my ($gecos, $name) = $self->__owner;
$gecos =~ s/,+$//;
return length($gecos) ? $gecos : $name;
}
=head1 SYNOPSIS
my $gitrepo = dir('/repo/base/Gitalist');
- my $project = Gitalist::Git::Repository->new($gitrepo);
- $project->name; # 'Gitalist'
- $project->path; # '/repo/base/Gitalist/.git'
- $project->description; # 'Unnamed repository.'
+ my $repository = Gitalist::Git::Repository->new($gitrepo);
+ $repository->name; # 'Gitalist'
+ $repository->path; # '/repo/base/Gitalist/.git'
+ $repository->description; # 'Unnamed repository.'
=head1 DESCRIPTION
This class models a git repository, referred to in Gitalist
-as a "Project".
+as a "Repository".
=head1 ATTRIBUTES
=head2 name
-The name of the Project. If unspecified, this will be derived from the path to the git repository.
+The name of the Repository. If unspecified, this will be derived from the path to the git repository.
=head2 path