summaryrefslogtreecommitdiff
path: root/libpiny/lib/Piny/User.pm
diff options
context:
space:
mode:
authorJoe Rayhawk <jrayhawk@omgwallhack.org>2011-04-24 13:00:05 -0700
committerJoe Rayhawk <jrayhawk@omgwallhack.org>2011-04-24 13:00:05 -0700
commitffab3ec34b9fd949a9877d0a19182b58911424da (patch)
tree102fb78c332d7c43d5c3671e4de59bcba25134ca /libpiny/lib/Piny/User.pm
parent4ac0fd01b73a0b718db3a756866fee121a1615f1 (diff)
parent2a27be477f89b42abb23793c5118b40120b793aa (diff)
downloadpiny-code-ffab3ec34b9fd949a9877d0a19182b58911424da.tar.gz
piny-code-ffab3ec34b9fd949a9877d0a19182b58911424da.zip
Merge branch 'master' of piny.be:/srv/git/piny-code
Conflicts: libpiny/lib/Piny/Repo.pm
Diffstat (limited to 'libpiny/lib/Piny/User.pm')
-rw-r--r--libpiny/lib/Piny/User.pm33
1 files changed, 32 insertions, 1 deletions
diff --git a/libpiny/lib/Piny/User.pm b/libpiny/lib/Piny/User.pm
index baae258..f742f87 100644
--- a/libpiny/lib/Piny/User.pm
+++ b/libpiny/lib/Piny/User.pm
@@ -10,6 +10,7 @@ use Moose;
use Moose::Util::TypeConstraints;
use MooseX::StrictConstructor;
+use Piny::Config;
use Piny::Email;
use Piny::Group;
@@ -49,6 +50,20 @@ has 'password_hash' =>
, init_arg => undef
);
+has 'home' =>
+ ( is => 'ro'
+ , isa => 'Path'
+ , lazy_build => 1
+ , init_arg => undef
+ );
+
+has 'config' =>
+ ( is => 'ro'
+ , isa => 'Piny::Config'
+ , lazy_build => 1
+ , init_arg => undef
+ );
+
has 'email' =>
( is => 'ro'
, isa => 'Piny::Email'
@@ -180,10 +195,26 @@ sub _build_password_hash {
return $s->pwent( )->[1];
};
+sub _build_home {
+ my ( $s ) = @_;
+
+ return $s->pwent( )->[7];
+};
+
+sub _build_config {
+ my ( $s ) = @_;
+
+ return Piny::Config->new( confpath => $s->home . "/.gitconfig" );
+};
+
sub _build_email {
my ( $s ) = @_;
- return Piny::Email->new( address => $s->pwent( )->[6] );
+ if ( not defined $s->config->user_email ) {
+ die "You must provide a user.email attribute in your .gitconfig!\nPlease run pinyconfig --user user.email your\@email.com";
+ };
+
+ return Piny::Email->new( address => $s->config->user_email );
};
sub _build_groups {