diff options
| author | bozo.kopic <bozo@kopic.xyz> | 2022-03-28 00:03:31 +0200 |
|---|---|---|
| committer | bozo.kopic <bozo@kopic.xyz> | 2022-03-28 00:03:31 +0200 |
| commit | b8a61f60a0aa115141987f461658666ccbfd2034 (patch) | |
| tree | 071d7c265be7e1ef72d1b9057c8bf443ea545e2e /src_py | |
| parent | 1d56c732965cad4c8eb06ed5638f7ecdea88f290 (diff) | |
rename hatter to boxhatter
Diffstat (limited to 'src_py')
| -rw-r--r-- | src_py/boxhatter/__init__.py (renamed from src_py/hatter/__init__.py) | 0 | ||||
| -rw-r--r-- | src_py/boxhatter/__main__.py (renamed from src_py/hatter/__main__.py) | 4 | ||||
| -rw-r--r-- | src_py/boxhatter/backend.py (renamed from src_py/hatter/backend.py) | 2 | ||||
| -rw-r--r-- | src_py/boxhatter/common.py (renamed from src_py/hatter/common.py) | 0 | ||||
| -rw-r--r-- | src_py/boxhatter/main.py (renamed from src_py/hatter/main.py) | 38 | ||||
| -rw-r--r-- | src_py/boxhatter/server.py (renamed from src_py/hatter/server.py) | 10 | ||||
| -rw-r--r-- | src_py/boxhatter/ui.py (renamed from src_py/hatter/ui.py) | 12 |
7 files changed, 33 insertions, 33 deletions
diff --git a/src_py/hatter/__init__.py b/src_py/boxhatter/__init__.py index e69de29..e69de29 100644 --- a/src_py/hatter/__init__.py +++ b/src_py/boxhatter/__init__.py diff --git a/src_py/hatter/__main__.py b/src_py/boxhatter/__main__.py index 065fe88..fdd8f51 100644 --- a/src_py/hatter/__main__.py +++ b/src_py/boxhatter/__main__.py @@ -1,8 +1,8 @@ import sys -from hatter.main import main +from boxhatter.main import main if __name__ == '__main__': - sys.argv[0] = 'hatter' + sys.argv[0] = 'boxhatter' sys.exit(main()) diff --git a/src_py/hatter/backend.py b/src_py/boxhatter/backend.py index dd6a4f7..ad83851 100644 --- a/src_py/hatter/backend.py +++ b/src_py/boxhatter/backend.py @@ -4,7 +4,7 @@ import typing from hat import aio -from hatter import common +from boxhatter import common async def create(db_path: Path diff --git a/src_py/hatter/common.py b/src_py/boxhatter/common.py index ae314a5..ae314a5 100644 --- a/src_py/hatter/common.py +++ b/src_py/boxhatter/common.py diff --git a/src_py/hatter/main.py b/src_py/boxhatter/main.py index 8ceb892..2cc30cc 100644 --- a/src_py/hatter/main.py +++ b/src_py/boxhatter/main.py @@ -13,17 +13,17 @@ from hat import json import appdirs import click -from hatter import common -import hatter.backend -import hatter.server -import hatter.ui +from boxhatter import common +import boxhatter.backend +import boxhatter.server +import boxhatter.ui -user_config_dir: Path = Path(appdirs.user_config_dir('hatter')) -user_data_dir: Path = Path(appdirs.user_data_dir('hatter')) +user_config_dir: Path = Path(appdirs.user_config_dir('boxhatter')) +user_data_dir: Path = Path(appdirs.user_data_dir('boxhatter')) default_conf_path: Path = user_config_dir / 'server.yaml' -default_db_path: Path = user_data_dir / 'hatter.db' +default_db_path: Path = user_data_dir / 'boxhatter.db' ssh_key_path: typing.Optional[Path] = None @@ -58,7 +58,7 @@ def main(log_level: str, @main.command() -@click.option('--action', default='.hatter.yaml', +@click.option('--action', default='.boxhatter.yaml', help="action file path inside repository") @click.option('--env', multiple=True, help="environment variables") @@ -93,16 +93,16 @@ def execute(action: str, check=True) conf = json.decode_file(repo_dir / action) - common.json_schema_repo.validate('hatter://action.yaml#', conf) + common.json_schema_repo.validate('boxhatter://action.yaml#', conf) image = conf['image'] command = conf['command'] subprocess.run(['podman', 'run', '-i', '--rm', - '-v', f'{repo_dir}:/hatter', + '-v', f'{repo_dir}:/boxhatter', *itertools.chain.from_iterable(('--env', i) for i in env), image, '/bin/sh'], - input=f'set -e\ncd /hatter\n{command}\n', + input=f'set -e\ncd /boxhatter\n{command}\n', encoding='utf-8', check=True) @@ -113,17 +113,17 @@ def execute(action: str, @click.option('--port', default=24000, type=int, help="listening TCP port (default 24000)") @click.option('--conf', default=default_conf_path, metavar='PATH', type=Path, - help="configuration defined by hatter://server.yaml# " - "(default $XDG_CONFIG_HOME/hatter/server.yaml)") + help="configuration defined by boxhatter://server.yaml# " + "(default $XDG_CONFIG_HOME/boxhatter/server.yaml)") @click.option('--db', default=default_db_path, metavar='PATH', type=Path, help="sqlite database path " - "(default $XDG_CONFIG_HOME/hatter/hatter.db") + "(default $XDG_CONFIG_HOME/boxhatter/boxhatter.db") def server(host: str, port: int, conf: Path, db: Path): conf = json.decode_file(conf) - common.json_schema_repo.validate('hatter://server.yaml#', conf) + common.json_schema_repo.validate('boxhatter://server.yaml#', conf) with contextlib.suppress(asyncio.CancelledError): aio.run_asyncio(async_server(host, port, conf, db)) @@ -136,13 +136,13 @@ async def async_server(host: str, async_group = aio.Group() try: - backend = await hatter.backend.create(db_path) + backend = await boxhatter.backend.create(db_path) _bind_resource(async_group, backend) - server = await hatter.server.create(conf, backend) + server = await boxhatter.server.create(conf, backend) _bind_resource(async_group, server) - ui = await hatter.ui.create(host, port, server) + ui = await boxhatter.ui.create(host, port, server) _bind_resource(async_group, ui) await async_group.wait_closing() @@ -158,5 +158,5 @@ def _bind_resource(async_group, resource): if __name__ == '__main__': - sys.argv[0] = 'hatter' + sys.argv[0] = 'boxhatter' main() diff --git a/src_py/hatter/server.py b/src_py/boxhatter/server.py index 5f00707..24e4af0 100644 --- a/src_py/hatter/server.py +++ b/src_py/boxhatter/server.py @@ -12,12 +12,12 @@ import typing from hat import aio from hat import json -from hatter import common -import hatter.backend +from boxhatter import common +import boxhatter.backend async def create(conf: json.Data, - backend: hatter.backend.Backend + backend: boxhatter.backend.Backend ) -> 'Server': server = Server() server._conf = conf @@ -137,7 +137,7 @@ class Server(aio.Resource): while True: commit = await self._run_queue.get() repo_conf = self._conf['repos'][commit.repo] - action = repo_conf.get('action', '.hatter.yaml') + action = repo_conf.get('action', '.boxhatter.yaml') env = {**self._conf.get('env', {}), **repo_conf.get('env', {})} url = repo_conf['url'] @@ -169,7 +169,7 @@ class Server(aio.Resource): async def _execute(action, env, url, ref): - cmd = [sys.executable, '-m', 'hatter', 'execute', + cmd = [sys.executable, '-m', 'boxhatter', 'execute', '--action', action, *itertools.chain.from_iterable(('--env', i) for i in env), url, ref] diff --git a/src_py/hatter/ui.py b/src_py/boxhatter/ui.py index a10eede..2cf174d 100644 --- a/src_py/hatter/ui.py +++ b/src_py/boxhatter/ui.py @@ -4,8 +4,8 @@ import datetime from hat import aio import aiohttp.web -from hatter import common -import hatter.server +from boxhatter import common +import boxhatter.server static_dir: Path = common.package_path / 'ui' @@ -13,7 +13,7 @@ static_dir: Path = common.package_path / 'ui' async def create(host: str, port: int, - server: hatter.server.Server + server: boxhatter.server.Server ) -> 'UI': ui = UI() ui._server = server @@ -64,13 +64,13 @@ class UI(aio.Resource): body = (f'{_generate_repos(self._server.repos)}\n' f'{_generate_commits(commits)}') - return _create_html_response('hatter', body) + return _create_html_response('Box Hatter', body) async def _process_get_repo(self, request): repo = self._get_repo(request) commits = await self._server.get_commits(repo) - title = f'hatter - {repo}' + title = f'Box Hatter - {repo}' body = (f'{_generate_commits(commits)}\n' f'{_generate_run(repo)}') return _create_html_response(title, body) @@ -78,7 +78,7 @@ class UI(aio.Resource): async def _process_get_commit(self, request): commit = await self._get_commit(request) - title = f'hatter - {commit.repo}/{commit.hash}' + title = f'Box Hatter - {commit.repo}/{commit.hash}' body = _generate_commit(commit) return _create_html_response(title, body) |
