Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from mrprompt/develop
Develop
- Loading branch information
Showing
21 changed files
with
399 additions
and
283 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import click | ||
from .user import user | ||
from .server import server | ||
from .environment import environment | ||
from .repository import repository | ||
from .deploy import deploy | ||
|
||
|
||
@click.group() | ||
def cli(): | ||
pass | ||
|
||
cli.add_command(user) | ||
cli.add_command(server) | ||
cli.add_command(environment) | ||
cli.add_command(repository) | ||
cli.add_command(deploy) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import os | ||
from deploybot.client import Client | ||
|
||
|
||
class Config(object): | ||
|
||
def __init__(self): | ||
self.account = os.environ.get('DEPLOYBOT_ACCOUNT') | ||
self.token = os.environ.get('DEPLOYBOT_TOKEN') | ||
self.width = os.environ.get('COLUMN_WIDTH', 32) | ||
self.style = os.environ.get('COLUMN_STYLE', 'fancy_grid') | ||
self.client = Client(self.account, self.token) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
from deploybot.deploy import Deploy | ||
from .config import Config | ||
from . import response | ||
from io import StringIO | ||
import click | ||
import tableprint | ||
|
||
output = StringIO() | ||
pass_config = click.make_pass_decorator(Config, ensure=True) | ||
header = ('ID', 'Repository ID', 'Environment ID', 'State', 'Version') | ||
|
||
|
||
@click.group('deploy', short_help='Deploy commands') | ||
def deploy(): | ||
pass | ||
|
||
|
||
@deploy.command('list') | ||
@click.argument('repository', type=int) | ||
@click.argument('environment', type=int) | ||
@pass_config | ||
def deploy_list(config, repository, environment): | ||
"""List deploys""" | ||
client = Deploy(config.client) | ||
result = client.list(repository, environment) | ||
data = response('deploy', 'list', result) | ||
|
||
tableprint.table(data, headers=header, width=int(config.width), style=config.style, out=output) | ||
click.echo(output.getvalue()) | ||
|
||
|
||
@deploy.command('get') | ||
@click.argument('id', type=int) | ||
@pass_config | ||
def deploy_get(config, id): | ||
"""Get info from deploy""" | ||
client = Deploy(config.client) | ||
result = client.get(id) | ||
data = response('deploy', 'get', result) | ||
|
||
tableprint.table(data, headers=header, width=int(config.width), style=config.style, out=output) | ||
click.echo(output.getvalue()) | ||
|
||
|
||
@deploy.command('trigger') | ||
@click.argument('id', type=int) | ||
@pass_config | ||
def deploy_get(config, id): | ||
"""Trigger a specific deploy""" | ||
client = Deploy(config.client) | ||
result = client.get(id) | ||
data = response('deploy', 'trigger', result) | ||
|
||
tableprint.table(data, headers=header, width=int(config.width), style=config.style, out=output) | ||
click.echo(output.getvalue()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
from deploybot.environment import Environment | ||
from .config import Config | ||
from . import response | ||
from io import StringIO | ||
import click | ||
import tableprint | ||
|
||
output = StringIO() | ||
pass_config = click.make_pass_decorator(Config, ensure=True) | ||
header = ('ID', 'Repository ID', 'Environment Name', 'Branch', 'Automatic', 'Current') | ||
|
||
|
||
@click.group('environment', short_help='Environment commands') | ||
def environment(): | ||
pass | ||
|
||
|
||
@environment.command('list') | ||
@click.argument('repository', type=int, required=False) | ||
@pass_config | ||
def environment_list(config, repository=None): | ||
"""List environments""" | ||
client = Environment(config.client) | ||
result = client.list(repository) | ||
data = response('environment', 'list', result) | ||
|
||
tableprint.table(data, headers=header, width=int(config.width), style=config.style, out=output) | ||
click.echo(output.getvalue()) | ||
|
||
|
||
@environment.command('get') | ||
@click.argument('id', type=int) | ||
@pass_config | ||
def environment_get(config, id): | ||
"""Get info from environment""" | ||
client = Environment(config.client) | ||
result = client.get(id) | ||
data = response('environment', 'get', result) | ||
|
||
tableprint.table(data, headers=header, width=int(config.width), style=config.style, out=output) | ||
click.echo(output.getvalue()) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
from deploybot.repository import Repository | ||
from .config import Config | ||
from . import response | ||
from io import StringIO | ||
import click | ||
import tableprint | ||
|
||
output = StringIO() | ||
pass_config = click.make_pass_decorator(Config, ensure=True) | ||
header = ('ID', 'Title', 'Name') | ||
|
||
|
||
@click.group('repository', short_help='Repository commands') | ||
def repository(): | ||
pass | ||
|
||
|
||
@repository.command('list') | ||
@pass_config | ||
def repository_list(config): | ||
"""List repositorys""" | ||
client = Repository(config.client) | ||
result = client.list() | ||
data = response('repository', 'list', result) | ||
|
||
tableprint.table(data, headers=header, width=int(config.width), style=config.style, out=output) | ||
click.echo(output.getvalue()) | ||
|
||
|
||
@repository.command('get') | ||
@click.argument('id', type=int) | ||
@pass_config | ||
def repository_get(config, id): | ||
"""Get info from repository""" | ||
client = Repository(config.client) | ||
result = client.get(id) | ||
data = response('repository', 'get', result) | ||
|
||
tableprint.table(data, headers=header, width=int(config.width), style=config.style, out=output) | ||
click.echo(output.getvalue()) |
Oops, something went wrong.