def version(**kwargs): """ Detects the new version according to git log and semver. Writes the new version number and commits it(unless the noop-option is True. """ click.echo('Creating new version..') current_version = get_current_version() click.echo('Current version: {0}'.format(current_version)) level_bump = evaluate_version_bump(current_version, kwargs['force_level']) new_version = get_new_version(current_version, level_bump) if new_version == current_version: click.echo(click.style('No release will be made.', fg='yellow')) return False if kwargs['noop'] is True: click.echo('{} Should have bumped from {} to {}.'.format( click.style('No operation mode.', fg='yellow'), current_version, new_version )) return False set_new_version(new_version) commit_new_version(new_version) tag_new_version(new_version) click.echo('Bumping with a {0} version to {1}.'.format(level_bump, new_version)) return True
def test_should_return_correct_version(self): self.assertEqual(get_current_version(), semantic_release.__version__)