Renamed generate commands to build

This commit is contained in:
Kevin Veen-Birkenbach 2025-07-12 17:11:41 +02:00
parent 3eb8b54a1a
commit adec2aed84
No known key found for this signature in database
GPG Key ID: 44D8F11FD62F878E
17 changed files with 14 additions and 14 deletions

View File

@ -1,9 +1,9 @@
ROLES_DIR := ./roles ROLES_DIR := ./roles
APPLICATIONS_OUT := ./group_vars/all/04_applications.yml APPLICATIONS_OUT := ./group_vars/all/04_applications.yml
APPLICATIONS_SCRIPT := ./cli/generate/defaults/applications.py APPLICATIONS_SCRIPT := ./cli/build/defaults/applications.py
USERS_OUT := ./group_vars/all/03_users.yml USERS_OUT := ./group_vars/all/03_users.yml
USERS_SCRIPT := ./cli/generate/defaults/users.py USERS_SCRIPT := ./cli/build/defaults/users.py
INCLUDES_SCRIPT := ./cli/generate/role_include.py INCLUDES_SCRIPT := ./cli/build/role_include.py
INCLUDE_GROUPS := $(shell python3 main.py meta invokable_paths -s "-" --no-signal | tr '\n' ' ') INCLUDE_GROUPS := $(shell python3 main.py meta invokable_paths -s "-" --no-signal | tr '\n' ' ')
@ -27,7 +27,7 @@ clean:
tree: tree:
@echo Generating Tree @echo Generating Tree
python3 main.py generate tree -D 2 --no-signal python3 main.py build tree -D 2 --no-signal
build: build:
@echo "🔧 Generating users defaults → $(USERS_OUT)" @echo "🔧 Generating users defaults → $(USERS_OUT)"

View File

@ -4,7 +4,7 @@ import argparse
import json import json
from typing import Dict, Any from typing import Dict, Any
from cli.generate.graph import build_mappings, output_graph from cli.build.graph import build_mappings, output_graph
def find_roles(roles_dir: str): def find_roles(roles_dir: str):

View File

@ -185,11 +185,11 @@ if __name__ == "__main__":
Fore.CYAN Fore.CYAN
)) ))
print(color_text( print(color_text(
" e.g. `cymais generate defaults users` →", " e.g. `cymais build defaults users` →",
Fore.CYAN Fore.CYAN
)) ))
print(color_text( print(color_text(
" corresponds to `cli/generate/defaults/users.py`.", " corresponds to `cli/build/defaults/users.py`.",
Fore.CYAN Fore.CYAN
)) ))
print() print()

View File

@ -2,7 +2,7 @@ import os
import unittest import unittest
# import the functions from your CLI script # import the functions from your CLI script
from cli.generate.role_include import build_dependency_graph, find_cycle from cli.build.role_include import build_dependency_graph, find_cycle
class TestCircularDependencies(unittest.TestCase): class TestCircularDependencies(unittest.TestCase):
""" """

View File

@ -9,7 +9,7 @@ import yaml
# Adjust path to include cli/ folder # Adjust path to include cli/ folder
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "../../../../..", "cli"))) sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "../../../../..", "cli")))
from cli.generate.role_include import build_dependency_graph, topological_sort, gen_condi_role_incl from cli.build.role_include import build_dependency_graph, topological_sort, gen_condi_role_incl
class TestGeneratePlaybook(unittest.TestCase): class TestGeneratePlaybook(unittest.TestCase):
def setUp(self): def setUp(self):

View File

@ -30,7 +30,7 @@ class TestGenerateDefaultApplications(unittest.TestCase):
shutil.rmtree(self.temp_dir) shutil.rmtree(self.temp_dir)
def test_script_generates_expected_yaml(self): def test_script_generates_expected_yaml(self):
script_path = Path(__file__).resolve().parent.parent.parent.parent.parent.parent / "cli/generate/defaults/applications.py" script_path = Path(__file__).resolve().parent.parent.parent.parent.parent.parent / "cli/build/defaults/applications.py"
result = subprocess.run( result = subprocess.run(
[ [

View File

@ -45,7 +45,7 @@ class TestGenerateDefaultApplicationsUsers(unittest.TestCase):
When a users.yml exists with defined users, the script should inject a 'users' When a users.yml exists with defined users, the script should inject a 'users'
mapping in the generated YAML, mapping each username to a Jinja2 reference. mapping in the generated YAML, mapping each username to a Jinja2 reference.
""" """
script_path = Path(__file__).resolve().parents[5] / "cli" / "generate/defaults/applications.py" script_path = Path(__file__).resolve().parents[5] / "cli" / "build/defaults/applications.py"
result = subprocess.run([ result = subprocess.run([
"python3", str(script_path), "python3", str(script_path),
"--roles-dir", str(self.roles_dir), "--roles-dir", str(self.roles_dir),

View File

@ -7,7 +7,7 @@ import yaml
from collections import OrderedDict from collections import OrderedDict
# Add cli/ to import path # Add cli/ to import path
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "../../../../..", "cli/generate/defaults/"))) sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "../../../../..", "cli/build/defaults/")))
import users import users

View File

@ -3,7 +3,7 @@ import tempfile
import shutil import shutil
import os import os
import yaml import yaml
from cli.generate import graph from cli.build import graph
class TestGraphLogic(unittest.TestCase): class TestGraphLogic(unittest.TestCase):

View File

@ -3,7 +3,7 @@ import tempfile
import shutil import shutil
import os import os
import json import json
from cli.generate import tree from cli.build import tree
class TestTreeMain(unittest.TestCase): class TestTreeMain(unittest.TestCase):