mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-07-17 14:04:24 +02:00
Renamed generate commands to build
This commit is contained in:
parent
3eb8b54a1a
commit
adec2aed84
8
Makefile
8
Makefile
@ -1,9 +1,9 @@
|
||||
ROLES_DIR := ./roles
|
||||
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_SCRIPT := ./cli/generate/defaults/users.py
|
||||
INCLUDES_SCRIPT := ./cli/generate/role_include.py
|
||||
USERS_SCRIPT := ./cli/build/defaults/users.py
|
||||
INCLUDES_SCRIPT := ./cli/build/role_include.py
|
||||
|
||||
INCLUDE_GROUPS := $(shell python3 main.py meta invokable_paths -s "-" --no-signal | tr '\n' ' ')
|
||||
|
||||
@ -27,7 +27,7 @@ clean:
|
||||
|
||||
tree:
|
||||
@echo Generating Tree
|
||||
python3 main.py generate tree -D 2 --no-signal
|
||||
python3 main.py build tree -D 2 --no-signal
|
||||
|
||||
build:
|
||||
@echo "🔧 Generating users defaults → $(USERS_OUT)…"
|
||||
|
@ -4,7 +4,7 @@ import argparse
|
||||
import json
|
||||
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):
|
4
main.py
4
main.py
@ -185,11 +185,11 @@ if __name__ == "__main__":
|
||||
Fore.CYAN
|
||||
))
|
||||
print(color_text(
|
||||
" e.g. `cymais generate defaults users` →",
|
||||
" e.g. `cymais build defaults users` →",
|
||||
Fore.CYAN
|
||||
))
|
||||
print(color_text(
|
||||
" corresponds to `cli/generate/defaults/users.py`.",
|
||||
" corresponds to `cli/build/defaults/users.py`.",
|
||||
Fore.CYAN
|
||||
))
|
||||
print()
|
||||
|
@ -2,7 +2,7 @@ import os
|
||||
import unittest
|
||||
|
||||
# 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):
|
||||
"""
|
||||
|
@ -9,7 +9,7 @@ import yaml
|
||||
# Adjust path to include cli/ folder
|
||||
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):
|
||||
def setUp(self):
|
||||
|
@ -30,7 +30,7 @@ class TestGenerateDefaultApplications(unittest.TestCase):
|
||||
shutil.rmtree(self.temp_dir)
|
||||
|
||||
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(
|
||||
[
|
||||
|
@ -45,7 +45,7 @@ class TestGenerateDefaultApplicationsUsers(unittest.TestCase):
|
||||
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.
|
||||
"""
|
||||
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([
|
||||
"python3", str(script_path),
|
||||
"--roles-dir", str(self.roles_dir),
|
||||
|
@ -7,7 +7,7 @@ import yaml
|
||||
from collections import OrderedDict
|
||||
|
||||
# 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
|
||||
|
||||
|
@ -3,7 +3,7 @@ import tempfile
|
||||
import shutil
|
||||
import os
|
||||
import yaml
|
||||
from cli.generate import graph
|
||||
from cli.build import graph
|
||||
|
||||
|
||||
class TestGraphLogic(unittest.TestCase):
|
||||
|
@ -3,7 +3,7 @@ import tempfile
|
||||
import shutil
|
||||
import os
|
||||
import json
|
||||
from cli.generate import tree
|
||||
from cli.build import tree
|
||||
|
||||
|
||||
class TestTreeMain(unittest.TestCase):
|
||||
|
Loading…
x
Reference in New Issue
Block a user