Compare commits

..

2 commits

Author SHA1 Message Date
beaf1377f9
project,projects
Some checks failed
/ job (push) Failing after 7s
2024-04-27 15:32:33 +02:00
af4cf1eda2
projects_parent
Some checks failed
/ job (push) Failing after 3s
2024-04-27 15:00:27 +02:00
4 changed files with 18 additions and 6 deletions

6
cd.sh
View file

@ -4,7 +4,7 @@ CD_DNS_SERVERS=(
'9.9.9.9' '9.9.9.9'
) )
CD_NAME='cd' CD_NAME='cd'
CD_REPOSITORIES_PARENT='rwx' CD_PROJECTS_PARENT='rwx'
function cd_set_environment { function cd_set_environment {
CD_DNS_FILE='/etc/resolv.conf' CD_DNS_FILE='/etc/resolv.conf'
@ -235,7 +235,7 @@ local root
cd_step "${FUNCNAME}" cd_step "${FUNCNAME}"
root="$(mktemp --directory)" || exit root="$(mktemp --directory)" || exit
for repository in \ for repository in \
"${CD_REPOSITORIES_PARENT}" \ "${CD_PROJECTS_PARENT}" \
"${CD_NAME}" \ "${CD_NAME}" \
; do ; do
git clone \ git clone \
@ -250,7 +250,7 @@ local root
function cd_bootstrap { function cd_bootstrap {
cd_step "${FUNCNAME}" cd_step "${FUNCNAME}"
"${CD_PYTHON_COMMAND}" -m "${CD_NAME}" "${CD_ENV}" "${CD_PYTHON_COMMAND}" -m "${CD_NAME}"
} }
function cd_main { function cd_main {

View file

@ -1,22 +1,28 @@
import os import os
from cd.project import Project
from cd.projects import Projects
from rwx import ps from rwx import ps
COMMANDS_PREFIX = 'cd-' COMMANDS_PREFIX = 'cd-'
environment = sorted(os.environ.items())
project = Project()
projects = Projects(environment)
def cd_clone_branch(): def cd_clone_branch():
ps.run('git', ps.run('git',
'clone', 'clone',
'--branch', os.environ['CD_PROJECT_BRANCH'], '--branch', project.branch,
'--', '--',
os.environ['CD_PROJECT_URL'], project.url,
'.', '.',
) )
def cd_list_environment(): def cd_list_environment():
for variable, value in sorted(os.environ.items()): for variable, value in environment:
print(variable, '=', value) print(variable, '=', value)

3
cd/project.py Normal file
View file

@ -0,0 +1,3 @@
class Project:
def __init__(self):
pass

3
cd/projects.py Normal file
View file

@ -0,0 +1,3 @@
class Projects:
def __init__(self, environment):
self.env = environment