Initial ABSDEV deployment framework development preview
ABSDEV Framework CI / framework-validation (push) Canceled after 0s
ABSDEV Framework CI / framework-validation (push) Canceled after 0s
This commit is contained in:
Executable
+22
@@ -0,0 +1,22 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import runpy
|
||||
import sys
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
|
||||
sys.path.insert(0, str(ROOT))
|
||||
|
||||
# Preserve the original validation behaviour.
|
||||
|
||||
if len(sys.argv) > 1 and sys.argv[1] == "validate":
|
||||
runpy.run_path(
|
||||
str(ROOT / "bin/absdev-deploy-validate.py"),
|
||||
run_name="__main__",
|
||||
)
|
||||
else:
|
||||
from core.inspection_cli import main
|
||||
|
||||
sys.exit(main())
|
||||
Executable
+75
@@ -0,0 +1,75 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import argparse
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
ROOT = Path(__file__).resolve().parent.parent
|
||||
|
||||
sys.path.insert(0, str(ROOT))
|
||||
|
||||
from core.configuration import (
|
||||
ConfigurationError,
|
||||
load_config,
|
||||
)
|
||||
|
||||
|
||||
def main():
|
||||
|
||||
parser = argparse.ArgumentParser(
|
||||
description="ABSDEV Deployment Framework"
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
"--version",
|
||||
action="version",
|
||||
version=(ROOT / "VERSION").read_text().strip(),
|
||||
)
|
||||
|
||||
commands = parser.add_subparsers(
|
||||
dest="command",
|
||||
required=True,
|
||||
)
|
||||
|
||||
validate = commands.add_parser(
|
||||
"validate",
|
||||
help="Validate site configuration without deployment",
|
||||
)
|
||||
|
||||
validate.add_argument(
|
||||
"--config",
|
||||
required=True,
|
||||
type=Path,
|
||||
)
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
try:
|
||||
|
||||
if args.command == "validate":
|
||||
|
||||
config = load_config(args.config)
|
||||
|
||||
print("PASS: Configuration valid")
|
||||
print("Site:", config["site"]["identifier"])
|
||||
print("Domain:", config["site"]["domain"])
|
||||
print("Database:", config["database"]["driver"])
|
||||
print("Schema:", config["schema_version"])
|
||||
print("No deployment performed")
|
||||
|
||||
return 0
|
||||
|
||||
except ConfigurationError as error:
|
||||
|
||||
print(
|
||||
f"ERROR: {error}",
|
||||
file=sys.stderr,
|
||||
)
|
||||
|
||||
return 1
|
||||
|
||||
return 1
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
Reference in New Issue
Block a user