Example #1
0
def main():
    arguments = initialise()

    version_arguments = ['--major', '--minor', '--patch']
    commands = ['release', 'changelog', 'run_tests', 'bump_version', 'tag',
                'upload', 'install', 'pypi']
    suppress_version_prompt_for = ['run_tests', 'upload']

    if arguments['--new-version']:
        arguments['new_version'] = arguments['--new-version']

    module_name = config.arguments['<module_name>']

    if not probe.probe_project(module_name):
        raise Exception('Project does not meet `changes` requirements')

    for command in commands:
        if arguments[command]:
            if command not in suppress_version_prompt_for:
                arguments['new_version'] = version.get_new_version(
                    module_name,
                    version.current_version(module_name),
                    arguments.get('--noinput', False),
                    **util.extract_arguments(arguments, version_arguments)
                )
            globals()[command]()
Example #2
0
def main(context, module_name, dry_run, debug, no_input, requirements, patch, minor, major, version_prefix):
    """Ch-ch-changes"""

    logging.basicConfig(level=logging.DEBUG if debug else logging.INFO)

    new_version = version.get_new_version(
        module_name,
        version.current_version(module_name),
        no_input, major, minor, patch,
    )

    current_version = version.current_version(module_name)
    repo_url = attributes.extract_attribute(module_name, '__url__')
    context.obj = config.Changes(module_name, dry_run, debug, no_input, requirements, new_version, current_version, repo_url, version_prefix)

    probe.probe_project(context.obj)
Example #3
0
def changelog():
    module_name, dry_run, new_version = config.common_arguments()

    changelog_content = [
        '\n## [%s](%s/compare/%s...%s)\n\n' % (
            new_version, attributes.extract_attribute(module_name, '__url__'),
            version.current_version(module_name), new_version,
        )
    ]

    git_log_content = None
    try:
        git_log_content = sh.git.log(
            '--oneline',
            '--no-merges',
            '%s..master' % version.current_version(module_name),
            _tty_out=False
        ).split('\n')
        log.debug('content: %s' % git_log_content)
    except:
        log.warn('Error diffing previous version, initial release')

        git_log_content = sh.git.log(
            '--oneline',
            '--no-merges',
            _tty_out=False
        ).split('\n')

    git_log_content = replace_sha_with_commit_link(git_log_content)

    log.debug('content: %s' % git_log_content)

    # makes change log entries into bullet points
    if git_log_content:
        [
            changelog_content.append('* %s\n' % line)
            if line else line
            for line in git_log_content[:-1]
        ]

    write_new_changelog(
        module_name,
        config.CHANGELOG,
        changelog_content,
        dry_run=dry_run
    )
    log.info('Added content to CHANGELOG.md')
Example #4
0
def changelog():
    module_name, dry_run, new_version = config.common_arguments()

    changelog_content = [
        '\n## [%s](%s/compare/%s...%s)\n\n' % (
            new_version,
            attributes.extract_attribute(module_name, '__url__'),
            version.current_version(module_name),
            new_version,
        )
    ]

    git_log_content = None
    try:
        git_log_content = sh.git.log('--oneline',
                                     '--no-merges',
                                     '%s..master' %
                                     version.current_version(module_name),
                                     _tty_out=False).split('\n')
        log.debug('content: %s' % git_log_content)
    except:
        log.warn('Error diffing previous version, initial release')

        git_log_content = sh.git.log('--oneline',
                                     '--no-merges',
                                     _tty_out=False).split('\n')

    git_log_content = replace_sha_with_commit_link(git_log_content)

    log.debug('content: %s' % git_log_content)

    # makes change log entries into bullet points
    if git_log_content:
        [
            changelog_content.append('* %s\n' % line) if line else line
            for line in git_log_content[:-1]
        ]

    write_new_changelog(module_name,
                        config.CHANGELOG,
                        changelog_content,
                        dry_run=dry_run)
    log.info('Added content to CHANGELOG.md')
Example #5
0
def main(context, module_name, dry_run, debug, no_input, requirements, patch,
         minor, major, version_prefix):
    """Ch-ch-changes"""

    logging.basicConfig(level=logging.DEBUG if debug else logging.INFO)

    new_version = version.get_new_version(
        module_name,
        version.current_version(module_name),
        no_input,
        major,
        minor,
        patch,
    )

    current_version = version.current_version(module_name)
    repo_url = attributes.extract_attribute(module_name, '__url__')
    context.obj = config.CLI(module_name, dry_run, debug, no_input,
                             requirements, new_version, current_version,
                             repo_url, version_prefix)

    probe.probe_project(context.obj)
Example #6
0
def test_current_version(python_module):
    assert '0.0.1' == version.current_version(PYTHON_MODULE)
Example #7
0
def test_current_version(python_module):
    assert '0.0.1' == version.current_version(PYTHON_MODULE)
Example #8
0
def test_current_version():
    assert '0.0.1' == version.current_version(module_name)
Example #9
0
 def test_current_version(self):
     self.assertEquals(
         '0.0.1',
         version.current_version(self.module_name)
     )
Example #10
0
def test_current_version():
    assert '0.0.1' == version.current_version(module_name)