From 84e2e6aef4ef92e5e416e4f762993ccb606bfa30 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Thu, 14 Oct 2010 21:40:11 +0200 Subject: Begin work on "ct new" --- bin/ct | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'bin') diff --git a/bin/ct b/bin/ct index 403c353..c5d102c 100755 --- a/bin/ct +++ b/bin/ct @@ -266,6 +266,17 @@ function vcs_log ( git log ) +function vcs_new ( + mkdir ${PKG_DIR}/${1} + cd ${PKG_DIR}/${1} || die "Cannot cd to new package ${1}" + git init + mkdir etc + + if ((GIT_USE_ORIGIN)) { + git remote add origin ${PKG_PROTO}://${PKG_UAH}/${PKG_PATH}/${1} + } +) + function vcs_pull ( vcs_setup ${1} if (( GIT_USE_ORIGIN )) { @@ -868,6 +879,24 @@ function pkg_log { vcs_log ${1} } +function pkg_new { + + if list_exists ${1}; then + die "We already have a package with this name: ${1}" + fi + + pkgroot_setup ${PKG_ROOTS[1]} + + info "Creating local package...\n" + vcs_new ${1} + + if [[ ${PKG_PROTO} == ssh ]] { + info "Creating remote packages...\n" + ssh ${PKG_UAH} "GIT_DIR=${PKG_PATH}/${1} git --bare init" + say "Note that you will have to push manually the first time\n" + } +} + function pkg_push { check_installed ${1} @@ -979,6 +1008,7 @@ case ${action} in i|info) pkg_info ${*} ;; ls|list) pkg_list ${*} ;; l|log) pkg_log ${*} ;; + n|new) pkg_new ${*} ;; version) pkg_version ;; f|pull) -- cgit v1.2.3