Sha256: c216bd8d7e8520d21133393dac3d84f09c1c0cac5e8c48a2ec61ef1ebdb20ba4
Contents?: true
Size: 632 Bytes
Versions: 53
Compression:
Stored size: 632 Bytes
Contents
require 'netrc' module Learn class NetrcInteractor attr_reader :login, :password, :netrc def initialize ensure_proper_permissions! end def read(machine: 'learn-config') @netrc = Netrc.read @login, @password = netrc[machine] end def write(machine: 'learn-config', new_login:, new_password:) netrc[machine] = new_login, new_password netrc.save end def delete!(machine:) @netrc = Netrc.read netrc.delete(machine) netrc.save end private def ensure_proper_permissions! system('chmod 0600 ~/.netrc &>/dev/null') end end end
Version data entries
53 entries across 53 versions & 2 rubygems