Class: AcquiaToolbelt::CLI::Auth

Inherits:
Thor
  • Object
show all
Defined in:
lib/acquia_toolbelt/cli/auth.rb

Constant Summary

Constants inherited from Thor

Thor::AmbiguousTaskError, Thor::DynamicTask, Thor::HELP_MAPPINGS, Thor::HiddenTask, Thor::THOR_RESERVED_WORDS, Thor::UndefinedTaskError, Thor::VERSION

Instance Attribute Summary

Attributes included from Thor::Base

#args, #options, #parent_options

Instance Method Summary collapse

Methods inherited from Thor

check_unknown_options!, check_unknown_options?, command_help, default_command, desc, #help, help, long_desc, map, method_option, method_options, package_name, printable_commands, register, stop_on_unknown_option!, stop_on_unknown_option?, subcommand, subcommands

Methods included from Thor::Base

included, #initialize, register_klass_file, shell, shell=, subclass_files, subclasses

Instance Method Details

#loginObject



15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/acquia_toolbelt/cli/auth.rb', line 15

def 
  cli = HighLine.new
  user = cli.ask('Enter your username: ')
  password = cli.ask('Enter your password: ') { |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