class Gf::NetrcFile

Public Instance Methods

validate!() click to toggle source
# File lib/gf.rb, line 18
def validate!
  raise_error_if_netrc_not_exist!
  raise_error_if_machine_not_found!
end

Private Instance Methods

netrc_path() click to toggle source
# File lib/gf.rb, line 25
def netrc_path
  @netrc_path ||= "#{ENV['HOME']}/.netrc"
end
raise_error_if_machine_not_found!() click to toggle source
# File lib/gf.rb, line 33
def raise_error_if_machine_not_found!
  n = Netrc.read(netrc_path)
  raise MachineNotFoundError unless n['api.github.com']
end
raise_error_if_netrc_not_exist!() click to toggle source
# File lib/gf.rb, line 29
def raise_error_if_netrc_not_exist!
  raise FileNotFoundError unless File.exist?(netrc_path)
end