Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,6 @@ devenv.local.nix
# IntelliJ
.idea/
.fleet/

# Output from Karsk
output/
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ dev = [
]

[project.scripts]
deploy = "deploy.__main__:cli"
deploy = "deploy.cli:cli"

[tool.pytest.ini_options]
asyncio_mode = "auto"
Expand Down
127 changes: 0 additions & 127 deletions src/deploy/__main__.py

This file was deleted.

48 changes: 0 additions & 48 deletions src/deploy/_check.py

This file was deleted.

78 changes: 0 additions & 78 deletions src/deploy/check.py

This file was deleted.

21 changes: 21 additions & 0 deletions src/deploy/cli.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
from __future__ import annotations

import click

from deploy.commands.build import subcommand_build
from deploy.commands.sync import subcommand_sync
from deploy.commands.test import subcommand_test


@click.group()
def cli() -> None:
pass


cli.add_command(subcommand_build)
cli.add_command(subcommand_sync)
cli.add_command(subcommand_test)


if __name__ == "__main__":
cli()
32 changes: 31 additions & 1 deletion src/deploy/build.py → src/deploy/commands/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
from tempfile import NamedTemporaryFile, TemporaryDirectory
import shutil

from deploy.config import Config, GitConfig
import click

from deploy.config import Config, GitConfig, load_config
from deploy.package import Package
from deploy.package_list import PackageList
from deploy.utils import redirect_output
Expand Down Expand Up @@ -239,3 +241,31 @@ def _create_wrapper_script(

wrapper_script.write_text(script_content)
wrapper_script.chmod(0o755)


@click.command("build", help="Build Cirrus and dependencies")
@click.argument(
"config-file",
type=Path,
)
@click.option(
"--prefix",
default="./output/prefix",
type=Path,
)
@click.option(
"--force",
"-f",
is_flag=True,
default=False,
help="Force adding a new environment even if one already exists (rollback)",
)
def subcommand_build(config_file: Path, prefix: Path, force: bool) -> None:
config = load_config(config_file)
builder = Build(
config_file.parent,
config,
force=force,
prefix=prefix,
)
builder.build()
38 changes: 37 additions & 1 deletion src/deploy/sync.py → src/deploy/commands/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
import asyncio
from pathlib import Path

from deploy.config import Config, AreaConfig
import click

from deploy.config import Config, AreaConfig, load_config
from deploy.package_list import PackageList
from deploy.utils import redirect_output

Expand Down Expand Up @@ -191,3 +193,37 @@ def do_sync(
dry_run: bool = False,
) -> None:
asyncio.run(_sync(configpath, config, prefix, dest_prefix, no_async, dry_run))


@click.command("sync", help="Synchronise all locations")
@click.argument(
"config-file",
type=Path,
)
@click.option(
"--prefix",
default="./output/prefix",
type=Path,
)
@click.option(
"--no-async",
help="Don't deploy asynchronously",
is_flag=True,
default=False,
)
@click.option(
"--dry-run",
is_flag=True,
default=False,
)
def subcommand_sync(
config_file: Path, prefix: Path, no_async: bool, dry_run: bool
) -> None:
config = load_config(config_file)
do_sync(
config_file.parent,
config,
prefix=prefix,
no_async=no_async,
dry_run=dry_run,
)
Loading