Ejemplo n.º 1
0
def markdown(ctx):
    if os.name == 'nt':
        ctx.obj['location'] = rf"{ctx.obj['location']}"

    if "github" in get_repo_url_info(location=ctx.obj['location'],
                                     repo_url=ctx.obj['repo_url']).resource:
        print('GitHub detected. \n')

        github(force=True,
               token=ctx.obj['token'],
               location=ctx.obj['location'],
               repo_url=ctx.obj['repo_url'],
               file_type='markdown').write()

    elif "gitlab" in get_repo_url_info(location=ctx.obj['location'],
                                       repo_url=ctx.obj['repo_url']).resource:
        print('GitLab detected. \n')

        gitlab(force=True,
               token=ctx.obj['token'],
               location=ctx.obj['location'],
               repo_url=ctx.obj['repo_url'],
               file_type='markdown').write()

    else:
        raise UnknownRepo(
            "Sorry, couldn't find the repository. Trying giving the repository URL by adding --url flag."
        )
Ejemplo n.º 2
0
def json(ctx):
    if os.name == 'nt':
        ctx.obj['location'] = r'{}'.format(ctx.obj['location'])

    if "github" in get_repo_url_info(location=ctx.obj['location'],
                                     repo_url=ctx.obj['repo_url']).resource:
        click.echo('GitHub detected. \n')

        github(force=True,
               token=ctx.obj['token'],
               location=ctx.obj['location'],
               repo_url=ctx.obj['repo_url'],
               file_type='json').write_json()

    elif "gitlab" in get_repo_url_info(location=ctx.obj['location'],
                                       repo_url=ctx.obj['repo_url']).resource:
        click.echo('GitLab detected. \n')

        gitlab(force=True,
               token=ctx.obj['token'],
               location=ctx.obj['location'],
               repo_url=ctx.obj['repo_url'],
               file_type='json').write_json()

    else:
        raise UnknownRepo(
            "Sorry, couldn't find the repository. Trying giving the repository URL by adding --url flag."
        )
Ejemplo n.º 3
0
def all_format(ctx):
    if os.name == 'nt':
        ctx.obj['location'] = rf"{ctx.obj['location']}"

    if "github" in get_repo_url_info(location=ctx.obj['location'],
                                     repo_url=ctx.obj['repo_url']).resource:
        # Creates for GitHub
        print("Creating change logs for GitHub.")
        github(force=True,
               token=ctx.obj['token'],
               location=ctx.obj['location'],
               repo_url=ctx.obj['repo_url'],
               file_type='json').write()
        github(force=True,
               token=ctx.obj['token'],
               location=ctx.obj['location'],
               repo_url=ctx.obj['repo_url'],
               file_type='markdown').write()
        # github(force=True, token=ctx.obj['token'], location=ctx.obj['location'], repo_url=ctx.obj['repo_url'],
        #        file_type='rst').write()
    else:
        # Creates for GitLab
        print("Creating change logs for GitLab.")
        gitlab(force=True,
               token=ctx.obj['token'],
               location=ctx.obj['location'],
               repo_url=ctx.obj['repo_url'],
               file_type='json').write()
        gitlab(force=True,
               token=ctx.obj['token'],
               location=ctx.obj['location'],
               repo_url=ctx.obj['repo_url'],
               file_type='markdown').write()
Ejemplo n.º 4
0
 def setUp(self):
     self.github_format = github(
         force=True,
         token=os.environ['GITHUB_TOKEN'],
         repo_url='https://github.com/akshaybabloo/release-exporter',
         file_type='json')