lib/origen/users/user.rb in origen-0.52.4 vs lib/origen/users/user.rb in origen-0.53.0

- old
+ new

@@ -1,10 +1,13 @@ module Origen module Users class User require 'openssl' require 'digest/sha1' + # Required for STDIN.noecho to work + # https://stackoverflow.com/questions/9324697/why-cannot-use-instance-method-noecho-of-class-io + require 'io/console' attr_reader :role attr_writer :name, :email def self.current_user_id @@ -43,11 +46,13 @@ options[:to] = self Origen.mailer.send_email(options) end def id(options = {}) - @id.to_s.downcase + # Way to force Origen to use the new user ID in case of WSL where the core ID might not match the WSL login name + # User needs to setup the environment variable in their .bashrc or .tcshrc file + ENV['ORIGEN_USER_ID'] || @id.to_s.downcase end alias_method :core_id, :id alias_method :username, :id # Returns true if the user is an admin for the current application @@ -65,19 +70,19 @@ initials = name.split(/\s+/).map { |n| n[0].chr }.join('') initials.downcase end def name - @name ||= ENV['ORIGEN_NAME'] || name_from_rc || @id + @name ||= ENV['ORIGEN_NAME'] || ENV['ORIGEN_USER_NAME'] || name_from_rc || @id end def name_from_rc RevisionControl::Git.user_name end def email(options = {}) if current? - @email ||= ENV['ORIGEN_EMAIL'] || email_from_rc || begin + @email ||= ENV['ORIGEN_EMAIL'] || ENV['ORIGEN_USER_EMAIL'] || email_from_rc || begin if Origen.site_config.email_domain "#{id}@#{Origen.site_config.email_domain}" end end else