diff options
author | Joe Rayhawk <jrayhawk@omgwallhack.org> | 2011-04-24 13:00:05 -0700 |
---|---|---|
committer | Joe Rayhawk <jrayhawk@omgwallhack.org> | 2011-04-24 13:00:05 -0700 |
commit | ffab3ec34b9fd949a9877d0a19182b58911424da (patch) | |
tree | 102fb78c332d7c43d5c3671e4de59bcba25134ca /libpiny/lib/Piny/User.pm | |
parent | 4ac0fd01b73a0b718db3a756866fee121a1615f1 (diff) | |
parent | 2a27be477f89b42abb23793c5118b40120b793aa (diff) | |
download | piny-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.pm | 33 |
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 { |