• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

binbashar / leverage / 13831367841

13 Mar 2025 09:33AM UTC coverage: 60.992% (+0.3%) from 60.662%
13831367841

Pull #299

github

Franr
check toolbox version rather than ref-arch
Pull Request #299: BL-143 | Version warning

204 of 468 branches covered (43.59%)

Branch coverage included in aggregate %.

12 of 14 new or added lines in 2 files covered. (85.71%)

2 existing lines in 1 file now uncovered.

2576 of 4090 relevant lines covered (62.98%)

0.63 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

94.87
/leverage/leverage.py
1
"""
2
    Binbash Leverage Command-line tool.
3
"""
4
import rich
1✔
5
from packaging.version import Version
1✔
6

7
import click
1✔
8

9
from leverage import __version__, conf, MINIMUM_VERSIONS
1✔
10
from leverage._internals import pass_state
1✔
11
from leverage.modules.aws import aws
1✔
12
from leverage.modules.credentials import credentials
1✔
13
from leverage.modules import run, project, terraform, tfautomv, kubectl, shell
1✔
14
from leverage.path import NotARepositoryError
1✔
15

16

17
@click.group(invoke_without_command=True)
1✔
18
@click.option("-v", "--verbose", is_flag=True, help="Increase output verbosity.")
1✔
19
@click.version_option(version=__version__)
1✔
20
@pass_state
1✔
21
@click.pass_context
1✔
22
def leverage(context, state, verbose):
1✔
23
    """Leverage Reference Architecture projects command-line tool."""
24
    # --verbose | -v
25
    state.verbosity = verbose
1✔
26
    if context.invoked_subcommand is None:
1✔
27
        # leverage called with no subcommand
28
        click.echo(context.get_help())
1✔
29

30
    # if there is a version restriction set, make sure we satisfy it
31
    try:
1✔
32
        config = conf.load()
1✔
NEW
33
    except NotARepositoryError:
×
34
        # restrictions are only verified within a leverage project
NEW
35
        return
×
36

37
    # check if the current versions are lower than the minimum required
38
    current_values = config.get("TERRAFORM_IMAGE_TAG").split("-")
1✔
39
    for key, current in zip(MINIMUM_VERSIONS, current_values):
1✔
40
        if Version(current) < Version(MINIMUM_VERSIONS[key]):
1✔
41
            rich.print(
1✔
42
                f"[red]WARNING[/red]\tYour current {key} version ({current}) is lower than the required minimum ({MINIMUM_VERSIONS[key]})."
43
            )
44

45

46
# Add modules to leverage
47
leverage.add_command(run)
1✔
48
leverage.add_command(project)
1✔
49
leverage.add_command(terraform)
1✔
50
leverage.add_command(terraform, name="tf")
1✔
51
leverage.add_command(credentials)
1✔
52
leverage.add_command(aws)
1✔
53
leverage.add_command(tfautomv)
1✔
54
leverage.add_command(kubectl)
1✔
55
leverage.add_command(kubectl, name="kc")
1✔
56
leverage.add_command(shell)
1✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc