示例#1
0
def publish(context):
    """Publishes the project"""
    commit_version_change(context)

    if context.github:
        # github token
        project_settings = project_config(context.module_name)
        if not project_settings['gh_token']:
            click.echo('You need a GitHub token for changes to create a release.')
            click.pause('Press [enter] to launch the GitHub "New personal access '
                        'token" page, to create a token for changes.')
            click.launch('https://github.com/settings/tokens/new')
            project_settings['gh_token'] = click.prompt('Enter your changes token')

            store_settings(context.module_name, project_settings)
        description = click.prompt('Describe this release')

        upload_url = create_github_release(context, project_settings['gh_token'], description)

        upload_release_distributions(
            context,
            project_settings['gh_token'],
            build_distributions(context),
            upload_url,
        )

        click.pause('Press [enter] to review and update your new release')
        click.launch('{0}/releases/tag/{1}'.format(context.repo_url, context.new_version))
    else:
        tag_and_push(context)
示例#2
0
def test_no_config():
    assert not exists("test_app/.changes")
    assert config.project_config("test_app") == config.DEFAULTS
    assert exists("test_app/.changes")
示例#3
0
def test_store_settings():
    config.store_settings("test_app", dict(foo="bar"))
    assert exists("test_app/.changes")
    assert config.project_config("test_app") == dict(foo="bar")
示例#4
0
def test_malformed_config_returns_dict():
    with click.open_file("test_app/.changes", "w") as f:
        f.write("something\n\n-another thing\n")
        assert config.project_config("test_app") == {}
示例#5
0
def test_existing_config():
    existing_config = "foo: bar\nbaz: buzz\n"
    with click.open_file("test_app/.changes", "w") as f:
        f.write(existing_config)
    assert config.project_config("test_app") == {"foo": "bar", "baz": "buzz"}
示例#6
0
def test_no_config():
    assert not exists('test_app/.changes')
    assert config.project_config('test_app') == config.DEFAULTS
    assert exists('test_app/.changes')
示例#7
0
def test_store_settings():
    config.store_settings('test_app', dict(foo='bar'))
    assert exists('test_app/.changes')
    assert config.project_config('test_app') == dict(foo='bar')
示例#8
0
def test_malformed_config_returns_dict():
    with click.open_file('test_app/.changes', 'w') as f:
        f.write('something\n\n-another thing\n')
        assert config.project_config('test_app') == {}
示例#9
0
def test_existing_config():
    existing_config = 'foo: bar\nbaz: buzz\n'
    with click.open_file('test_app/.changes', 'w') as f:
        f.write(existing_config)
    assert config.project_config('test_app') == {'foo': 'bar', 'baz': 'buzz'}
示例#10
0
def test_no_config():
    assert not exists('test_app/.changes')
    assert config.project_config(context) == config.DEFAULTS
    assert exists('test_app/.changes')
示例#11
0
def test_malformed_config_returns_none():
    with click.open_file('test_app/.changes', 'w') as f:
        f.write('something\n\n-another thing\n')
        assert config.project_config(context) == {}
示例#12
0
def test_existing_config():
    existing_config = 'foo: bar\nbaz: buzz\n'
    with click.open_file('test_app/.changes', 'w') as f:
        f.write(existing_config)
    assert config.project_config(context) == {'foo': 'bar', 'baz': 'buzz'}