Skip to content
This repository has been archived by the owner on Jun 7, 2023. It is now read-only.

Commit

Permalink
Merge pull request #16 from lendingblock/master
Browse files Browse the repository at this point in the history
version option
  • Loading branch information
lsbardel authored Jun 20, 2018
2 parents 871d558 + a0056ea commit 09242c2
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 6 deletions.
2 changes: 1 addition & 1 deletion agiletoolkit/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""Agile toolkit for devops and repository management"""

__version__ = "0.1.5"
__version__ = "0.1.6"
12 changes: 11 additions & 1 deletion agiletoolkit/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import click

from . import __version__
from .github import git
from .kong import kong

Expand All @@ -20,13 +21,19 @@
default=False,
help='Run in debug mode'
)
@click.option(
'--version',
is_flag=True,
default=False,
help='Display version and exit'
)
@click.option(
'--config', default=AGILE_CONFIG,
type=click.Path(),
help=f'Agile configuration json file location ({AGILE_CONFIG})'
)
@click.pass_context
def start(ctx, debug, config):
def start(ctx, debug, version, config):
"""Commands for devops operations"""
ctx.obj = {}
ctx.DEBUG = debug
Expand All @@ -36,6 +43,9 @@ def start(ctx, debug, config):
else:
agile = {}
ctx.obj['agile'] = agile
if version:
click.echo(__version__)
ctx.exit(0)
if not ctx.invoked_subcommand:
click.echo(ctx.get_help())

Expand Down
2 changes: 1 addition & 1 deletion dev/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ dataclasses
# slack
slackclient
#
aio-kong
aio-kong>=0.2.1
2 changes: 2 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Agile toolkit

[![PyPI version](https://badge.fury.io/py/agile-toolkit.svg)](https://badge.fury.io/py/agile-toolkit)

[![CircleCI](https://circleci.com/gh/lendingblock/agile-toolkit.svg?style=svg)](https://circleci.com/gh/lendingblock/agile-toolkit)

[![codecov](https://codecov.io/gh/lendingblock/agile-toolkit/branch/master/graph/badge.svg)](https://codecov.io/gh/lendingblock/agile-toolkit)
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[flake8]
exclude = __pycache__,.eggs,venv,src
exclude = __pycache__,.eggs,venv,src,build,dist

[tool:pytest]
norecursedirs = src data docs scripts infra deploy
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ def requirements(name):
maintainer_email="luca@lendingblock.com",
url="https://github.com/lendingblock/agile-toolkit",
long_description=read('readme.md'),
long_description_content_type='text/markdown',
packages=find_packages(exclude=['tests', 'tests.*']),
include_package_data=True,
zip_safe=False,
Expand Down
12 changes: 10 additions & 2 deletions tests/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from click.testing import CliRunner

from agiletoolkit import __version__
from agiletoolkit.commands import start
from agiletoolkit.repo import RepoManager
from agiletoolkit.test import gitrepo
Expand All @@ -18,11 +19,18 @@ def test_main():
assert result.exit_code == 0
assert result.output.startswith('Usage:')
#
result = runner.invoke(start, '--config', 'tests/cfg1.json')
assert result.exit_code == 2
result = runner.invoke(start, ['--config', 'tests/cfg1.json'])
assert result.exit_code == 0
assert result.output.startswith('Usage:')


def test_version():
runner = CliRunner()
result = runner.invoke(start, ['--version'])
assert result.exit_code == 0
assert result.output.strip() == __version__


def test_repo(mocker):
with gitrepo('deploy'):
m = RepoManager()
Expand Down

0 comments on commit 09242c2

Please sign in to comment.