class GHRH::Command::Auth
Public Instance Methods
execute()
click to toggle source
# File lib/ghrh/command/auth.rb, line 7 def execute user = GHRH::Config.get('github.user') if not user raise "No GitHub user given or set" if not user pass = ask("Enter password for user #{user} (never stored): ") do |q| q.echo = '' end token = GHRH::Auth.perform(user, pass) if token scope = local? == true ? "local" : "global" GHRH::Config.set("ghrh.token", token, scope) puts "ghrh.token set to #{token} in #{scope} git config" else puts "Authentication failed, invalid user or password" end end