class AcquiaToolbelt::CLI::Auth

Public Instance Methods

login() click to toggle source
# File lib/acquia_toolbelt/cli/auth.rb, line 15
def login
  cli = HighLine.new
  user = cli.ask('Enter your username: ')
  password = cli.ask('Enter your password (typing will be hidden): ') { |q| q.echo = false }

  # Update (or create if needed) the netrc file that will contain the user
  # authentication details.
  n = Netrc.read
  n.new_item_prefix = "# This entry was added for connecting to the Acquia Cloud API\n"
  n['cloudapi.acquia.com'] = user, password
  n.save

  ui.success 'Your user credentials have been successfully set.'
end