getlogin returns nil when it's called from a non-login shell

which will cause an 

'/lib/ruby/gems/2.1.0/gems/librarian-0.1.2/lib/librarian/environment.rb:206:in `getpwnam': no implicit conversion of nil into String (TypeError)'

ruby-doc recommend using getpwuid in case of getlogin failure