Permalink
Browse files

Begin work on "ct new"

  • Loading branch information...
1 parent 1a20749 commit 84e2e6aef4ef92e5e416e4f762993ccb606bfa30 @derf committed Oct 14, 2010
Showing with 30 additions and 0 deletions.
  1. +30 −0 bin/ct
View
30 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)

0 comments on commit 84e2e6a

Please sign in to comment.