From beaf1377f9ae9c2ee7e594499cb85218512cee50 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 27 Apr 2024 15:32:33 +0200 Subject: [PATCH] project,projects --- cd.sh | 2 +- cd/__init__.py | 12 +++++++++--- cd/project.py | 3 +++ cd/projects.py | 3 +++ 4 files changed, 16 insertions(+), 4 deletions(-) create mode 100644 cd/project.py create mode 100644 cd/projects.py diff --git a/cd.sh b/cd.sh index 8ac72bf..dbbfd8f 100644 --- a/cd.sh +++ b/cd.sh @@ -250,7 +250,7 @@ local root function cd_bootstrap { cd_step "${FUNCNAME}" - "${CD_PYTHON_COMMAND}" -m "${CD_NAME}" "${CD_ENV}" + "${CD_PYTHON_COMMAND}" -m "${CD_NAME}" } function cd_main { diff --git a/cd/__init__.py b/cd/__init__.py index 0849737..7dbddbd 100644 --- a/cd/__init__.py +++ b/cd/__init__.py @@ -1,22 +1,28 @@ import os +from cd.project import Project +from cd.projects import Projects from rwx import ps COMMANDS_PREFIX = 'cd-' +environment = sorted(os.environ.items()) +project = Project() +projects = Projects(environment) + def cd_clone_branch(): ps.run('git', 'clone', - '--branch', os.environ['CD_PROJECT_BRANCH'], + '--branch', project.branch, '--', - os.environ['CD_PROJECT_URL'], + project.url, '.', ) def cd_list_environment(): - for variable, value in sorted(os.environ.items()): + for variable, value in environment: print(variable, '=', value) diff --git a/cd/project.py b/cd/project.py new file mode 100644 index 0000000..8ee7c56 --- /dev/null +++ b/cd/project.py @@ -0,0 +1,3 @@ +class Project: + def __init__(self): + pass diff --git a/cd/projects.py b/cd/projects.py new file mode 100644 index 0000000..96f57bf --- /dev/null +++ b/cd/projects.py @@ -0,0 +1,3 @@ +class Projects: + def __init__(self, environment): + self.env = environment