module AdminModule::Command::ClientAccess

Private Instance Methods

client() click to toggle source
# File lib/admin_module/command/client_access.rb, line 25
def client
  return @client unless @client.nil?

  @client = AdminModule.client
  @client.env = options[:environment] unless options[:environment].nil?

  user, pass = credentials
  if user.empty? || pass.empty?
    say "aborting deploy", :red
    return
  end

  @client.user = user
  @client.password = pass
  @client
end
credentials() click to toggle source
# File lib/admin_module/command/client_access.rb, line 13
def credentials
  config = AdminModule.configuration
  user, pass = config.user_credentials
  if user.nil? || pass.nil?
    user = ask "username for #{config.current_env} environment:"
    pass = ask "password:", echo: false
    # Force a new line - hiding the echo on the password eats the new line.
    say "\n"
  end
  [user, pass]
end