Example #1
0
def version():
    click.echo("CumulusCI version: ", nl=False)
    click.echo(click.style(cumulusci.__version__, bold=True), nl=False)
    click.echo(" ({})".format(sys.argv[0]))
    click.echo("Python version: {}".format(sys.version.split()[0]), nl=False)
    click.echo(" ({})".format(sys.executable))

    click.echo()
    current_version = get_installed_version()
    latest_version = get_latest_final_version()
    if latest_version > current_version:
        click.echo(
            "There is a newer version of CumulusCI available ({}).".format(
                str(latest_version)))
        click.echo("To upgrade, run `{}`".format(get_cci_upgrade_command()))
        click.echo(
            "Release notes: https://github.com/SFDO-Tooling/CumulusCI/releases/tag/v{}"
            .format(str(latest_version)))
    else:
        click.echo("You have the latest version of CumulusCI.")

    if sys.version_info.major == 2:
        click.echo()
        click.echo("WARNING: You are running CumulusCI using Python 2.")
        click.echo("Soon CumulusCI will only support Python 3.")
        click.echo(
            "To reinstall CumulusCI on Python 3, follow these instructions:")
        click.echo("https://cumulusci.readthedocs.io/en/latest/install.html")

    click.echo()
Example #2
0
def check_latest_version():
    """ checks for the latest version of cumulusci from pypi, max once per hour """
    check = True

    with timestamp_file() as f:
        timestamp = float(f.read() or 0)
    delta = time.time() - timestamp
    check = delta > 3600

    if check:
        try:
            latest_version = get_latest_final_version()
        except requests.exceptions.RequestException as e:
            click.echo("Error checking cci version:")
            click.echo(str(e))
            return

        result = latest_version > get_installed_version()
        click.echo("Checking the version!")
        if result:
            click.echo(
                """An update to CumulusCI is available. Use {} to update.""".format(
                    get_cci_upgrade_command()
                )
            )
Example #3
0
 def check_cumulusci_version(self):
     if self.project_config:
         min_cci_version = self.project_config.minimum_cumulusci_version
         if min_cci_version:
             parsed_version = pkg_resources.parse_version(min_cci_version)
             if get_installed_version() < parsed_version:
                 raise click.UsageError(
                     "This project requires CumulusCI version {} or later. "
                     "Please upgrade using {}".format(
                         min_cci_version, get_cci_upgrade_command()))
Example #4
0
 def check_cumulusci_version(self):
     if self.project_config:
         min_cci_version = self.project_config.minimum_cumulusci_version
         if min_cci_version:
             parsed_version = pkg_resources.parse_version(min_cci_version)
             if get_installed_version() < parsed_version:
                 raise click.UsageError(
                     "This project requires CumulusCI version {} or later. "
                     "Please upgrade using {}".format(
                         min_cci_version, get_cci_upgrade_command()
                     )
                 )
 def test_util__sets_pipx_upgrade_cmd(self):
     utils.CUMULUSCI_PATH = (
         "/Users/Username/.local/pipx/venvs/cumulusci/Lib/site-packages/cumulusci"
     )
     upgrade_cmd = utils.get_cci_upgrade_command()
     self.assertEqual(utils.PIPX_UPDATE_CMD, upgrade_cmd)
 def test_util__sets_pip_upgrade_cmd(self):
     utils.CUMULUSCI_PATH = "/usr/local/pip-path/cumulusci/2.1.2"
     upgrade_cmd = utils.get_cci_upgrade_command()
     self.assertEqual(utils.PIP_UPDATE_CMD, upgrade_cmd)
 def test_util__sets_linuxbrew_upgrade_cmd(self):
     utils.CUMULUSCI_PATH = "/home/linuxbrew/.linuxbrew/cumulusci/2.1.2"
     upgrade_cmd = utils.get_cci_upgrade_command()
     self.assertEqual(utils.BREW_UPDATE_CMD, upgrade_cmd)
 def test_util__sets_homebrew_upgrade_cmd(self):
     utils.CUMULUSCI_PATH = "/usr/local/Cellar/cumulusci/2.1.2"
     upgrade_cmd = utils.get_cci_upgrade_command()
     self.assertEqual(utils.BREW_UPDATE_CMD, upgrade_cmd)
Example #9
0
 def test_util__sets_pipx_upgrade_cmd(self):
     utils.CUMULUSCI_PATH = (
         "/Users/Username/.local/pipx/venvs/cumulusci/Lib/site-packages/cumulusci"
     )
     upgrade_cmd = utils.get_cci_upgrade_command()
     assert utils.PIPX_UPDATE_CMD == upgrade_cmd
Example #10
0
 def test_util__sets_pip_upgrade_cmd(self):
     utils.CUMULUSCI_PATH = "/usr/local/pip-path/cumulusci/2.1.2"
     upgrade_cmd = utils.get_cci_upgrade_command()
     assert utils.PIP_UPDATE_CMD == upgrade_cmd
Example #11
0
 def test_util__sets_linuxbrew_upgrade_cmd(self):
     utils.CUMULUSCI_PATH = "/home/linuxbrew/.linuxbrew/cumulusci/2.1.2"
     upgrade_cmd = utils.get_cci_upgrade_command()
     assert utils.BREW_UPDATE_CMD == upgrade_cmd
Example #12
0
 def test_util__sets_homebrew_upgrade_cmd(self):
     utils.CUMULUSCI_PATH = "/usr/local/Cellar/cumulusci/2.1.2"
     upgrade_cmd = utils.get_cci_upgrade_command()
     assert utils.BREW_UPDATE_CMD == upgrade_cmd