Compare commits
2 commits
ed7daae3f8
...
beaf1377f9
Author | SHA1 | Date | |
---|---|---|---|
beaf1377f9 | |||
af4cf1eda2 |
4 changed files with 18 additions and 6 deletions
6
cd.sh
6
cd.sh
|
@ -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 {
|
||||||
|
|
|
@ -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
3
cd/project.py
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
class Project:
|
||||||
|
def __init__(self):
|
||||||
|
pass
|
3
cd/projects.py
Normal file
3
cd/projects.py
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
class Projects:
|
||||||
|
def __init__(self, environment):
|
||||||
|
self.env = environment
|
Loading…
Reference in a new issue