コード例 #1
0
ファイル: repo.py プロジェクト: charbonnierg/kapla-cli
def create_repo() -> Monorepo:
    if not confirm("Do you want to create a new project ?"):
        sys.exit(0)
    run("poetry init")
    repo = Monorepo(Path.cwd())
    repo.set_include_packages([])

    return repo
コード例 #2
0
ファイル: release.py プロジェクト: charbonnierg/kapla-cli
def install_deps(become: bool = typer.Option(
    False,
    "-b",
    "--become",
    help="perform installation as root user using sudo")) -> None:
    """Install release dependencies"""
    deps = [
        "semantic-release",
        "@semantic-release/commit-analyzer",
        "@semantic-release/changelog",
        "@semantic-release/exec",
        "conventional-changelog-conventionalcommits",
    ]
    cmd = "npm i -g " + " ".join(deps)
    if become:
        cmd = "sudo " + cmd
    console.print(f"Running command: {quote(style_str(cmd, 'bold'))}")
    run(cmd)
コード例 #3
0
ファイル: release.py プロジェクト: charbonnierg/kapla-cli
def prepare_release(
    version: str = VERSION,
    branch: str = BRANCH,
) -> None:
    """Prepare the release."""
    # Make sure to start from given branch
    run(f"git checkout {branch}")
    # Update version using command defined above
    run(f"k bump {version}")
    # At this point semantic release already performed a commit
    run("git add .")
    # Commit changes to the current branch
    run(f"git commit -m 'chore(release): bumped to version {version}'")
コード例 #4
0
def run_prof(
    script: Optional[str] = typer.Argument(None, help="Script to run"),
    module: Optional[str] = typer.Option(None,
                                         "-m",
                                         "--module",
                                         help="Module to run"),
    output: str = typer.Option(None, "-o", "--output", help="Output file"),
) -> None:
    out_opt = f" -o {output}" if output else ""
    if module:
        rest = " -m " + module
    elif script:
        rest = " " + quote(script)
        script = script
    else:
        console.print(
            "Wrong usage: Either [bold]-m[/bold]/[bold]--module[/bold] option or a [bold]positional argument[/bold] must be present",
            style="red",
        )
        raise typer.Exit(1)
    cmd = f"python -m cProfile {out_opt} {rest}"
    console.print(f"[bold blue]Profiling[/bold blue] with command: {cmd}")
    run(cmd)
コード例 #5
0
ファイル: release.py プロジェクト: charbonnierg/kapla-cli
def on_success(branch: str = BRANCH) -> None:
    """Merge changes back into next on success on stable releases only."""
    if branch == STABLE_BRANCH_NAME:
        # Checkout release candidate branch ("next" by default)
        run(f"git switch -c {RC_BRANCH_NAME} 2>/dev/null || git checkout {RC_BRANCH_NAME}"
            )
        # Merge changes from stable branch
        run(f"git merge --no-ff origin/{branch} -m 'chore(release): merge from stable branch [skip ci]'"
            )
        # Push changes into release candidate branch ("next" by default)
        run(f"git push origin {RC_BRANCH_NAME}")
コード例 #6
0
ファイル: base.py プロジェクト: charbonnierg/kapla-cli
def commit() -> None:
    """Commit changes to git repository."""
    with current_directory(repo.root):
        run("cz commit")
コード例 #7
0
ファイル: base.py プロジェクト: charbonnierg/kapla-cli
def coverage() -> None:
    """Start HTML server displaying code coverage."""
    with current_directory(repo.root):
        run("python -m http.server --bind 127.0.0.1 --directory coverage-report")
コード例 #8
0
def viz_prof(profile_report: Path = typer.Argument(
    ..., help="Path to .prof file")) -> None:
    run(f"snakeviz {profile_report}")
コード例 #9
0
ファイル: release.py プロジェクト: charbonnierg/kapla-cli
def dry_run() -> None:
    """Perform a release dry-run."""
    with ensure_config():
        run("semantic-release --dry-run --debug")
コード例 #10
0
ファイル: release.py プロジェクト: charbonnierg/kapla-cli
def publish_release(branch: str = BRANCH) -> None:
    """Perform the release."""
    # Checkout target branch
    run(f"git checkout {branch}")
    # Push changes into target branch
    run(f"git push origin {branch}")
コード例 #11
0
ファイル: release.py プロジェクト: charbonnierg/kapla-cli
def do_release() -> None:
    """Perform a release."""
    with ensure_config():
        run("semantic-release --debug")