Beispiel #1
0
def get_email():
    email = read_user_email()
    if not email:
        response = "n"
    else:
        # TODO (plemons): Add color to this and the get_fullname() prompt
        print("The best I can make out, your email address is " + Fore.YELLOW +
              str(email) + Fore.RESET)
        response = user_input("Is that correct? [Y/n]")

    if response.lower().startswith("n"):
        email = user_input("What is your email? ")

    return email
Beispiel #2
0
def get_full_name():
    fullname = read_user_fullname()
    if not fullname:
        response = "n"
    else:
        print("I see your name is " + Fore.YELLOW + str(fullname) + Fore.RESET)
        response = user_input("Is that correct? [Y/n]")

    if response.lower().startswith("n"):
        first = user_input("What is your first name? ")
        last = user_input("What is your last name? ")
        fullname = first + " " + last

    return fullname
Beispiel #3
0
def get_email():
    email = read_user_email()
    if not email:
        response = "n"
    else:
        # TODO (plemons): Add color to this and the get_fullname() prompt
        print(
            "The best I can make out, your email address is " +
            Fore.YELLOW + str(email) + Fore.RESET
        )
        response = user_input("Is that correct? [Y/n]")

    if response.lower().startswith("n"):
        email = user_input("What is your email? ")

    return email
Beispiel #4
0
def get_full_name():
    fullname = read_user_fullname()
    if not fullname:
        response = "n"
    else:
        print(
            "I see your name is " +
            Fore.YELLOW + str(fullname) + Fore.RESET
        )
        response = user_input("Is that correct? [Y/n]")

    if response.lower().startswith("n"):
        first = user_input("What is your first name? ")
        last = user_input("What is your last name? ")
        fullname = first + " " + last

    return fullname
Beispiel #5
0
def install_homebrew():
    """ Installs or upgrades homebrew on mac.

    If homebrew is not installed, this command will install it, otherwise
    it will update homebrew to the latest version. Additionally, it will
    offer to upgrade all homebrew packages. Upgrading all packages can take
    a long time, so the user is given the choice to skip the upgrade.
    """
    print("Checking homebrew install")
    if sh.which("brew"):
        spinner = Halo(
            text="Updating homebrew", spinner="dots", placement="right"
        )
        spinner.start()
        sh.brew("update")
        spinner.succeed()
        print(
            "Before using homebrew to install packages, we can upgrade "
            "any outdated packages."
        )
        response = user_input("Run brew upgrade? [y|N] ")
        if response[0].lower() == "y":
            spinner = Halo(
                text="Upgrade brew packages", spinner="dots", placement="right"
            )
            spinner.start()
            sh.brew("upgrade")
            spinner.succeed()
        else:
            print("Skipped brew package upgrades")
    else:
        # TODO (phillip): Currently, this homebrew installation does not work on a fresh
        # computer. It works from the command line, but not when run from the script. I
        # need to figure out what is going on. It could be because user input is needed.
        spinner = Halo(
            text="Installing homebrew", spinner="dots", placement="right"
        )
        spinner.start()
        try:
            script = sh.curl("-fsSL", BREW_GITHUB).stdout
            sh.ruby("-e", script)
            spinner.succeed()
        except sh.ErrorReturnCode:
            logging.error("Unable to install homebrew. Aborting...")
            spinner.fail()
            exit(1)
Beispiel #6
0
def install_homebrew():
    """ Installs or upgrades homebrew on mac.

    If homebrew is not installed, this command will install it, otherwise
    it will update homebrew to the latest version. Additionally, it will
    offer to upgrade all homebrew packages. Upgrading all packages can take
    a long time, so the user is given the choice to skip the upgrade.
    """
    print("Checking homebrew install")
    if sh.which("brew"):
        spinner = Halo(text="Updating homebrew",
                       spinner="dots",
                       placement="right")
        spinner.start()
        sh.brew("update")
        spinner.succeed()
        print("Before using homebrew to install packages, we can upgrade "
              "any outdated packages.")
        response = user_input("Run brew upgrade? [y|N] ")
        if response[0].lower() == "y":
            spinner = Halo(text="Upgrade brew packages",
                           spinner="dots",
                           placement="right")
            spinner.start()
            sh.brew("upgrade")
            spinner.succeed()
        else:
            print("Skipped brew package upgrades")
    else:
        # TODO (phillip): Currently, this homebrew installation does not work on a fresh
        # computer. It works from the command line, but not when run from the script. I
        # need to figure out what is going on. It could be because user input is needed.
        spinner = Halo(text="Installing homebrew",
                       spinner="dots",
                       placement="right")
        spinner.start()
        try:
            script = sh.curl("-fsSL", BREW_GITHUB).stdout
            sh.ruby("-e", script)
            spinner.succeed()
        except sh.ErrorReturnCode:
            logging.error("Unable to install homebrew. Aborting...")
            spinner.fail()
            exit(1)