Sha256: 65d5178bc39b7dd953000850961ce30e340fd09bb7da0b57672272b2c2726a5d
Contents?: true
Size: 769 Bytes
Versions: 4
Compression:
Stored size: 769 Bytes
Contents
class Subiam::PasswordManager include Subiam::Logger::Helper def initialize(output, options = {}) @output = output @options = options end def identify(user, type) password = mkpasswd puts_password(user, type, password) password end def puts_password(user, type, password) log(:info, "User `#{user}` > `#{type}`: put password to `#{@output}`") open_output do |f| f.puts("#{user},#{type},#{password}") end end private def mkpasswd(len = 8) [*1..9, *'A'..'Z', *'a'..'z'].shuffle.slice(0, len).join end def open_output return if @options[:dry_run] if @output == '-' yield($stdout) $stdout.flush else open(@output, 'a') do |f| yield(f) end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
subiam-1.3.2 | lib/subiam/password_manager.rb |
subiam-1.3.1 | lib/subiam/password_manager.rb |
subiam-1.3.0 | lib/subiam/password_manager.rb |
subiam-1.2.1 | lib/subiam/password_manager.rb |